From 1431a1951bcb8ed7a36992baa3e9ac1c13278c51 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 21 May 2022 11:23:43 +0300 Subject: [PATCH] Fix dialog box position See #3 --- src/dbox.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dbox.c b/src/dbox.c index 1815348..2e0b2c7 100644 --- a/src/dbox.c +++ b/src/dbox.c @@ -135,6 +135,9 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i return -1; } + // Maintain original position in original resolution, otherwise center it. + if (screenGetWidth() != 640) x = (screenGetWidth() - backgroundWidth) / 2; + if (screenGetHeight() != 480) y = (screenGetHeight() - backgroundHeight) / 2; int win = windowCreate(x, y, backgroundWidth, backgroundHeight, 256, WINDOW_FLAG_0x10 | WINDOW_FLAG_0x04); if (win == -1) { artUnlock(backgroundHandle);