From c7acaee6651a84ef9102b29350c37803c8f435a9 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Tue, 5 Apr 2016 14:01:50 +0200 Subject: Console WIP. --- src/main.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 1bcc236..f30238c 100644 --- a/src/main.c +++ b/src/main.c @@ -5,15 +5,14 @@ #include "physics.h" #include "renderer.h" #include "ui.h" - -void itc_test(void); +#include "console.h" int main(void) { int rv = 0; r_window *first_window; phy_sim sim; - SDL_Thread *sim_thread; + SDL_Thread *sim_thread, *con_thread; if (r_init()) { con_printf("fatal error: renderer initialization failed\n"); @@ -54,6 +53,21 @@ int main(void) goto quit; } + if (con_init()) { + con_printf("fatal error: console initialization failed\n"); + rv = 1; + goto quit; + } + + con_thread = SDL_CreateThread((SDL_ThreadFunction)con_thread_f, + "con_thread", &sim); + if (!con_thread) { + con_printf("fatal error: SDL_CreateThread failed: %s\n", + SDL_GetError()); + rv = 1; + goto quit; + } + while (1) { SDL_Event event; @@ -72,7 +86,7 @@ quit: itc_chan_push(&sim.ctl, PHY_CMD_QUIT, NULL); SDL_WaitThread(sim_thread, NULL); - phy_sim_destroy(&sim); + phy_sim_destroy(&sim); ui_quit(); r_quit(); -- cgit