Use font manager
svn-id: r18964
This commit is contained in:
parent
8b4f59dc7a
commit
3bd243e043
2 changed files with 10 additions and 11 deletions
|
@ -29,15 +29,10 @@
|
||||||
|
|
||||||
#include "graphics/font.h"
|
#include "graphics/font.h"
|
||||||
|
|
||||||
namespace Graphics {
|
|
||||||
extern const NewFont g_consolefont;
|
|
||||||
}
|
|
||||||
using Graphics::g_consolefont;
|
|
||||||
|
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
#define kConsoleCharWidth (g_consolefont.getMaxCharWidth())
|
#define kConsoleCharWidth (_font->getMaxCharWidth())
|
||||||
#define kConsoleLineHeight (g_consolefont.getFontHeight() + 2)
|
#define kConsoleLineHeight (_font->getFontHeight() + 2)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kConsoleSlideDownDuration = 200 // Time in milliseconds
|
kConsoleSlideDownDuration = 200 // Time in milliseconds
|
||||||
|
@ -60,6 +55,8 @@ ConsoleDialog::ConsoleDialog(float widthPercent, float heightPercent)
|
||||||
const int screenW = g_system->getOverlayWidth();
|
const int screenW = g_system->getOverlayWidth();
|
||||||
const int screenH = g_system->getOverlayHeight();
|
const int screenH = g_system->getOverlayHeight();
|
||||||
|
|
||||||
|
_font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
|
||||||
|
|
||||||
// Calculate the real width/height (rounded to char/line multiples)
|
// Calculate the real width/height (rounded to char/line multiples)
|
||||||
_w = (uint16)(_widthPercent * screenW);
|
_w = (uint16)(_widthPercent * screenW);
|
||||||
_h = (uint16)((_heightPercent * screenH - 2) / kConsoleLineHeight);
|
_h = (uint16)((_heightPercent * screenH - 2) / kConsoleLineHeight);
|
||||||
|
@ -177,7 +174,7 @@ 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_consolefont);
|
g_gui.drawChar(c, x, y, g_gui._textcolor, _font);
|
||||||
x += kConsoleCharWidth;
|
x += kConsoleCharWidth;
|
||||||
}
|
}
|
||||||
y += kConsoleLineHeight;
|
y += kConsoleLineHeight;
|
||||||
|
@ -568,7 +565,7 @@ int ConsoleDialog::printf(const char *format, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ConsoleDialog::vprintf(const char *format, va_list argptr) {
|
int ConsoleDialog::vprintf(const char *format, va_list argptr) {
|
||||||
#ifdef PALMOS_68K
|
#ifdef PALMOS_MODE
|
||||||
char buf[256];
|
char buf[256];
|
||||||
#else
|
#else
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
|
@ -632,10 +629,10 @@ void ConsoleDialog::drawCaret(bool erase) {
|
||||||
char c = buffer(_currentPos);
|
char c = buffer(_currentPos);
|
||||||
if (erase) {
|
if (erase) {
|
||||||
g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._bgcolor);
|
g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._bgcolor);
|
||||||
g_gui.drawChar(c, x, y + 2, g_gui._textcolor, &g_consolefont);
|
g_gui.drawChar(c, x, y + 2, g_gui._textcolor, _font);
|
||||||
} else {
|
} else {
|
||||||
g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._textcolor);
|
g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._textcolor);
|
||||||
g_gui.drawChar(c, x, y + 2, g_gui._bgcolor, &g_consolefont);
|
g_gui.drawChar(c, x, y + 2, g_gui._bgcolor, _font);
|
||||||
}
|
}
|
||||||
g_gui.addDirtyRect(x, y, kConsoleCharWidth, kConsoleLineHeight);
|
g_gui.addDirtyRect(x, y, kConsoleCharWidth, kConsoleLineHeight);
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Graphics::Surface _canvas;
|
Graphics::Surface _canvas;
|
||||||
|
const Graphics::Font *_font;
|
||||||
|
|
||||||
char _buffer[kBufferSize];
|
char _buffer[kBufferSize];
|
||||||
int _linesInBuffer;
|
int _linesInBuffer;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue