summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2016-04-05 14:01:50 +0200
committerPaweł Redman <pawel.redman@gmail.com>2016-04-05 14:01:50 +0200
commitc7acaee6651a84ef9102b29350c37803c8f435a9 (patch)
tree68af0d065a3580c32558feda7dc918e112771238 /src/main.c
parent77a74fcea5c628bb426b5cce1012e4e5504b10f1 (diff)
Console WIP.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c22
1 files changed, 18 insertions, 4 deletions
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();