mirror of
https://gitlab.com/dosowisko.net/libsuperderpy.git
synced 2025-01-05 22:48:02 +01:00
move showconsole variable to public struct
This commit is contained in:
parent
9ce1957968
commit
1d8fb9f2f3
4 changed files with 13 additions and 12 deletions
|
@ -215,7 +215,7 @@ SYMBOL_INTERNAL int SetupAudio(struct Game* game) {
|
||||||
|
|
||||||
SYMBOL_INTERNAL void DrawConsole(struct Game* game) {
|
SYMBOL_INTERNAL void DrawConsole(struct Game* game) {
|
||||||
double game_time = al_get_time();
|
double game_time = al_get_time();
|
||||||
if (game->_priv.showconsole) {
|
if (game->show_console) {
|
||||||
al_set_target_backbuffer(game->display);
|
al_set_target_backbuffer(game->display);
|
||||||
ALLEGRO_TRANSFORM trans;
|
ALLEGRO_TRANSFORM trans;
|
||||||
al_identity_transform(&trans);
|
al_identity_transform(&trans);
|
||||||
|
@ -290,7 +290,7 @@ SYMBOL_INTERNAL void* GamestateLoadingThread(void* arg) {
|
||||||
#ifndef LIBSUPERDERPY_SINGLE_THREAD
|
#ifndef LIBSUPERDERPY_SINGLE_THREAD
|
||||||
if (data->game->config.debug.enabled) {
|
if (data->game->config.debug.enabled) {
|
||||||
PrintConsole(data->game, "(sleeping for 3 seconds...)");
|
PrintConsole(data->game, "(sleeping for 3 seconds...)");
|
||||||
data->game->_priv.showconsole = true;
|
data->game->show_console = true;
|
||||||
al_rest(3.0);
|
al_rest(3.0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -595,7 +595,7 @@ static void DrawTimeline(struct Game* game, struct Timeline* timeline, int pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
SYMBOL_INTERNAL void DrawTimelines(struct Game* game) {
|
SYMBOL_INTERNAL void DrawTimelines(struct Game* game) {
|
||||||
if (!game->_priv.showtimeline) {
|
if (!game->_priv.show_timeline) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct List* tmp = game->_priv.timelines;
|
struct List* tmp = game->_priv.timelines;
|
||||||
|
|
|
@ -160,8 +160,8 @@ SYMBOL_EXPORT struct Game* libsuperderpy_init(int argc, char** argv, const char*
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
game->_priv.showconsole = game->config.debug.enabled;
|
game->show_console = game->config.debug.enabled;
|
||||||
game->_priv.showtimeline = false;
|
game->_priv.show_timeline = false;
|
||||||
|
|
||||||
if (!al_init_image_addon()) {
|
if (!al_init_image_addon()) {
|
||||||
fprintf(stderr, "failed to initialize image addon!\n");
|
fprintf(stderr, "failed to initialize image addon!\n");
|
||||||
|
|
|
@ -183,6 +183,8 @@ struct Game {
|
||||||
} debug; /*!< Debug mode settings. */
|
} debug; /*!< Debug mode settings. */
|
||||||
} config; /*!< Configuration values from the config file. */
|
} config; /*!< Configuration values from the config file. */
|
||||||
|
|
||||||
|
bool show_console; /*!< If true, game console is rendered on screen. */
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int x, y;
|
int x, y;
|
||||||
int w, h;
|
int w, h;
|
||||||
|
@ -211,8 +213,7 @@ struct Game {
|
||||||
char console[5][1024];
|
char console[5][1024];
|
||||||
unsigned int console_pos;
|
unsigned int console_pos;
|
||||||
ALLEGRO_EVENT_QUEUE* event_queue; /*!< Main event queue. */
|
ALLEGRO_EVENT_QUEUE* event_queue; /*!< Main event queue. */
|
||||||
bool showconsole; /*!< If true, game console is rendered on screen. */
|
bool show_timeline;
|
||||||
bool showtimeline;
|
|
||||||
|
|
||||||
double speed; /*!< Speed of the game in FPS. 60 == 1x */
|
double speed; /*!< Speed of the game in FPS. 60 == 1x */
|
||||||
|
|
||||||
|
|
|
@ -72,9 +72,9 @@ static inline bool HandleEvent(struct Game* game, ALLEGRO_EVENT* ev) {
|
||||||
#else
|
#else
|
||||||
if ((ev->keyboard.keycode == ALLEGRO_KEY_TILDE) || (ev->keyboard.keycode == ALLEGRO_KEY_BACKQUOTE)) {
|
if ((ev->keyboard.keycode == ALLEGRO_KEY_TILDE) || (ev->keyboard.keycode == ALLEGRO_KEY_BACKQUOTE)) {
|
||||||
#endif
|
#endif
|
||||||
game->_priv.showconsole = !game->_priv.showconsole;
|
game->show_console = !game->show_console;
|
||||||
if ((ev->keyboard.modifiers & ALLEGRO_KEYMOD_CTRL) && (game->config.debug.enabled)) {
|
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;
|
break;
|
||||||
case ALLEGRO_KEY_F9:
|
case ALLEGRO_KEY_F9:
|
||||||
game->_priv.speed = ALLEGRO_BPS_TO_SECS(60.0);
|
game->_priv.speed = ALLEGRO_BPS_TO_SECS(60.0);
|
||||||
game->_priv.showconsole = true;
|
game->show_console = true;
|
||||||
PrintConsole(game, "DEBUG: Gameplay speed: 1.00x");
|
PrintConsole(game, "DEBUG: Gameplay speed: 1.00x");
|
||||||
break;
|
break;
|
||||||
case ALLEGRO_KEY_F10: {
|
case ALLEGRO_KEY_F10: {
|
||||||
|
@ -191,7 +191,7 @@ static inline void HandleDebugEvent(struct Game* game, ALLEGRO_EVENT* ev) {
|
||||||
speed -= 10;
|
speed -= 10;
|
||||||
if (speed < 10) { speed = 10; }
|
if (speed < 10) { speed = 10; }
|
||||||
game->_priv.speed = ALLEGRO_BPS_TO_SECS(speed);
|
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);
|
PrintConsole(game, "DEBUG: Gameplay speed: %.2fx", speed / 60.0);
|
||||||
} break;
|
} break;
|
||||||
case ALLEGRO_KEY_F11: {
|
case ALLEGRO_KEY_F11: {
|
||||||
|
@ -199,7 +199,7 @@ static inline void HandleDebugEvent(struct Game* game, ALLEGRO_EVENT* ev) {
|
||||||
speed += 10;
|
speed += 10;
|
||||||
if (speed > 600) { speed = 600; }
|
if (speed > 600) { speed = 600; }
|
||||||
game->_priv.speed = ALLEGRO_BPS_TO_SECS(speed);
|
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);
|
PrintConsole(game, "DEBUG: Gameplay speed: %.2fx", speed / 60.0);
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue