GUI: Use a truetype font for the debug console
This commit is contained in:
parent
2a38562d4b
commit
a5d93d933a
15 changed files with 57 additions and 18 deletions
Binary file not shown.
|
@ -37,7 +37,7 @@
|
|||
#include "graphics/pixelformat.h"
|
||||
|
||||
|
||||
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.26"
|
||||
#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.27"
|
||||
|
||||
class OSystem;
|
||||
|
||||
|
@ -131,6 +131,7 @@ enum TextData {
|
|||
kTextDataButton,
|
||||
kTextDataNormalFont,
|
||||
kTextDataTooltip,
|
||||
kTextDataConsole,
|
||||
kTextDataMAX
|
||||
};
|
||||
|
||||
|
@ -220,6 +221,7 @@ public:
|
|||
kFontStyleFixedBold = 4, ///< Fixed size bold font.
|
||||
kFontStyleFixedItalic = 5, ///< Fixed size italic font.
|
||||
kFontStyleTooltip = 6, ///< Tiny console font
|
||||
kFontStyleConsole = 7, ///< Debug console font
|
||||
kFontStyleMax
|
||||
};
|
||||
|
||||
|
@ -361,6 +363,8 @@ public:
|
|||
return kTextDataNormalFont;
|
||||
if (font == kFontStyleTooltip)
|
||||
return kTextDataTooltip;
|
||||
if (font == kFontStyleConsole)
|
||||
return kTextDataConsole;
|
||||
return kTextDataDefault;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,8 @@ static const TextDataInfo kTextDataDefaults[] = {
|
|||
{ kTextDataDefault, "text_default" },
|
||||
{ kTextDataButton, "text_button" },
|
||||
{ kTextDataNormalFont, "text_normal" },
|
||||
{ kTextDataTooltip, "tooltip_normal" }
|
||||
{ kTextDataTooltip, "tooltip_normal" },
|
||||
{ kTextDataConsole, "console" }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -167,7 +167,7 @@ protected:
|
|||
|
||||
int pos2line(int pos) { return (pos - (_scrollLine - _linesPerPage + 1) * kCharsPerLine) / kCharsPerLine; }
|
||||
|
||||
void drawLine(int line, bool restoreBg = true);
|
||||
void drawLine(int line);
|
||||
void drawCaret(bool erase);
|
||||
void printCharIntern(int c);
|
||||
void insertIntoPrompt(const char *str);
|
||||
|
|
|
@ -43,6 +43,9 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
|
|||
"<font id='tooltip_normal' "
|
||||
"file='fixed5x8.bdf' "
|
||||
"/>"
|
||||
"<font id='console' "
|
||||
"file='builtinConsole' "
|
||||
"/>"
|
||||
"<text_color id='color_normal' "
|
||||
"color='green' "
|
||||
"/>"
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
[SCUMMVM_STX0.8.26:ScummVM Classic Theme:No Author]
|
||||
[SCUMMVM_STX0.8.27:ScummVM Classic Theme:No Author]
|
||||
|
|
|
@ -64,6 +64,9 @@
|
|||
<font id = 'tooltip_normal'
|
||||
file = 'fixed5x8.bdf'
|
||||
/>
|
||||
<font id = 'console'
|
||||
file = 'builtinConsole'
|
||||
/>
|
||||
|
||||
<text_color id = 'color_normal'
|
||||
color = 'green'
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
[SCUMMVM_STX0.8.26:ScummVM Modern Theme:No Author]
|
||||
[SCUMMVM_STX0.8.27:ScummVM Modern Theme:No Author]
|
||||
|
|
|
@ -161,6 +161,23 @@
|
|||
scalable_file = 'FreeMonoBold.ttf'
|
||||
point_size = '8'
|
||||
/>
|
||||
<font id = 'console'
|
||||
file = 'builtinConsole'
|
||||
scalable_file = 'SourceCodeVariable-Roman.ttf'
|
||||
point_size = '12'
|
||||
/>
|
||||
<font resolution = 'y<800'
|
||||
id = 'console'
|
||||
file = 'builtinConsole'
|
||||
scalable_file = 'SourceCodeVariable-Roman.ttf'
|
||||
point_size = '10'
|
||||
/>
|
||||
<font resolution = 'y<400'
|
||||
id = 'console'
|
||||
file = 'builtinConsole'
|
||||
scalable_file = 'SourceCodeVariable-Roman.ttf'
|
||||
point_size = '8'
|
||||
/>
|
||||
|
||||
<text_color id = 'color_normal'
|
||||
color = 'black'
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
[SCUMMVM_STX0.8.26:ScummVM Modern Theme Remastered:No Author]
|
||||
[SCUMMVM_STX0.8.27:ScummVM Modern Theme Remastered:No Author]
|
||||
|
|
|
@ -162,6 +162,23 @@
|
|||
scalable_file = 'FreeSans.ttf'
|
||||
point_size = '11'
|
||||
/>
|
||||
<font id = 'console'
|
||||
file = 'builtinConsole'
|
||||
scalable_file = 'SourceCodeVariable-Roman.ttf'
|
||||
point_size = '12'
|
||||
/>
|
||||
<font resolution = 'y<800'
|
||||
id = 'console'
|
||||
file = 'builtinConsole'
|
||||
scalable_file = 'SourceCodeVariable-Roman.ttf'
|
||||
point_size = '10'
|
||||
/>
|
||||
<font resolution = 'y<400'
|
||||
id = 'console'
|
||||
file = 'builtinConsole'
|
||||
scalable_file = 'SourceCodeVariable-Roman.ttf'
|
||||
point_size = '8'
|
||||
/>
|
||||
|
||||
<text_color id = 'color_normal'
|
||||
color = 'black'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue