aboutsummaryrefslogtreecommitdiff
path: root/gui/console.cpp
diff options
context:
space:
mode:
authorMax Horn2004-08-15 14:39:35 +0000
committerMax Horn2004-08-15 14:39:35 +0000
commitcb052da949eb752f7860b0cc11a1b920fff2ed08 (patch)
tree6046c488a9652ec2beb4c254eb3841dd14b23f52 /gui/console.cpp
parentc4884a1525640f03b57c32e1ea24938fd557e854 (diff)
downloadscummvm-rg350-cb052da949eb752f7860b0cc11a1b920fff2ed08.tar.gz
scummvm-rg350-cb052da949eb752f7860b0cc11a1b920fff2ed08.tar.bz2
scummvm-rg350-cb052da949eb752f7860b0cc11a1b920fff2ed08.zip
Use custom font for the console -> more information visible, helps when using e.g. the 'actors' command
svn-id: r14627
Diffstat (limited to 'gui/console.cpp')
-rw-r--r--gui/console.cpp40
1 files changed, 22 insertions, 18 deletions
diff --git a/gui/console.cpp b/gui/console.cpp
index 673d3dc83b..325b00691d 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -27,10 +27,14 @@
#include "graphics/font.h"
-#define kCharWidth g_gui.getFont().getMaxCharWidth()
+namespace GUI {
+
+extern const Graphics::NewFont g_consolefont;
+
+#define kConsoleCharWidth (g_consolefont.getMaxCharWidth())
+#define kConsoleLineHeight (g_consolefont.getFontHeight() + 2)
-namespace GUI {
#define PROMPT ") "
@@ -83,14 +87,14 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent)
void ConsoleDialog::reflowLayout() {
// Calculate the real width/height (rounded to char/line multiples)
_w = (uint16)(_widthPercent * g_system->getOverlayWidth());
-// _w = (_widthPercent * g_system->getOverlayWidth() - kScrollBarWidth - 2) / kCharWidth;
-// _w = _w * kCharWidth + kScrollBarWidth + 2;
- _h = (uint16)((_heightPercent * g_system->getOverlayHeight() - 2) / kLineHeight);
- _h = _h * kLineHeight + 2;
+// _w = (_widthPercent * g_system->getOverlayWidth() - kScrollBarWidth - 2) / kConsoleCharWidth;
+// _w = _w * kConsoleCharWidth + kScrollBarWidth + 2;
+ _h = (uint16)((_heightPercent * g_system->getOverlayHeight() - 2) / kConsoleLineHeight);
+ _h = _h * kConsoleLineHeight + 2;
// Calculate depending values
- _lineWidth = (_w - kScrollBarWidth - 2) / kCharWidth;
- _linesPerPage = (_h - 2) / kLineHeight;
+ _lineWidth = (_w - kScrollBarWidth - 2) / kConsoleCharWidth;
+ _linesPerPage = (_h - 2) / kConsoleLineHeight;
}
void ConsoleDialog::open() {
@@ -121,10 +125,10 @@ void ConsoleDialog::drawDialog() {
#else
byte c = buffer((start + line) * _lineWidth + column);
#endif
- g_gui.drawChar(c, x, y, g_gui._textcolor);
- x += kCharWidth;
+ g_gui.drawChar(c, x, y, g_gui._textcolor, &g_consolefont);
+ x += kConsoleCharWidth;
}
- y += kLineHeight;
+ y += kConsoleLineHeight;
}
// Draw the scrollbar
@@ -534,18 +538,18 @@ void ConsoleDialog::drawCaret(bool erase) {
return;
}
- int x = _x + 1 + (_currentPos % _lineWidth) * kCharWidth;
- int y = _y + displayLine * kLineHeight;
+ int x = _x + 1 + (_currentPos % _lineWidth) * kConsoleCharWidth;
+ int y = _y + displayLine * kConsoleLineHeight;
char c = buffer(_currentPos);
if (erase) {
- g_gui.fillRect(x, y, kCharWidth, kLineHeight, g_gui._bgcolor);
- g_gui.drawChar(c, x, y + 2, g_gui._textcolor);
+ g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._bgcolor);
+ g_gui.drawChar(c, x, y + 2, g_gui._textcolor, &g_consolefont);
} else {
- g_gui.fillRect(x, y, kCharWidth, kLineHeight, g_gui._textcolor);
- g_gui.drawChar(c, x, y + 2, g_gui._bgcolor);
+ g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._textcolor);
+ g_gui.drawChar(c, x, y + 2, g_gui._bgcolor, &g_consolefont);
}
- g_gui.addDirtyRect(x, y, kCharWidth, kLineHeight);
+ g_gui.addDirtyRect(x, y, kConsoleCharWidth, kConsoleLineHeight);
_caretVisible = !erase;
}