Fix dialog box position

See #3
This commit is contained in:
Alexander Batalov 2022-05-21 11:23:43 +03:00
parent 78e8adbecb
commit 1431a1951b
1 changed files with 3 additions and 0 deletions

View File

@ -135,6 +135,9 @@ int showDialogBox(const char* title, const char** body, int bodyLength, int x, i
return -1; 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); int win = windowCreate(x, y, backgroundWidth, backgroundHeight, 256, WINDOW_FLAG_0x10 | WINDOW_FLAG_0x04);
if (win == -1) { if (win == -1) {
artUnlock(backgroundHandle); artUnlock(backgroundHandle);