aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-11-08 01:34:11 +0100
committerStapleButter <thetotalworm@gmail.com>2017-11-08 01:34:11 +0100
commit857ba49759c7a4bacc59a81de9f6596671f397d1 (patch)
tree50217d517f2d2647543813d84f2772d332b3e70a
parent5bea3cc530dfd1e334daeb57069e00a3ed457857 (diff)
actually implement screen gap
-rw-r--r--src/libui_sdl/main.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index 55e9526..5c2eb84 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -395,7 +395,7 @@ void SetupScreenRects(int width, int height)
// (also TODO: swap top/bottom screen if needed)
int screenW = 256;
int screenH = 192;
-
+//horizontal = true; // TEST
if (horizontal)
{
// side-by-side
@@ -407,6 +407,8 @@ void SetupScreenRects(int width, int height)
int widthreq;
int startY = 0;
+ height -= ScreenGap;
+
if (sizemode == 0) // even
{
widthreq = (height * screenW) / (screenH*2);
@@ -443,8 +445,7 @@ void SetupScreenRects(int width, int height)
TopScreenRect.Y = startY;
TopScreenRect.X = (width - TopScreenRect.Width) / 2;
- // TODO: gap
- BottomScreenRect.Y = TopScreenRect.Y + TopScreenRect.Height;
+ BottomScreenRect.Y = TopScreenRect.Y + TopScreenRect.Height + ScreenGap;
if (sizemode == 1)
{
@@ -643,8 +644,25 @@ void OnOpenInputConfig(uiMenuItem* item, uiWindow* window, void* blarg)
void OnSetScreenGap(uiMenuItem* item, uiWindow* window, void* param)
{
int gap = *(int*)param;
+
+ int oldgap = ScreenGap;
ScreenGap = gap;
- // TODO: check menu items!!!!!
+
+ // resize window as needed
+ // TODO: adapt to horizontal modes
+ // TODO: always resize window? except if it's maximized
+ int w, h;
+ uiWindowContentSize(window, &w, &h);
+ {
+ h -= gap;
+ if (h < 384)
+ {
+ h = 384 + gap;
+ uiWindowSetContentSize(window, w, h);
+ }
+ }
+
+ SetupScreenRects(Config::WindowWidth, Config::WindowHeight);
}
void OnSetScreenLayout(uiMenuItem* item, uiWindow* window, void* param)