From 4efe0c2365c4bd6c124778fd9bcbe526756fd8e9 Mon Sep 17 00:00:00 2001 From: Pradana AUMARS Date: Sun, 27 Jun 2021 17:19:17 +0200 Subject: [PATCH] Add 'Press any key to start...' introductory message --- src/main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.c b/src/main.c index 0cb7683..4f1262d 100644 --- a/src/main.c +++ b/src/main.c @@ -14,6 +14,19 @@ int main (int argc, char* args[]) } p = Pong_init(); + Pong_render(p); + + int start = false; + while (!start) { + printf("Press any key to start...\r"); + fflush(stdout); + while( SDL_PollEvent( &(p->e) ) != 0 ) + { + if( p->e.type == SDL_KEYDOWN) start = true; + } + } + putc('\n', stdout); + Pong_run(p); Pong_free(p);