[Scummvm-cvs-logs] CVS: scummvm/gui newgui.cpp,1.95,1.96 newgui.h,1.51,1.52

Max Horn fingolfin at users.sourceforge.net
Thu Jan 6 13:17:43 CET 2005


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14934/gui

Modified Files:
	newgui.cpp newgui.h 
Log Message:
Added a font manager (work in progress)

Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.cpp,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -d -r1.95 -r1.96
--- newgui.cpp	6 Jan 2005 19:09:34 -0000	1.95
+++ newgui.cpp	6 Jan 2005 21:15:52 -0000	1.96
@@ -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 @@
 
 // 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 @@
 	};
 
 	_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 @@
 #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::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) {

Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/newgui.h,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- newgui.h	6 Jan 2005 19:09:34 -0000	1.51
+++ newgui.h	6 Jan 2005 21:15:52 -0000	1.52
@@ -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 @@
 	DialogStack	_dialogStack;
 
 	bool		_stateIsSaved;
+	
+	const Graphics::Font *_font;
 
 	// for continuous events (keyDown)
 	struct {





More information about the Scummvm-git-logs mailing list