Support relative mouse mode
This commit is contained in:
parent
e73da04a31
commit
9cf5a88afd
2 changed files with 3 additions and 2 deletions
|
|
@ -16,7 +16,7 @@ namespace psemek::app
|
|||
virtual void on_focus_gained() {}
|
||||
virtual void on_focus_lost() {}
|
||||
|
||||
virtual void on_mouse_move(int /* x */, int /* y */) {}
|
||||
virtual void on_mouse_move(int /* x */, int /* y */, int /* dx */, int /* dy */) {}
|
||||
virtual void on_mouse_wheel(int /* delta */) {}
|
||||
virtual void on_left_button_down() {}
|
||||
virtual void on_left_button_up() {}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ namespace psemek::app
|
|||
}
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
handler->on_mouse_move(e.motion.x, e.motion.y);
|
||||
handler->on_mouse_move(e.motion.x, e.motion.y, e.motion.xrel, e.motion.yrel);
|
||||
break;
|
||||
case SDL_MOUSEWHEEL:
|
||||
handler->on_mouse_wheel(e.wheel.y);
|
||||
|
|
@ -229,6 +229,7 @@ namespace psemek::app
|
|||
void app::show_cursor(bool show)
|
||||
{
|
||||
SDL_ShowCursor(show ? SDL_TRUE : SDL_FALSE);
|
||||
SDL_SetRelativeMouseMode(show ? SDL_FALSE : SDL_TRUE);
|
||||
}
|
||||
|
||||
float app::time() const
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue