[Scummvm-cvs-logs] SF.net SVN: scummvm:[33118] residual/trunk/engine
aquadran at users.sourceforge.net
aquadran at users.sourceforge.net
Sun Jul 20 11:55:36 CEST 2008
Revision: 33118
http://scummvm.svn.sourceforge.net/scummvm/?rev=33118&view=rev
Author: aquadran
Date: 2008-07-20 09:55:29 +0000 (Sun, 20 Jul 2008)
Log Message:
-----------
added support for emergency font rendering for soft renderer
Modified Paths:
--------------
residual/trunk/engine/backend/sdl/driver_tinygl.cpp
residual/trunk/engine/engine.cpp
Modified: residual/trunk/engine/backend/sdl/driver_tinygl.cpp
===================================================================
--- residual/trunk/engine/backend/sdl/driver_tinygl.cpp 2008-07-20 01:44:40 UTC (rev 33117)
+++ residual/trunk/engine/backend/sdl/driver_tinygl.cpp 2008-07-20 09:55:29 UTC (rev 33118)
@@ -30,6 +30,7 @@
#include "engine/colormap.h"
#include "engine/material.h"
+#include "engine/font.h"
#include "engine/backend/sdl/driver_tinygl.h"
#include "engine/tinygl/gl.h"
@@ -581,7 +582,28 @@
void DriverTinyGL::loadEmergFont() {
}
-void DriverTinyGL::drawEmergString(int /*x*/, int /*y*/, const char * /*text*/, const Color &/*fgColor*/) {
+void DriverTinyGL::drawEmergString(int x, int y, const char *text, const Color &fgColor) {
+ uint16 color = ((fgColor.red() & 0xF8) << 8) | ((fgColor.green() & 0xFC) << 3) | (fgColor.blue() >> 3);
+
+ for (int l = 0; l < (int)strlen(text); l++) {
+ char c = text[l];
+ assert(c >= 32 && c <= 127);
+ const uint8 *ptr = Font::emerFont[c - 32];
+ for (int py = 0; py < 13; py++) {
+ if ((py + y) < 480) {
+ int line = ptr[12 - py];
+ for (int px = 0; px < 8; px++) {
+ if ((px + x) < 640) {
+ int pixel = line & 0x80;
+ line <<= 1;
+ if (pixel)
+ WRITE_LE_UINT16(_zb->pbuf + ((py + y) * 640) + (px + x), color);
+ }
+ }
+ }
+ }
+ x += 10;
+ }
}
Driver::TextObjectHandle *DriverTinyGL::createTextBitmap(uint8 *data, int width, int height, const Color &fgColor) {
Modified: residual/trunk/engine/engine.cpp
===================================================================
--- residual/trunk/engine/engine.cpp 2008-07-20 01:44:40 UTC (rev 33117)
+++ residual/trunk/engine/engine.cpp 2008-07-20 09:55:29 UTC (rev 33118)
@@ -83,6 +83,7 @@
_refreshDrawNeeded = true;
g_searchFile = NULL;
_savedState = NULL;
+ _fps[0] = 0;
textObjectDefaults.x = 0;
textObjectDefaults.y = 200;
@@ -392,7 +393,7 @@
// don't kill CPU
g_driver->delayMillis(10);
- if (SHOWFPS_GLOBAL && _doFlip) {
+ if (SHOWFPS_GLOBAL && _doFlip && _mode != ENGINE_MODE_DRAW) {
_frameCounter++;
_timeAccum += _frameTime;
if (_timeAccum > 1000) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list