From 8854dab2f2a0e75177d79bb1f42927e88485bf4d Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Sun, 22 Sep 2024 14:50:35 +0100 Subject: [PATCH] Extract offset modifier to a variable --- src/main.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.cc b/src/main.cc index 370adb8..d22c69c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -42,6 +42,7 @@ struct App { // OpenGL refers to as element, hence the name Element Buffer Object GLuint ebo; + float offset_modifier; // offset value passed to shaders as uniform float offset; // offset uniform index @@ -119,6 +120,8 @@ int init(App &app) { glGetString(GL_SHADING_LANGUAGE_VERSION) ); + app.offset_modifier = 0.02f; + return EXIT_CODE_SUCCESS; } @@ -216,9 +219,9 @@ void run_main_loop(App &app) { break; case SDL_KEYDOWN: if (app.event.key.keysym.sym == SDLK_UP) { - app.offset += 0.01f; + app.offset += app.offset_modifier; } else if (app.event.key.keysym.sym == SDLK_DOWN) { - app.offset -= 0.01f; + app.offset -= app.offset_modifier; } } }