mirror of
https://github.com/mattrberry/crab.git
synced 2025-01-30 20:34:45 +01:00
allow scaling the viewport
This commit is contained in:
parent
f31a0b72c9
commit
606bf07800
1 changed files with 6 additions and 3 deletions
|
@ -53,7 +53,7 @@ class SDLOpenGLImGuiFrontend < Frontend
|
|||
)
|
||||
@gl_context = setup_gl
|
||||
|
||||
@shader_programs = Hash.zip(CONTROLLERS, CONTROLLERS.map { |controller| Shader.new(SHADERS / controller.vertex_shader, SHADERS / controller.fragment_shader)})
|
||||
@shader_programs = Hash.zip(CONTROLLERS, CONTROLLERS.map { |controller| Shader.new(SHADERS / controller.vertex_shader, SHADERS / controller.fragment_shader) })
|
||||
shader_program = @shader_programs[@controller.class]
|
||||
shader_program.use
|
||||
|
||||
|
@ -160,8 +160,11 @@ class SDLOpenGLImGuiFrontend < Frontend
|
|||
elsif event.sym == LibSDL::Keycode::P && event.mod.includes?(LibSDL::Keymod::LCTRL)
|
||||
pause(!@pause) unless event.pressed? # toggle pause on key release
|
||||
end
|
||||
when SDL::Event::JoyHat,
|
||||
SDL::Event::JoyButton then @controller.handle_controller_event(event)
|
||||
when SDL::Event::JoyHat, SDL::Event::JoyButton then @controller.handle_controller_event(event)
|
||||
when SDL::Event::Window
|
||||
case LibSDL::WindowEventID.new(event.event.to_i!)
|
||||
when LibSDL::WindowEventID::SIZE_CHANGED then LibGL.viewport(0, 0, @window.width, @window.height)
|
||||
end
|
||||
when SDL::Event::Quit then exit
|
||||
else nil
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue