We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e07e681 commit d7c071fCopy full SHA for d7c071f
src_c/mouse.c
@@ -76,27 +76,24 @@ mouse_get_pos(PyObject *self, PyObject *_null)
76
if (sdlRenderer != NULL) {
77
SDL_Rect vprect;
78
float scalex, scaley;
79
- int w, h;
80
81
SDL_RenderGetScale(sdlRenderer, &scalex, &scaley);
82
SDL_RenderGetViewport(sdlRenderer, &vprect);
83
84
x = (int)(x / scalex);
85
y = (int)(y / scaley);
86
87
- SDL_RenderGetLogicalSize(sdlRenderer, &w, &h);
88
-
89
x -= vprect.x;
90
y -= vprect.y;
91
92
if (x < 0)
93
x = 0;
94
- if (x >= w)
95
- x = w - 1;
+ if (x >= vprect.w)
+ x = vprect.w - 1;
96
if (y < 0)
97
y = 0;
98
- if (y >= h)
99
- y = h - 1;
+ if (y >= vprect.h)
+ y = vprect.h - 1;
100
}
101
102
0 commit comments