diff --git a/src/internal.c b/src/internal.c index cf46c6d..c2e3af7 100644 --- a/src/internal.c +++ b/src/internal.c @@ -215,7 +215,7 @@ SYMBOL_INTERNAL int SetupAudio(struct Game* game) { SYMBOL_INTERNAL void DrawConsole(struct Game* game) { double game_time = al_get_time(); - if (game->_priv.showconsole) { + if (game->show_console) { al_set_target_backbuffer(game->display); ALLEGRO_TRANSFORM trans; al_identity_transform(&trans); @@ -290,7 +290,7 @@ SYMBOL_INTERNAL void* GamestateLoadingThread(void* arg) { #ifndef LIBSUPERDERPY_SINGLE_THREAD if (data->game->config.debug.enabled) { PrintConsole(data->game, "(sleeping for 3 seconds...)"); - data->game->_priv.showconsole = true; + data->game->show_console = true; al_rest(3.0); } #endif @@ -595,7 +595,7 @@ static void DrawTimeline(struct Game* game, struct Timeline* timeline, int pos) } SYMBOL_INTERNAL void DrawTimelines(struct Game* game) { - if (!game->_priv.showtimeline) { + if (!game->_priv.show_timeline) { return; } struct List* tmp = game->_priv.timelines; diff --git a/src/libsuperderpy.c b/src/libsuperderpy.c index dc1fa6e..e32d1ea 100644 --- a/src/libsuperderpy.c +++ b/src/libsuperderpy.c @@ -160,8 +160,8 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char* } } - game->_priv.showconsole = game->config.debug.enabled; - game->_priv.showtimeline = false; + game->show_console = game->config.debug.enabled; + game->_priv.show_timeline = false; if (!al_init_image_addon()) { fprintf(stderr, "failed to initialize image addon!\n"); diff --git a/src/libsuperderpy.h b/src/libsuperderpy.h index b3f908f..ad4a9e2 100644 --- a/src/libsuperderpy.h +++ b/src/libsuperderpy.h @@ -183,6 +183,8 @@ struct Game { } debug; /*!< Debug mode settings. */ } config; /*!< Configuration values from the config file. */ + bool show_console; /*!< If true, game console is rendered on screen. */ + struct { int x, y; int w, h; @@ -211,8 +213,7 @@ struct Game { char console[5][1024]; unsigned int console_pos; ALLEGRO_EVENT_QUEUE* event_queue; /*!< Main event queue. */ - bool showconsole; /*!< If true, game console is rendered on screen. */ - bool showtimeline; + bool show_timeline; double speed; /*!< Speed of the game in FPS. 60 == 1x */ diff --git a/src/mainloop.c b/src/mainloop.c index 73087d8..a21376e 100644 --- a/src/mainloop.c +++ b/src/mainloop.c @@ -72,9 +72,9 @@ static inline bool HandleEvent(struct Game* game, ALLEGRO_EVENT* ev) { #else if ((ev->keyboard.keycode == ALLEGRO_KEY_TILDE) || (ev->keyboard.keycode == ALLEGRO_KEY_BACKQUOTE)) { #endif - game->_priv.showconsole = !game->_priv.showconsole; + game->show_console = !game->show_console; if ((ev->keyboard.modifiers & ALLEGRO_KEYMOD_CTRL) && (game->config.debug.enabled)) { - game->_priv.showtimeline = game->_priv.showconsole; + game->_priv.show_timeline = game->show_console; } } @@ -183,7 +183,7 @@ static inline void HandleDebugEvent(struct Game* game, ALLEGRO_EVENT* ev) { break; case ALLEGRO_KEY_F9: game->_priv.speed = ALLEGRO_BPS_TO_SECS(60.0); - game->_priv.showconsole = true; + game->show_console = true; PrintConsole(game, "DEBUG: Gameplay speed: 1.00x"); break; case ALLEGRO_KEY_F10: { @@ -191,7 +191,7 @@ static inline void HandleDebugEvent(struct Game* game, ALLEGRO_EVENT* ev) { speed -= 10; if (speed < 10) { speed = 10; } game->_priv.speed = ALLEGRO_BPS_TO_SECS(speed); - game->_priv.showconsole = true; + game->show_console = true; PrintConsole(game, "DEBUG: Gameplay speed: %.2fx", speed / 60.0); } break; case ALLEGRO_KEY_F11: { @@ -199,7 +199,7 @@ static inline void HandleDebugEvent(struct Game* game, ALLEGRO_EVENT* ev) { speed += 10; if (speed > 600) { speed = 600; } game->_priv.speed = ALLEGRO_BPS_TO_SECS(speed); - game->_priv.showconsole = true; + game->show_console = true; PrintConsole(game, "DEBUG: Gameplay speed: %.2fx", speed / 60.0); } break; }