Extract offset modifier to a variable
This commit is contained in:
parent
abef6c368f
commit
8854dab2f2
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user