1
0

Fix touch position

This commit is contained in:
otya128
2016-12-07 21:55:37 +09:00
parent 6a3f15b96b
commit f4da3314d1

View File

@@ -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);
} }