case 0:
gtk_widget_show_all(GTK_WIDGET(none_label));
break;
- case 1:
+ case 1: // Keys
gtk_widget_show_all(GTK_WIDGET(keys_scroll));
break;
- case 2:
+ case 2: // Touchscreen
gtk_widget_show_all(GTK_WIDGET(ts_label));
break;
+ case 3: // Touchscreen + keys
+ gtk_widget_show_all(GTK_WIDGET(keys_scroll));
+ break;
+ case 4: // Mouse
+ gtk_widget_show_all(GTK_WIDGET(ts_label));
+ break;
+ case 5: // Mouse + keys
+ gtk_widget_show_all(GTK_WIDGET(keys_scroll));
+ break;
}
}
gtk_combo_box_append_text(combo, "No controls/Use config file");
gtk_combo_box_append_text(combo, "Use physical keys");
gtk_combo_box_append_text(combo, "Use touchscreen");
+ gtk_combo_box_append_text(combo, "Use touchscreen + physical keys");
+ gtk_combo_box_append_text(combo, "Use SNES mouse");
+ gtk_combo_box_append_text(combo, "Use SNES mouse + physical keys");
none_label = GTK_LABEL(gtk_label_new("Check documentation for details."));
-1);
}
- ts_label = GTK_LABEL(gtk_label_new("Not implemented."));
+ ts_label = GTK_LABEL(gtk_label_new("Check layout somewhere else for now."));
gtk_window_resize(GTK_WINDOW(dialog), 600, 340);
gtk_box_pack_start(GTK_BOX(dialog->vbox), GTK_WIDGET(combo),
}
}
} 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);
abort(); \
} while (0);
+struct gui GUI;
+
static SDL_Surface *screen;
static SDL_Rect windowSize, screenSize;
static void setupVideoSurface()
{
// Real surface area.
- unsigned gameWidth = IMAGE_WIDTH;
- unsigned gameHeight = IMAGE_HEIGHT;
- // SDL Window/Surface size (bigger, so we can get mouse events there).
- unsigned winWidth, winHeight;
+ const unsigned gameWidth = IMAGE_WIDTH;
+ const unsigned gameHeight = IMAGE_HEIGHT;
#ifdef MAEMO
if ((Config.fullscreen && !gotScreenSize) ||
calculateScreenSize();
}
if (Config.fullscreen) {
- winWidth = screenSize.w;
- winHeight = screenSize.h;
+ GUI.Width = screenSize.w;
+ GUI.Height = screenSize.h;
} else {
- winWidth = windowSize.w;
- winHeight = windowSize.h;
+ GUI.Width = windowSize.w;
+ GUI.Height = windowSize.h;
}
// So, can we enable Xsp?
- if (gameWidth * 2 < winWidth && gameHeight * 2 < winHeight) {
+ if (gameWidth * 2 < GUI.Width && gameHeight * 2 < GUI.Height) {
Config.xsp = true;
} else {
Config.xsp = false;
setDoubling(false); // Before switching video modes; avoids flicker.
}
#else
- winWidth = gameWidth;
- winHeight = gameHeight;
+ GUI.Width = gameWidth;
+ GUI.Height = gameHeight;
#endif
// Safeguard
- if (gameHeight > winHeight || gameWidth > winWidth)
+ if (gameHeight > GUI.Height || gameWidth > GUI.Width)
DIE("Video is larger than window size!");
- screen = SDL_SetVideoMode(winWidth, winHeight,
+ screen = SDL_SetVideoMode(GUI.Width, GUI.Height,
Settings.SixteenBit ? 16 : 8,
SDL_SWSURFACE |
(Config.fullscreen ? SDL_FULLSCREEN : 0));
#ifdef MAEMO
if (Config.xsp) {
setDoubling(true);
- centerRectangle(renderArea, winWidth, winHeight,
+ centerRectangle(renderArea, GUI.Width, GUI.Height,
gameWidth * 2, gameHeight * 2);
- renderArea.w /= 2;
- renderArea.h /= 2;
} else {
- centerRectangle(renderArea, winWidth, winHeight, gameWidth, gameHeight);
+ centerRectangle(renderArea, GUI.Width, GUI.Height,
+ gameWidth, gameHeight);
}
#else
- centerRectangle(renderArea, winWidth, winHeight, gameWidth, gameHeight);
+ centerRectangle(renderArea, GUI.Width, GUI.Height, gameWidth, gameHeight);
#endif
GFX.Screen = ((uint8*) screen->pixels)
GFX.PPL = GFX.Pitch >> 1;
GFX.PPLx2 = GFX.Pitch;
+ GUI.RenderX = renderArea.x;
+ GUI.RenderY = renderArea.y;
+ GUI.RenderW = renderArea.w;
+ GUI.RenderH = renderArea.h;
+
+#ifdef MAEMO
+ if (Config.xsp) {
+ // Do not update 2x the area.
+ renderArea.w /= 2;
+ renderArea.h /= 2;
+ }
+#endif
+
printf("Video: %dx%d (%dx%d output), %hu bits per pixel, %s %s\n",
gameWidth, gameHeight,
screen->w, screen->h, screen->format->BitsPerPixel,
}
}
-void S9xVideoGetWindowSize(unsigned int* w, unsigned int* h)
-{
- if (Config.fullscreen) {
- *w = screenSize.w;
- *h = screenSize.h;
- } else {
- *w = windowSize.w;
- *h = windowSize.h;
- }
-}
-
// This is here for completeness, but palette mode is useless on N8x0
void S9xSetPalette ()
{