ohsp

Prototype for a game with dual thruster controls.
git clone git://git.amin.space/ohsp.git
Log | Files | Refs | LICENSE

commit 3d5248560bac8414c34da47fe0794b2ae0ada848
parent e2aefe68f080c390b8cfd870ae068f9eef6be646
Author: amin <dev@aminmesbah.com>
Date:   Mon, 20 Nov 2017 05:55:38 +0000

Add ability to skip screen clearing

- t key toggles 'trace'

Note that this exposes the non-determinism of the current game loop. The
lag compensation while-loop updates the game state, but not the input.
The variance in the number of these updates causes divergent results
even when identical input is played over a given initial state.

FossilOrigin-Name: e7c2bf3b31b6b773c6bf16b6a2928a5d42f52f0b8666d6da3fffcdbd50c3e5c5
Diffstat:
Msrc/platform_sdl.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/platform_sdl.c b/src/platform_sdl.c @@ -17,6 +17,7 @@ extern bool PAUSED; static struct SDLOffscreenBuffer global_back_buffer = {0}; static struct SDLInputRecord input_record = {0}; +static bool TRACE = false; struct SDLWindowDimension sdl_get_window_dimension(SDL_Window *window) @@ -117,6 +118,10 @@ bool sdl_handle_event(SDL_Event *event, struct GameControllerInput *controller_i { PAUSED = !PAUSED; } + else if (key_code == SDLK_t) + { + TRACE = !TRACE; + } else if (key_code == SDLK_r) { if (input_record.state == INACTIVE) @@ -397,7 +402,10 @@ int main(int argc, char *argv[]) } } - clear_screen(&global_back_buffer, COLOR_BACKGROUND); + if (!TRACE) + { + clear_screen(&global_back_buffer, COLOR_BACKGROUND); + } game_code.game_render(&buffer, lag/SECOND, &game_state); sdl_update_window(renderer, &global_back_buffer); if (elapsed_ms <= MS_PER_FRAME)