aboutsummaryrefslogtreecommitdiff
path: root/gui/console.cpp
diff options
context:
space:
mode:
authorBastien Bouclet2019-04-27 08:00:37 +0200
committerBastien Bouclet2019-05-05 08:52:12 +0200
commita5d93d933ab65d5a7efcc88926ce116618f06fcd (patch)
tree81be4d4692ae5c2a266089196a2884107d8d1b06 /gui/console.cpp
parent2a38562d4bc968bb9d32a9bbe5e57f9d37f88a60 (diff)
downloadscummvm-rg350-a5d93d933ab65d5a7efcc88926ce116618f06fcd.tar.gz
scummvm-rg350-a5d93d933ab65d5a7efcc88926ce116618f06fcd.tar.bz2
scummvm-rg350-a5d93d933ab65d5a7efcc88926ce116618f06fcd.zip
GUI: Use a truetype font for the debug console
Diffstat (limited to 'gui/console.cpp')
-rw-r--r--gui/console.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/gui/console.cpp b/gui/console.cpp
index 5e9def8740..79df413534 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -33,8 +33,8 @@
namespace GUI {
-#define kConsoleCharWidth (_font->getMaxCharWidth())
-#define kConsoleLineHeight (_font->getFontHeight() + 2)
+#define kConsoleCharWidth (_font->getCharWidth('M'))
+#define kConsoleLineHeight (_font->getFontHeight())
enum {
kConsoleSlideDownDuration = 200 // Time in milliseconds
@@ -93,8 +93,7 @@ void ConsoleDialog::init() {
const int screenW = g_system->getOverlayWidth();
const int screenH = g_system->getOverlayHeight();
- _font = FontMan.getFontByUsage((Graphics::FontManager::FontUsage)
- g_gui.xmlEval()->getVar("Console.Font", Graphics::FontManager::kConsoleFont));
+ _font = &g_gui.getFont(ThemeEngine::kFontStyleConsole);
_leftPadding = g_gui.xmlEval()->getVar("Globals.Console.Padding.Left", 0);
_rightPadding = g_gui.xmlEval()->getVar("Globals.Console.Padding.Right", 0);
@@ -167,10 +166,10 @@ void ConsoleDialog::drawDialog(DrawLayer layerToDraw) {
Dialog::drawDialog(layerToDraw);
for (int line = 0; line < _linesPerPage; line++)
- drawLine(line, false);
+ drawLine(line);
}
-void ConsoleDialog::drawLine(int line, bool restoreBg) {
+void ConsoleDialog::drawLine(int line) {
int x = _x + 1 + _leftPadding;
int start = _scrollLine - _linesPerPage + 1;
int y = _y + 2 + _topPadding;
@@ -178,11 +177,6 @@ void ConsoleDialog::drawLine(int line, bool restoreBg) {
y += line * kConsoleLineHeight;
- if (restoreBg) {
- Common::Rect r(_x, y - 2, _x + _pageWidth * kConsoleCharWidth, y+kConsoleLineHeight);
- g_gui.theme()->restoreBackground(r);
- }
-
for (int column = 0; column < limit; column++) {
#if 0
int l = (start + line) % _linesInBuffer;
@@ -726,7 +720,7 @@ void ConsoleDialog::drawCaret(bool erase) {
}
int x = _x + 1 + _leftPadding + (_currentPos % kCharsPerLine) * kConsoleCharWidth;
- int y = _y + _topPadding + displayLine * kConsoleLineHeight;
+ int y = _y + 2 + _topPadding + displayLine * kConsoleLineHeight;
_caretVisible = !erase;
g_gui.theme()->drawCaret(Common::Rect(x, y, x + 1, y + kConsoleLineHeight), erase);