1
0

Fix TOUCH

This commit is contained in:
otya128
2016-12-11 20:44:07 +09:00
parent 77d7c4366e
commit 6b5bf35584
2 changed files with 18 additions and 10 deletions

View File

@@ -340,8 +340,16 @@ class BuiltinFunction
{
auto pos = p.touchPosition;
tm = pos.tm;
tchx = pos.x;
tchy = pos.y;
if (p.x.mode == PetitComputer.XMode.WIIU)
{
tchx = pos.display1X;
tchy = pos.display1Y;
}
else
{
tchx = pos.x;
tchy = pos.y;
}
}
static void TOUCH(PetitComputer p, int id, out int tm, out int tchx, out int tchy)
{

View File

@@ -754,14 +754,14 @@ class PetitComputer
{
auto w = currentDisplay.rect[0].w;
auto h = currentDisplay.rect[0].h;
auto x3DS = cast(int)(mousex * (cast(float)w / screenWidthDisplay1));
auto y3DS = cast(int)(mousey * (cast(float)h / screenHeightDisplay1));
auto gamepadx = cast(int)(mousex * (cast(float)w / 854));
auto gamepady = cast(int)(mousey * (cast(float)h / 480));
auto x3DS = cast(int)(mousex * (screenWidthDisplay1 / cast(float)w));
auto y3DS = cast(int)(mousey * (screenHeightDisplay1 / cast(float)h));
auto gamepadx = cast(int)(mousex * (854 / cast(float)w));
auto gamepady = cast(int)(mousey * (480 / cast(float)h));
touchPosition = Touch(old.tm + 1,
x3DS.clamp(5, 314), y3DS.clamp(5, 234),
gamepadx.clamp(8, 854 - 8), gamepady.clamp(8, 480 - 8),
mousex, mousey);
gamepadx.clamp(8, 854 - 9), gamepady.clamp(8, 480 - 9),
mousex.clamp(8, w - 9), mousey.clamp(8, h - 9));
}
else
{
@@ -777,8 +777,8 @@ class PetitComputer
auto gamepady = cast(int)(mousey * (480 / cast(float)h));
touchPosition = Touch(old.tm + 1,
x3DS.clamp(5, 314), y3DS.clamp(5, 234),
gamepadx.clamp(8, 854 - 8), gamepady.clamp(8, 480 - 8),
mousex, mousey);
gamepadx.clamp(8, 854 - 9), gamepady.clamp(8, 480 - 9),
mousex.clamp(8, w - 9), mousey.clamp(8, h - 9));
}
}
}