mirror of
https://github.com/minetest/irrlicht.git
synced 2024-12-27 08:27:30 +01:00
SDL: Always set X, Y, Shift and Control in mouse input events
This commit is contained in:
parent
e9908ca545
commit
57705d57cf
@ -463,7 +463,9 @@ bool CIrrDeviceSDL::run()
|
|||||||
|
|
||||||
switch ( SDL_event.type )
|
switch ( SDL_event.type )
|
||||||
{
|
{
|
||||||
case SDL_MOUSEMOTION:
|
case SDL_MOUSEMOTION: {
|
||||||
|
SDL_Keymod keymod = SDL_GetModState();
|
||||||
|
|
||||||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||||
irrevent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
|
irrevent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
|
||||||
MouseX = irrevent.MouseInput.X = SDL_event.motion.x;
|
MouseX = irrevent.MouseInput.X = SDL_event.motion.x;
|
||||||
@ -471,20 +473,35 @@ bool CIrrDeviceSDL::run()
|
|||||||
MouseXRel = SDL_event.motion.xrel;
|
MouseXRel = SDL_event.motion.xrel;
|
||||||
MouseYRel = SDL_event.motion.yrel;
|
MouseYRel = SDL_event.motion.yrel;
|
||||||
irrevent.MouseInput.ButtonStates = MouseButtonStates;
|
irrevent.MouseInput.ButtonStates = MouseButtonStates;
|
||||||
|
irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;
|
||||||
|
irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;
|
||||||
|
|
||||||
postEventFromUser(irrevent);
|
postEventFromUser(irrevent);
|
||||||
break;
|
break;
|
||||||
case SDL_MOUSEWHEEL:
|
}
|
||||||
|
case SDL_MOUSEWHEEL: {
|
||||||
|
SDL_Keymod keymod = SDL_GetModState();
|
||||||
|
|
||||||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||||
irrevent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL;
|
irrevent.MouseInput.Event = irr::EMIE_MOUSE_WHEEL;
|
||||||
irrevent.MouseInput.Wheel = static_cast<float>(SDL_event.wheel.y);
|
irrevent.MouseInput.Wheel = static_cast<float>(SDL_event.wheel.y);
|
||||||
|
irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;
|
||||||
|
irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;
|
||||||
|
irrevent.MouseInput.X = MouseX;
|
||||||
|
irrevent.MouseInput.Y = MouseY;
|
||||||
|
|
||||||
postEventFromUser(irrevent);
|
postEventFromUser(irrevent);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP: {
|
||||||
|
SDL_Keymod keymod = SDL_GetModState();
|
||||||
|
|
||||||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||||
irrevent.MouseInput.X = SDL_event.button.x;
|
irrevent.MouseInput.X = SDL_event.button.x;
|
||||||
irrevent.MouseInput.Y = SDL_event.button.y;
|
irrevent.MouseInput.Y = SDL_event.button.y;
|
||||||
|
irrevent.MouseInput.Shift = (keymod & KMOD_SHIFT) != 0;
|
||||||
|
irrevent.MouseInput.Control = (keymod & KMOD_CTRL) != 0;
|
||||||
|
|
||||||
irrevent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
|
irrevent.MouseInput.Event = irr::EMIE_MOUSE_MOVED;
|
||||||
|
|
||||||
@ -579,6 +596,7 @@ bool CIrrDeviceSDL::run()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case SDL_TEXTINPUT:
|
case SDL_TEXTINPUT:
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user