mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-02 20:11:15 +00:00
🧑💻 chore: separate cursor movement part
This commit is contained in:
parent
17df90bb2e
commit
18571714e1
@ -386,26 +386,7 @@ SDL_AppResult SDL_AppIterate(void* appstate)
|
||||
g_mousemoved = FALSE;
|
||||
}
|
||||
|
||||
if (g_lastJoystickMouseX != 0 || g_lastJoystickMouseY != 0) {
|
||||
g_mousemoved = TRUE;
|
||||
|
||||
g_lastMouseX = SDL_clamp(g_lastMouseX + g_lastJoystickMouseX, 0, 640);
|
||||
g_lastMouseY = SDL_clamp(g_lastMouseY + g_lastJoystickMouseY, 0, 480);
|
||||
|
||||
if (InputManager()) {
|
||||
InputManager()->QueueEvent(
|
||||
c_notificationMouseMove,
|
||||
g_mousedown ? LegoEventNotificationParam::c_lButtonState : 0,
|
||||
g_lastMouseX,
|
||||
g_lastMouseY,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
if (g_isle->GetDrawCursor()) {
|
||||
VideoManager()->MoveCursor(Min((MxS32) g_lastMouseX, 639), Min((MxS32) g_lastMouseY, 479));
|
||||
}
|
||||
}
|
||||
MoveVirtualCursorViaJoystick();
|
||||
}
|
||||
|
||||
return SDL_APP_CONTINUE;
|
||||
@ -1294,3 +1275,27 @@ IDirect3DRMMiniwinDevice* GetD3DRMMiniwinDevice()
|
||||
}
|
||||
return d3drmMiniwinDev;
|
||||
}
|
||||
|
||||
void MoveVirtualCursorViaJoystick()
|
||||
{
|
||||
if (g_lastJoystickMouseX != 0 || g_lastJoystickMouseY != 0) {
|
||||
g_mousemoved = TRUE;
|
||||
|
||||
g_lastMouseX = SDL_clamp(g_lastMouseX + g_lastJoystickMouseX, 0, 640);
|
||||
g_lastMouseY = SDL_clamp(g_lastMouseY + g_lastJoystickMouseY, 0, 480);
|
||||
|
||||
if (InputManager()) {
|
||||
InputManager()->QueueEvent(
|
||||
c_notificationMouseMove,
|
||||
g_mousedown ? LegoEventNotificationParam::c_lButtonState : 0,
|
||||
g_lastMouseX,
|
||||
g_lastMouseY,
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
if (g_isle->GetDrawCursor()) {
|
||||
VideoManager()->MoveCursor(Min((MxS32) g_lastMouseX, 639), Min((MxS32) g_lastMouseY, 479));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,4 +107,6 @@ extern MxS32 g_closed;
|
||||
|
||||
extern IDirect3DRMMiniwinDevice* GetD3DRMMiniwinDevice();
|
||||
|
||||
void MoveVirtualCursorViaJoystick();
|
||||
|
||||
#endif // ISLEAPP_H
|
||||
|
||||
Loading…
Reference in New Issue
Block a user