aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl/main.cpp
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-11-08 01:53:20 +0100
committerStapleButter <thetotalworm@gmail.com>2017-11-08 01:53:20 +0100
commite6e5f487487f53b6db54e7687ea2e3431031f1bd (patch)
treeec43c91afba2b159ee822eb015d1f420d0fba21a /src/libui_sdl/main.cpp
parent857ba49759c7a4bacc59a81de9f6596671f397d1 (diff)
attempt at horizontal mode, I guess
Diffstat (limited to 'src/libui_sdl/main.cpp')
-rw-r--r--src/libui_sdl/main.cpp57
1 files changed, 56 insertions, 1 deletions
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index 5c2eb84..5023dac 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -395,10 +395,65 @@ void SetupScreenRects(int width, int height)
// (also TODO: swap top/bottom screen if needed)
int screenW = 256;
int screenH = 192;
-//horizontal = true; // TEST
+horizontal = true; // TEST
if (horizontal)
{
// side-by-side
+
+ int heightreq;
+ int startX = 0;
+
+ width -= ScreenGap;
+
+ if (sizemode == 0) // even
+ {
+ heightreq = (width * screenH) / (screenW*2);
+ if (heightreq > height)
+ {
+ int newwidth = (height * width) / heightreq;
+ startX = (width - newwidth) / 2;
+ heightreq = height;
+ width = newwidth;
+ }
+ }
+ else // emph. top/bottom
+ {
+ heightreq = ((width - screenW) * screenH) / screenW;
+ if (heightreq > height)
+ {
+ int newwidth = ((height * (width - screenW)) / heightreq) + screenW;
+ startX = (width - newwidth) / 2;
+ heightreq = height;
+ width = newwidth;
+ }
+ }
+
+ if (sizemode == 2)
+ {
+ TopScreenRect.Width = screenW;
+ TopScreenRect.Height = screenH;
+ }
+ else
+ {
+ TopScreenRect.Width = (sizemode==0) ? (width / 2) : (width - screenW);
+ TopScreenRect.Height = heightreq;
+ }
+ TopScreenRect.X = startX;
+ TopScreenRect.Y = (height - TopScreenRect.Height) / 2;
+
+ BottomScreenRect.X = TopScreenRect.X + TopScreenRect.Width + ScreenGap;
+
+ if (sizemode == 1)
+ {
+ BottomScreenRect.Width = screenW;
+ BottomScreenRect.Height = screenH;
+ }
+ else
+ {
+ BottomScreenRect.Width = width - TopScreenRect.Width;
+ BottomScreenRect.Height = heightreq;
+ }
+ BottomScreenRect.Y = (height - BottomScreenRect.Height) / 2;
}
else
{