Optimized SDL_RenderDrawCircle.

Change mouse warping strategy in hidden test cheat.
This commit is contained in:
Muzychenko Andrey committed 2022-05-27 13:54:36 +03:00
1 parent 4183e7f0bf
commit cfe2691892
3 files changed
+42 -18

No files matched your search

+15 -4
View File
@@ -211,11 +211,22 @@ int winmain::WinMain(LPCSTR lpCmdLine)
float dy = static_cast<float>(y - last_mouse_y) / static_cast<float>(h);
pb::ballset(dx, dy);
SDL_WarpMouseInWindow(window, last_mouse_x, last_mouse_y);
// Original creates continuous mouse movement with mouse capture.
// Alternative solution: mouse warp at window edges.
int xMod = 0, yMod = 0;
if (x == 0 || x >= w - 1)
xMod = w - 2;
if (y == 0 || y >= h - 1)
yMod = h - 2;
if (xMod != 0 || yMod != 0)
{
// Mouse warp does not work over remote desktop or in some VMs
x = abs(x - xMod); y = abs(y - yMod);
SDL_WarpMouseInWindow(window, x, y);
}
// Mouse warp does not work over remote desktop or in some VMs
//last_mouse_x = x;
//last_mouse_y = y;
last_mouse_x = x;
last_mouse_y = y;
}
if (!single_step && !no_time_loss)
{