aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorMax Horn2005-01-06 21:15:52 +0000
committerMax Horn2005-01-06 21:15:52 +0000
commitc6e0d31e76134fbdd3a1626aad9ed3e38f25afb3 (patch)
tree913925590e558d57670e21479d4853e6bb15447c /gui
parentf3b7c27cbdeb7f1801fa5ed34d2aa0b65454b72f (diff)
downloadscummvm-rg350-c6e0d31e76134fbdd3a1626aad9ed3e38f25afb3.tar.gz
scummvm-rg350-c6e0d31e76134fbdd3a1626aad9ed3e38f25afb3.tar.bz2
scummvm-rg350-c6e0d31e76134fbdd3a1626aad9ed3e38f25afb3.zip
Added a font manager (work in progress)
svn-id: r16460
Diffstat (limited to 'gui')
-rw-r--r--gui/newgui.cpp18
-rw-r--r--gui/newgui.h4
2 files changed, 9 insertions, 13 deletions
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 34afd17b2a..6f718459c2 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -24,13 +24,8 @@
#include "gui/dialog.h"
-// Uncomment the following to enable the new font code:
-//#define NEW_FONT_CODE
-
-
DECLARE_SINGLETON(GUI::NewGui);
-
namespace GUI {
/*
@@ -55,7 +50,7 @@ enum {
// Constructor
NewGui::NewGui() : _scaleEnable(true), _needRedraw(false),
- _stateIsSaved(false), _cursorAnimateCounter(0), _cursorAnimateTimer(0) {
+ _stateIsSaved(false), _font(0), _cursorAnimateCounter(0), _cursorAnimateTimer(0) {
_system = &OSystem::instance();
@@ -90,6 +85,9 @@ void NewGui::updateScaleFactor() {
};
_scaleFactor = MIN(_system->getWidth() / kDefaultGUIWidth, _system->getHeight() / kDefaultGUIHeight);
+
+ // TODO: Pick a bigger font depending on the 'scale' factor.
+ _font = FontMan.getFontByUsage(Graphics::FontManager::kGUIFont);
}
void NewGui::runLoop() {
@@ -266,11 +264,7 @@ void NewGui::closeTopDialog() {
#pragma mark -
const Graphics::Font &NewGui::getFont() const {
-#ifdef NEW_FONT_CODE
- return Graphics::g_sysfont;
-#else
- return Graphics::g_scummfont;
-#endif
+ return *_font;
}
OverlayColor *NewGui::getBasePtr(int x, int y) {
@@ -355,7 +349,7 @@ void NewGui::addDirtyRect(int x, int y, int w, int h) {
void NewGui::drawChar(byte chr, int xx, int yy, OverlayColor color, const Graphics::Font *font) {
if (font == 0)
font = &getFont();
- font->drawChar(&_screen, chr, xx, yy, color, _scaleEnable);
+ font->drawChar(&_screen, chr, xx, yy, color, _scaleFactor);
}
int NewGui::getStringWidth(const String &str) {
diff --git a/gui/newgui.h b/gui/newgui.h
index 19791e74ed..f8ee91a78e 100644
--- a/gui/newgui.h
+++ b/gui/newgui.h
@@ -26,7 +26,7 @@
#include "common/stack.h"
#include "common/str.h"
#include "common/system.h" // For events
-#include "graphics/font.h"
+#include "graphics/fontman.h"
namespace GUI {
@@ -81,6 +81,8 @@ protected:
DialogStack _dialogStack;
bool _stateIsSaved;
+
+ const Graphics::Font *_font;
// for continuous events (keyDown)
struct {