Use custom font for the console -> more information visible, helps when using e.g. the 'actors' command
svn-id: r14627
This commit is contained in:
parent
c4884a1525
commit
cb052da949
3 changed files with 4808 additions and 19 deletions
|
@ -27,11 +27,15 @@
|
||||||
|
|
||||||
#include "graphics/font.h"
|
#include "graphics/font.h"
|
||||||
|
|
||||||
#define kCharWidth g_gui.getFont().getMaxCharWidth()
|
|
||||||
|
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
|
extern const Graphics::NewFont g_consolefont;
|
||||||
|
|
||||||
|
#define kConsoleCharWidth (g_consolefont.getMaxCharWidth())
|
||||||
|
#define kConsoleLineHeight (g_consolefont.getFontHeight() + 2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define PROMPT ") "
|
#define PROMPT ") "
|
||||||
|
|
||||||
/* TODO:
|
/* TODO:
|
||||||
|
@ -83,14 +87,14 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent)
|
||||||
void ConsoleDialog::reflowLayout() {
|
void ConsoleDialog::reflowLayout() {
|
||||||
// Calculate the real width/height (rounded to char/line multiples)
|
// Calculate the real width/height (rounded to char/line multiples)
|
||||||
_w = (uint16)(_widthPercent * g_system->getOverlayWidth());
|
_w = (uint16)(_widthPercent * g_system->getOverlayWidth());
|
||||||
// _w = (_widthPercent * g_system->getOverlayWidth() - kScrollBarWidth - 2) / kCharWidth;
|
// _w = (_widthPercent * g_system->getOverlayWidth() - kScrollBarWidth - 2) / kConsoleCharWidth;
|
||||||
// _w = _w * kCharWidth + kScrollBarWidth + 2;
|
// _w = _w * kConsoleCharWidth + kScrollBarWidth + 2;
|
||||||
_h = (uint16)((_heightPercent * g_system->getOverlayHeight() - 2) / kLineHeight);
|
_h = (uint16)((_heightPercent * g_system->getOverlayHeight() - 2) / kConsoleLineHeight);
|
||||||
_h = _h * kLineHeight + 2;
|
_h = _h * kConsoleLineHeight + 2;
|
||||||
|
|
||||||
// Calculate depending values
|
// Calculate depending values
|
||||||
_lineWidth = (_w - kScrollBarWidth - 2) / kCharWidth;
|
_lineWidth = (_w - kScrollBarWidth - 2) / kConsoleCharWidth;
|
||||||
_linesPerPage = (_h - 2) / kLineHeight;
|
_linesPerPage = (_h - 2) / kConsoleLineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleDialog::open() {
|
void ConsoleDialog::open() {
|
||||||
|
@ -121,10 +125,10 @@ void ConsoleDialog::drawDialog() {
|
||||||
#else
|
#else
|
||||||
byte c = buffer((start + line) * _lineWidth + column);
|
byte c = buffer((start + line) * _lineWidth + column);
|
||||||
#endif
|
#endif
|
||||||
g_gui.drawChar(c, x, y, g_gui._textcolor);
|
g_gui.drawChar(c, x, y, g_gui._textcolor, &g_consolefont);
|
||||||
x += kCharWidth;
|
x += kConsoleCharWidth;
|
||||||
}
|
}
|
||||||
y += kLineHeight;
|
y += kConsoleLineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the scrollbar
|
// Draw the scrollbar
|
||||||
|
@ -534,18 +538,18 @@ void ConsoleDialog::drawCaret(bool erase) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x = _x + 1 + (_currentPos % _lineWidth) * kCharWidth;
|
int x = _x + 1 + (_currentPos % _lineWidth) * kConsoleCharWidth;
|
||||||
int y = _y + displayLine * kLineHeight;
|
int y = _y + displayLine * kConsoleLineHeight;
|
||||||
|
|
||||||
char c = buffer(_currentPos);
|
char c = buffer(_currentPos);
|
||||||
if (erase) {
|
if (erase) {
|
||||||
g_gui.fillRect(x, y, kCharWidth, kLineHeight, g_gui._bgcolor);
|
g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._bgcolor);
|
||||||
g_gui.drawChar(c, x, y + 2, g_gui._textcolor);
|
g_gui.drawChar(c, x, y + 2, g_gui._textcolor, &g_consolefont);
|
||||||
} else {
|
} else {
|
||||||
g_gui.fillRect(x, y, kCharWidth, kLineHeight, g_gui._textcolor);
|
g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._textcolor);
|
||||||
g_gui.drawChar(c, x, y + 2, g_gui._bgcolor);
|
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;
|
_caretVisible = !erase;
|
||||||
}
|
}
|
||||||
|
|
4784
gui/consolefont.cpp
Normal file
4784
gui/consolefont.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
@ -5,6 +5,7 @@ MODULE_OBJS := \
|
||||||
gui/browser.o \
|
gui/browser.o \
|
||||||
gui/chooser.o \
|
gui/chooser.o \
|
||||||
gui/console.o \
|
gui/console.o \
|
||||||
|
gui/consolefont.o \
|
||||||
gui/dialog.o \
|
gui/dialog.o \
|
||||||
gui/EditTextWidget.o \
|
gui/EditTextWidget.o \
|
||||||
gui/launcher.o \
|
gui/launcher.o \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue