1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-30 02:05:13 +01:00

Fix game console overflowing when using TTF for rendering.

This commit is contained in:
Aaron van Geffen
2017-10-18 08:30:21 +02:00
committed by Michael Steenbeek
parent 35644a66e0
commit a0fb2a6d7c
2 changed files with 13 additions and 5 deletions

View File

@@ -157,6 +157,11 @@ static void ttf_surface_cache_dispose_all()
void ttf_toggle_hinting()
{
if (!gUseTrueTypeFont)
{
return;
}
for (sint32 i = 0; i < FONT_SIZE_COUNT; i++)
{
TTFFontDescriptor *fontDesc = &(gCurrentTTFFontSet->size[i]);

View File

@@ -230,8 +230,9 @@ void console_draw(rct_drawpixelinfo *dpi)
break;
}
}
x = _consoleLeft + 4;
y = _consoleBottom - 15;
y = _consoleBottom - lineHeight - 5;
// Draw current line
lineCh = lineBuffer;
@@ -248,9 +249,12 @@ void console_draw(rct_drawpixelinfo *dpi)
gfx_fill_rect(dpi, caretX, caretY, caretX + 6, caretY + 1, PALETTE_INDEX_144);
}
gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 21, _consoleRight, _consoleBottom - 21, PALETTE_INDEX_14);
gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 20, _consoleRight, _consoleBottom - 20, PALETTE_INDEX_11);
// Input area top border
gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - lineHeight - 11, _consoleRight, _consoleBottom - lineHeight - 11, PALETTE_INDEX_14);
gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - lineHeight - 10, _consoleRight, _consoleBottom - lineHeight - 10, PALETTE_INDEX_11);
// Input area bottom border
gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 1, _consoleRight, _consoleBottom - 1, PALETTE_INDEX_14);
gfx_fill_rect(dpi, _consoleLeft, _consoleBottom - 0, _consoleRight, _consoleBottom - 0, PALETTE_INDEX_12);
}
@@ -399,8 +403,7 @@ void console_scroll(sint32 linesToScroll)
// Calculates the amount of visible lines, based on the console size, excluding the input line.
static sint32 console_get_num_visible_lines()
{
const sint32 lineHeight = 10;
return ((_consoleBottom - 22 - _consoleTop) / lineHeight) - 1;
return ceil((_consoleBottom - _consoleTop) / font_get_line_height(gCurrentFontSpriteBase)) - 1;
}
void console_clear()