Fix touch position
This commit is contained in:
@@ -705,6 +705,14 @@ class PetitComputer
|
|||||||
int mousex, mousey;
|
int mousex, mousey;
|
||||||
if (SDL_GetMouseState(&mousex, &mousey) & SDL_BUTTON_LMASK)
|
if (SDL_GetMouseState(&mousex, &mousey) & SDL_BUTTON_LMASK)
|
||||||
{
|
{
|
||||||
|
if (mousey >= screenHeight)
|
||||||
|
{
|
||||||
|
mousey -= screenHeight;
|
||||||
|
mousex -= (screenWidth - screenWidthDisplay1) / 2;
|
||||||
|
}
|
||||||
|
import std.algorithm.comparison : clamp;
|
||||||
|
mousex = mousex.clamp(5, 314);
|
||||||
|
mousey = mousey.clamp(5, 234);
|
||||||
auto old = touchPosition;
|
auto old = touchPosition;
|
||||||
touchPosition = Touch(old.tm + 1, mousex, mousey);
|
touchPosition = Touch(old.tm + 1, mousex, mousey);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user