diff options
-rw-r--r-- | glslview.c | 29 |
1 files changed, 22 insertions, 7 deletions
@@ -96,7 +96,15 @@ static void update(void) { unsigned ticks = SDL_GetTicks(); current_time += speed * (ticks - previous_ticks); previous_ticks = ticks; +} + +static void set_speed(float v) { + speed = v; + printf("speed: %f\n", v); +} +static void print_params(void) { + printf("params: %i %i %i\n", (int)param0, (int)param1, (int)param2); } static void handle_input(const char *input) { @@ -113,31 +121,32 @@ static void handle_input(const char *input) { case 'R': param0 = param1 = param2 = 0; + print_params(); break; case '+': - speed *= 1.1; + set_speed(speed * 1.1); break; case '-': - speed /= 1.1; + set_speed(speed / 1.1); break; case '=': if (speed < 0) - speed = -1.0; + set_speed(-1.0); else - speed = 1.0; + set_speed(1.0); break; case '<': if (speed > 0) - speed = -speed; + set_speed(-speed); break; case '>': if (speed < 0) - speed = -speed; + set_speed(-speed); } } } @@ -175,26 +184,32 @@ int main(int argc, char *argv[]) { switch (e.key.keysym.sym) { case SDLK_PAGEDOWN: param0++; + print_params(); break; case SDLK_PAGEUP: param0--; + print_params(); break; case SDLK_RIGHT: param1++; + print_params(); break; case SDLK_LEFT: param1--; + print_params(); break; case SDLK_DOWN: param2++; + print_params(); break; case SDLK_UP: param2--; + print_params(); break; case SDLK_ESCAPE: @@ -207,7 +222,7 @@ int main(int argc, char *argv[]) { break; case SDL_MOUSEWHEEL: - speed /= pow(1.1, e.wheel.y); + set_speed(speed / pow(1.1, e.wheel.y)); break; case SDL_QUIT: |