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,