diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libui_sdl/main.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 7d7b090..0999555 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -48,6 +48,7 @@ // '9': load/save arbitrary file const int kSavestateNum[9] = {1, 2, 3, 4, 5, 6, 7, 8, 0}; +const int kScreenSize[4] = {1, 2, 3, 4}; const int kScreenRot[4] = {0, 1, 2, 3}; const int kScreenGap[6] = {0, 1, 8, 64, 90, 128}; const int kScreenLayout[3] = {0, 1, 2}; @@ -1500,6 +1501,37 @@ void EnsureProperMinSize() } } +void OnSetScreenSize(uiMenuItem* item, uiWindow* window, void* param) +{ + int factor = *(int*)param; + bool isHori = (ScreenRotation == 1 || ScreenRotation == 3); + + int w = 256*factor; + int h = 192*factor; + + if (ScreenLayout == 0) // natural + { + if (isHori) + uiWindowSetContentSize(window, (h*2)+ScreenGap, w); + else + uiWindowSetContentSize(window, w, (h*2)+ScreenGap); + } + else if (ScreenLayout == 1) // vertical + { + if (isHori) + uiWindowSetContentSize(window, h, (w*2)+ScreenGap); + else + uiWindowSetContentSize(window, w, (h*2)+ScreenGap); + } + else // horizontal + { + if (isHori) + uiWindowSetContentSize(window, (h*2)+ScreenGap, w); + else + uiWindowSetContentSize(window, (w*2)+ScreenGap, h); + } +} + void OnSetScreenRotation(uiMenuItem* item, uiWindow* window, void* param) { int rot = *(int*)param; @@ -1773,6 +1805,19 @@ int main(int argc, char** argv) } uiMenuAppendSeparator(menu); { + uiMenu* submenu = uiNewMenu("Screen size"); + + for (int i = 0; i < 4; i++) + { + char name[32]; + sprintf(name, "%dx", kScreenSize[i]); + uiMenuItem* item = uiMenuAppendItem(submenu, name); + uiMenuItemOnClicked(item, OnSetScreenSize, (void*)&kScreenSize[i]); + } + + uiMenuAppendSubmenu(menu, submenu); + } + { uiMenu* submenu = uiNewMenu("Screen rotation"); for (int i = 0; i < 4; i++) |