Code: Select all
void MyGLCanvas::resetMouse()
{
int screenMaxX = wxSystemSettings::GetMetric(wxSYS_SCREEN_X);
int screenMaxY = wxSystemSettings::GetMetric(wxSYS_SCREEN_Y);
wxPoint pt = wxGetMousePosition();
int x = pt.x;
int y = pt.y;
if (x >= screenMaxX)
parentFrame->WarpPointer(0 - x, y);
if(x <= 0) //doesn't work, left of screen
parentFrame->WarpPointer(screenMaxX, y);
if (y >= screenMaxY) //doesn't work, bottom of screen
parentFrame->WarpPointer(x, 0 - y);
if (y <= 0)
parentFrame->WarpPointer(x, screenMaxY);
}
-edit-
Ok i got it to work for all sides except the left. I changed the bottom of the screen to
Code: Select all
if (y >= (screenMaxY - 1))
parentFrame->WarpPointer(x, 0 - y);