mirror of
https://github.com/david-schmidt/gsport.git
synced 2025-01-04 19:29:29 +00:00
Clamp mouse position
This commit is contained in:
parent
2bcae886f4
commit
61df2a666c
@ -448,9 +448,21 @@ void check_input_events(void)
|
||||
if (ev.type == EV_REL)
|
||||
{
|
||||
if (ev.code == REL_X)
|
||||
{
|
||||
g_mouse_raw_x += ev.value;
|
||||
if (g_mouse_raw_x < 0)
|
||||
g_mouse_raw_x = 0;
|
||||
if (g_mouse_raw_x > 639)
|
||||
g_mouse_raw_x = 639;
|
||||
}
|
||||
else // REL_Y
|
||||
{
|
||||
g_mouse_raw_y += ev.value;
|
||||
if (g_mouse_raw_y < 0)
|
||||
g_mouse_raw_y = 0;
|
||||
if (g_mouse_raw_y > 399)
|
||||
g_mouse_raw_y = 399;
|
||||
}
|
||||
g_inputstate |= UPDATE_INPUT_MOUSE;
|
||||
}
|
||||
else if (ev.type == EV_KEY)
|
||||
@ -496,4 +508,5 @@ int main(int argc,char *argv[])
|
||||
exit(-1);
|
||||
gsportmain(argc, argv);
|
||||
xdriver_end();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user