From 6c4927b129df7ab779b06bceacb9e8f35be5e9c7 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Sat, 21 May 2022 01:56:07 +0300 Subject: [PATCH] Fix automap position See #3 --- src/automap.c | 4 +++- src/automap.h | 2 -- src/core.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/automap.c b/src/automap.c index 24a9314..1a0e7f8 100644 --- a/src/automap.c +++ b/src/automap.c @@ -288,7 +288,9 @@ void automapShow(bool isInGame, bool isUsingScanner) int oldFont = fontGetCurrent(); fontSetCurrent(101); - int window = windowCreate(AUTOMAP_WINDOW_X, AUTOMAP_WINDOW_Y, AUTOMAP_WINDOW_WIDTH, AUTOMAP_WINDOW_HEIGHT, color, WINDOW_FLAG_0x10 | WINDOW_FLAG_0x04); + int automapWindowX = (screenGetWidth() - AUTOMAP_WINDOW_WIDTH) / 2; + int automapWindowY = (screenGetHeight() - AUTOMAP_WINDOW_HEIGHT) / 2; + int window = windowCreate(automapWindowX, automapWindowY, AUTOMAP_WINDOW_WIDTH, AUTOMAP_WINDOW_HEIGHT, color, WINDOW_FLAG_0x10 | WINDOW_FLAG_0x04); int scannerBtn = buttonCreate(window, 111, 454, 15, 16, -1, -1, -1, KEY_LOWERCASE_S, frmData[AUTOMAP_FRM_BUTTON_UP], frmData[AUTOMAP_FRM_BUTTON_DOWN], NULL, BUTTON_FLAG_TRANSPARENT); if (scannerBtn != -1) { diff --git a/src/automap.h b/src/automap.h index 9b65b99..5d669f3 100644 --- a/src/automap.h +++ b/src/automap.h @@ -16,8 +16,6 @@ #define AUTOMAP_OFFSET_COUNT (AUTOMAP_MAP_COUNT * ELEVATION_COUNT) -#define AUTOMAP_WINDOW_X (75) -#define AUTOMAP_WINDOW_Y (0) #define AUTOMAP_WINDOW_WIDTH (519) #define AUTOMAP_WINDOW_HEIGHT (480) diff --git a/src/core.c b/src/core.c index 0ca1bff..c75125c 100644 --- a/src/core.c +++ b/src/core.c @@ -4610,11 +4610,11 @@ err: int screenGetWidth() { // TODO: Make it on par with _xres; - return _scr_size.right + _scr_size.left + 1; + return rectGetWidth(&_scr_size); } int screenGetHeight() { // TODO: Make it on par with _yres. - return _scr_size.bottom + _scr_size.top + 1; + return rectGetHeight(&_scr_size); }