commit
bc3fbd21d0
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "math/func.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <SDL.h>
|
||||
#include <SDL_ttf.h>
|
||||
|
||||
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue