[Scummvm-cvs-logs] CVS: scummvm/gui consolefont.cpp,NONE,1.1 console.cpp,1.48,1.49 module.mk,1.12,1.13

Max Horn fingolfin at users.sourceforge.net
Sun Aug 15 07:40:00 CEST 2004


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

Modified Files:
	console.cpp module.mk 
Added Files:
	consolefont.cpp 
Log Message:
Use custom font for the console -> more information visible, helps when using e.g. the 'actors' command

--- NEW FILE: consolefont.cpp ---
/* Generated by convbdf on Sun Aug 15 16:38:06 2004. */
#include "common/stdafx.h"
#include "graphics/font.h"

/* Font information:
   name: 5x7
   facename: -Misc-Fixed-Medium-R-Normal--7-70-75-75-C-50-ISO8859-1
   w x h: 5x7
   size: 256
   ascent: 6
   descent: 1
   first char: 0 (0x00)
   last char: 255 (0xff)
   default char: 0 (0x00)
   proportional: no
   Copyright 1991, 1998 The Open Group
*/

namespace GUI {
[...4745 lines suppressed...]
};

/* Exported structure definition. */
static const FontDesc desc = {
	"5x7",
	5,
	7,
	6,
	0,
	256,
	_font_bits,
	_sysfont_offset,
	0,  /* fixed width*/
	0,
	sizeof(_font_bits)/sizeof(bitmap_t)
};

extern const NewFont g_consolefont(desc);

} // End of namespace GUI

Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- console.cpp	15 Aug 2004 13:15:55 -0000	1.48
+++ console.cpp	15 Aug 2004 14:39:35 -0000	1.49
@@ -27,10 +27,14 @@
 
 #include "graphics/font.h"
 
-#define kCharWidth	g_gui.getFont().getMaxCharWidth()
+namespace GUI {
+
+extern const Graphics::NewFont g_consolefont;
+
+#define kConsoleCharWidth	(g_consolefont.getMaxCharWidth())
+#define kConsoleLineHeight	(g_consolefont.getFontHeight() + 2)
 
 
-namespace GUI {
 
 #define PROMPT	") "
 
@@ -83,14 +87,14 @@
 void ConsoleDialog::reflowLayout() {
 	// Calculate the real width/height (rounded to char/line multiples)
 	_w = (uint16)(_widthPercent * g_system->getOverlayWidth());
-//	_w = (_widthPercent * g_system->getOverlayWidth() - kScrollBarWidth - 2) / kCharWidth;
-//	_w = _w * kCharWidth + kScrollBarWidth + 2;
-	_h = (uint16)((_heightPercent * g_system->getOverlayHeight() - 2) / kLineHeight);
-	_h = _h * kLineHeight + 2;
+//	_w = (_widthPercent * g_system->getOverlayWidth() - kScrollBarWidth - 2) / kConsoleCharWidth;
+//	_w = _w * kConsoleCharWidth + kScrollBarWidth + 2;
+	_h = (uint16)((_heightPercent * g_system->getOverlayHeight() - 2) / kConsoleLineHeight);
+	_h = _h * kConsoleLineHeight + 2;
 
 	// Calculate depending values
-	_lineWidth = (_w - kScrollBarWidth - 2) / kCharWidth;
-	_linesPerPage = (_h - 2) / kLineHeight;
+	_lineWidth = (_w - kScrollBarWidth - 2) / kConsoleCharWidth;
+	_linesPerPage = (_h - 2) / kConsoleLineHeight;
 }
 
 void ConsoleDialog::open() {
@@ -121,10 +125,10 @@
 #else
 			byte c = buffer((start + line) * _lineWidth + column);
 #endif
-			g_gui.drawChar(c, x, y, g_gui._textcolor);
-			x += kCharWidth;
+			g_gui.drawChar(c, x, y, g_gui._textcolor, &g_consolefont);
+			x += kConsoleCharWidth;
 		}
-		y += kLineHeight;
+		y += kConsoleLineHeight;
 	}
 
 	// Draw the scrollbar
@@ -534,18 +538,18 @@
 		return;
 	}
 
-	int x = _x + 1 + (_currentPos % _lineWidth) * kCharWidth;
-	int y = _y + displayLine * kLineHeight;
+	int x = _x + 1 + (_currentPos % _lineWidth) * kConsoleCharWidth;
+	int y = _y + displayLine * kConsoleLineHeight;
 
 	char c = buffer(_currentPos);
 	if (erase) {
-		g_gui.fillRect(x, y, kCharWidth, kLineHeight, g_gui._bgcolor);
-		g_gui.drawChar(c, x, y + 2, g_gui._textcolor);
+		g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._bgcolor);
+		g_gui.drawChar(c, x, y + 2, g_gui._textcolor, &g_consolefont);
 	} else {
-		g_gui.fillRect(x, y, kCharWidth, kLineHeight, g_gui._textcolor);
-		g_gui.drawChar(c, x, y + 2, g_gui._bgcolor);
+		g_gui.fillRect(x, y, kConsoleCharWidth, kConsoleLineHeight, g_gui._textcolor);
+		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;
 }

Index: module.mk
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/module.mk,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- module.mk	21 Mar 2004 21:20:18 -0000	1.12
+++ module.mk	15 Aug 2004 14:39:35 -0000	1.13
@@ -5,6 +5,7 @@
 	gui/browser.o \
 	gui/chooser.o \
 	gui/console.o \
+	gui/consolefont.o \
 	gui/dialog.o \
 	gui/EditTextWidget.o \
 	gui/launcher.o \





More information about the Scummvm-git-logs mailing list