mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-26 08:45:34 +00:00
Implement Windows GetAbsoluteMouseState().
This commit is contained in:
parent
c8c55a01f4
commit
4676705de0
|
@ -260,6 +260,24 @@ WIN_CaptureMouse(SDL_Window *window)
|
||||||
return ToggleRawInput(window != NULL);
|
return ToggleRawInput(window != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Uint32
|
||||||
|
WIN_GetAbsoluteMouseState(int *x, int *y)
|
||||||
|
{
|
||||||
|
Uint32 retval = 0;
|
||||||
|
POINT pt = { 0, 0 };
|
||||||
|
GetCursorPos(&pt);
|
||||||
|
*x = (int) pt.x;
|
||||||
|
*y = (int) pt.y;
|
||||||
|
|
||||||
|
retval |= GetAsyncKeyState(VK_LBUTTON) & 0x8000 ? SDL_BUTTON_LMASK : 0;
|
||||||
|
retval |= GetAsyncKeyState(VK_RBUTTON) & 0x8000 ? SDL_BUTTON_RMASK : 0;
|
||||||
|
retval |= GetAsyncKeyState(VK_MBUTTON) & 0x8000 ? SDL_BUTTON_MMASK : 0;
|
||||||
|
retval |= GetAsyncKeyState(VK_X1BUTTON) & 0x8000 ? SDL_BUTTON_X1MASK : 0;
|
||||||
|
retval |= GetAsyncKeyState(VK_X2BUTTON) & 0x8000 ? SDL_BUTTON_X2MASK : 0;
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WIN_InitMouse(_THIS)
|
WIN_InitMouse(_THIS)
|
||||||
{
|
{
|
||||||
|
@ -272,6 +290,7 @@ WIN_InitMouse(_THIS)
|
||||||
mouse->WarpMouse = WIN_WarpMouse;
|
mouse->WarpMouse = WIN_WarpMouse;
|
||||||
mouse->SetRelativeMouseMode = WIN_SetRelativeMouseMode;
|
mouse->SetRelativeMouseMode = WIN_SetRelativeMouseMode;
|
||||||
mouse->CaptureMouse = WIN_CaptureMouse;
|
mouse->CaptureMouse = WIN_CaptureMouse;
|
||||||
|
mouse->GetAbsoluteMouseState = WIN_GetAbsoluteMouseState;
|
||||||
|
|
||||||
SDL_SetDefaultCursor(WIN_CreateDefaultCursor());
|
SDL_SetDefaultCursor(WIN_CreateDefaultCursor());
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue