From 92d2de532555cc1a5f076e6847262dd7c42db96c Mon Sep 17 00:00:00 2001 From: tomangelo2 Date: Wed, 2 Jan 2019 00:34:34 +0100 Subject: [PATCH 1/2] Fixed VSync options list Now VSync list is aligned for same height as resolution list from the bottom, as it's very hard to align them from top on different screen resolutions. --- src/ui/screen/screen_setup_display.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/screen/screen_setup_display.cpp b/src/ui/screen/screen_setup_display.cpp index 15f2511f..d015a58c 100644 --- a/src/ui/screen/screen_setup_display.cpp +++ b/src/ui/screen/screen_setup_display.cpp @@ -102,7 +102,7 @@ void CScreenSetupDisplay::CreateInterface() pc->SetState(STATE_CHECK, m_setupFull); pos.x = ox+sx*10; - pos.y = oy+sy*9; + pos.y = oy+sy*6.75f; ddim.x = dim.x*6; ddim.y = dim.y*1; GetResource(RES_EVENT, EVENT_INTERFACE_VSYNC, name); @@ -110,9 +110,9 @@ void CScreenSetupDisplay::CreateInterface() pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT); pos.x = ox+sx*10; - pos.y = oy+sy*7.97f; + pos.y = oy+sy*5.2f; ddim.x = dim.x*6; - ddim.y = dim.y*1.8f; + ddim.y = dim.y*2; pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_VSYNC); pli->SetState(STATE_SHADOW); pli->SetItemName(0, "Off"); From be97167994838763457967d22f441efd7ff6f568 Mon Sep 17 00:00:00 2001 From: tomangelo2 Date: Wed, 2 Jan 2019 01:18:45 +0100 Subject: [PATCH 2/2] Potential fix for issue #1128 --- src/graphics/engine/text.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/graphics/engine/text.cpp b/src/graphics/engine/text.cpp index a16439f4..df284160 100644 --- a/src/graphics/engine/text.cpp +++ b/src/graphics/engine/text.cpp @@ -33,6 +33,7 @@ #include "math/func.h" +#include #include #include @@ -1252,13 +1253,13 @@ FontTexture CText::CreateFontTexture(Math::IntPoint tileSize) Math::IntPoint CText::GetNextTilePos(const FontTexture& fontTexture) { - int horizontalTiles = FONT_TEXTURE_SIZE.x / fontTexture.tileSize.x; - int verticalTiles = FONT_TEXTURE_SIZE.y / fontTexture.tileSize.y; + int horizontalTiles = FONT_TEXTURE_SIZE.x / std::max(1, fontTexture.tileSize.x); //this should prevent crashes in some combinations of resolution and font size, see issue #1128 + int verticalTiles = FONT_TEXTURE_SIZE.y / std::max(1, fontTexture.tileSize.y); int totalTiles = horizontalTiles * verticalTiles; int tileNumber = totalTiles - fontTexture.freeSlots; - int verticalTileIndex = tileNumber / horizontalTiles; + int verticalTileIndex = tileNumber / std::max(1, horizontalTiles); int horizontalTileIndex = tileNumber % horizontalTiles; return Math::IntPoint(horizontalTileIndex * fontTexture.tileSize.x,