diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2016-02-06 11:13:28 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2016-02-06 11:13:28 +0100 |
commit | 1ec5502d46690439b2989653fa39978227914539 (patch) | |
tree | 747c3c86a6b564e6258ffaa5bc3417e71111c5a2 | |
parent | b65b7424030628a73c79999fc7c331a3032dbc96 (diff) | |
download | glslview-1ec5502d46690439b2989653fa39978227914539.tar glslview-1ec5502d46690439b2989653fa39978227914539.zip |
Add pause function
-rw-r--r-- | glslview.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -46,6 +46,7 @@ #endif +static bool paused = false; static float speed = 1.0; static unsigned previous_ticks = 0; @@ -98,7 +99,10 @@ static void check_reload(void) {} static void update(void) { unsigned ticks = SDL_GetTicks(); - current_time += speed * (ticks - previous_ticks); + + if (!paused) + current_time += speed * (ticks - previous_ticks); + previous_ticks = ticks; } @@ -151,6 +155,10 @@ static void handle_input(const char *input) { case '>': if (speed < 0) set_speed(-speed); + break; + + case ' ': + paused = !paused; } } } |