#define TOUCH_BUTTON_INITIALIZER(name, x, y, w, h) \
{SNES_##name##_MASK, 0, 0, 0, 0, x, y, w, h}
-TouchButton touchbuttons[] = {
+static TouchButton touchbuttons[] = {
TOUCH_BUTTON_INITIALIZER(TL, 0, 0, 0.375, 0.0833),
TOUCH_BUTTON_INITIALIZER(TR, 0.625, 0, 0.375, 0.0833),
- TOUCH_BUTTON_INITIALIZER(UP, 0.125, 0, 0.125, 0.2777), //2
- TOUCH_BUTTON_INITIALIZER(LEFT, 0.0, 0.2777, 0.125, 0.2777), //3
- TOUCH_BUTTON_INITIALIZER(RIGHT, 0.25, 0.2777, 0.125, 0.2777), //4
- TOUCH_BUTTON_INITIALIZER(DOWN, 0.125, 0.5555, 0.125, 0.2777), //5
+ TOUCH_BUTTON_INITIALIZER(UP, 0.125, 0.0833, 0.125, 0.2777), //2
+ TOUCH_BUTTON_INITIALIZER(LEFT, 0.0, 0.3611, 0.125, 0.2777), //3
+ TOUCH_BUTTON_INITIALIZER(RIGHT, 0.25, 0.3611, 0.125, 0.2777), //4
+ TOUCH_BUTTON_INITIALIZER(DOWN, 0.125, 0.6388, 0.125, 0.2777), //5
TOUCH_BUTTON_INITIALIZER(START, 0, 0.9166, 0.375, 0.0833),
- TOUCH_BUTTON_INITIALIZER(Y, 0.75, 0, 0.125, 0.2777),
- TOUCH_BUTTON_INITIALIZER(X, 0.625, 0.2777, 0.125, 0.2777),
- TOUCH_BUTTON_INITIALIZER(A, 0.875, 0.2777, 0.125, 0.2777),
- TOUCH_BUTTON_INITIALIZER(B, 0.75, 0.5555, 0.125, 0.2777),
+ TOUCH_BUTTON_INITIALIZER(Y, 0.75, 0.0833, 0.125, 0.2777),
+ TOUCH_BUTTON_INITIALIZER(X, 0.625, 0.3611, 0.125, 0.2777),
+ TOUCH_BUTTON_INITIALIZER(A, 0.875, 0.3611, 0.125, 0.2777),
+ TOUCH_BUTTON_INITIALIZER(B, 0.75, 0.6388, 0.125, 0.2777),
TOUCH_BUTTON_INITIALIZER(SELECT, 0.625, 0.9166, 0.375, 0.0833),
};
}
}
} else if (mouse.enabled) {
- // TODO Review this
mouse.x = x;
mouse.y = y;
+
+ if (mouse.x < GUI.RenderX) mouse.x = 0;
+ else {
+ mouse.x -= GUI.RenderX;
+ if (mouse.x > GUI.RenderW) mouse.x = GUI.RenderW;
+ }
+
+ if (mouse.y < GUI.RenderY) mouse.y = 0;
+ else {
+ mouse.y -= GUI.RenderY;
+ if (mouse.y > GUI.RenderH) mouse.y = GUI.RenderH;
+ }
+
+#ifdef MAEMO
+ // Remember RenderH, RenderW is 2x if using Xsp.
if (Config.xsp) {
mouse.x /= 2;
mouse.y /= 2;
}
+#endif
+
if (pressed > 0)
mouse.pressed = true;
else if (pressed < 0)
void S9xInputScreenChanged()
{
- unsigned int i = 0, w = 0, h = 0;
- S9xVideoGetWindowSize(&w, &h);
+ unsigned int i = 0;
+ const unsigned int w = GUI.Width, h = GUI.Height;
for (i = 0; i < sizeof(touchbuttons)/sizeof(TouchButton); i++) {
touchbuttons[i].x = (unsigned)round(touchbuttons[i].fx * w);
touchbuttons[i].y = (unsigned)round(touchbuttons[i].fy * h);