[Scummvm-cvs-logs] SF.net SVN: scummvm: [31719] scummvm/trunk/engines/made
john_doe at users.sourceforge.net
john_doe at users.sourceforge.net
Fri Apr 25 13:20:44 CEST 2008
Revision: 31719
http://scummvm.svn.sourceforge.net/scummvm/?rev=31719&view=rev
Author: john_doe
Date: 2008-04-25 04:20:43 -0700 (Fri, 25 Apr 2008)
Log Message:
-----------
Started work on text drawing code.
Modified Paths:
--------------
scummvm/trunk/engines/made/screen.cpp
scummvm/trunk/engines/made/screen.h
Modified: scummvm/trunk/engines/made/screen.cpp
===================================================================
--- scummvm/trunk/engines/made/screen.cpp 2008-04-25 11:07:56 UTC (rev 31718)
+++ scummvm/trunk/engines/made/screen.cpp 2008-04-25 11:20:43 UTC (rev 31719)
@@ -63,6 +63,16 @@
_exclude = 0;
_visualEffectNum = 0;
+
+ _textX = 0;
+ _textY = 0;
+ _font = NULL;
+ _currentFontIndex = 0;
+ _fontDrawCtx.x = 0;
+ _fontDrawCtx.y = 0;
+ _fontDrawCtx.w = 320;
+ _fontDrawCtx.h = 200;
+ _fontDrawCtx.destSurface = _screen1;
clearChannels();
}
@@ -455,6 +465,7 @@
return;
drawSpriteChannels(_clipInfo1, 3, 0);
+
memcpy(_screen2->pixels, _screen1->pixels, 64000);
drawSpriteChannels(_clipInfo2, 1, 2);
@@ -488,4 +499,39 @@
}
}
+void Screen::setFont(int16 fontIndex) {
+ if (fontIndex == _currentFontIndex)
+ return;
+ if (_font)
+ _vm->_res->freeResource(_font);
+ _font = _vm->_res->getFont(fontIndex);
+ _currentFontIndex = fontIndex;
+}
+
+void Screen::printChar(char c, int16 x, int16 y, byte color) {
+
+ if (!_font)
+ return;
+
+ int height = _font->getHeight();
+ byte *charData = _font->getChar(c);
+
+ if (!charData)
+ return;
+
+ byte p;
+ byte *dest = (byte*)_fontDrawCtx.destSurface->getBasePtr(x, y);
+
+ for (int16 yc = 0; yc < height; yc++) {
+ p = charData[yc];
+ for (int16 xc = 0; xc < 8; xc++) {
+ if (p & 0x80)
+ dest[xc] = color;
+ p <<= 1;
+ }
+ dest += _fontDrawCtx.destSurface->pitch;
+ }
+
+}
+
} // End of namespace Made
Modified: scummvm/trunk/engines/made/screen.h
===================================================================
--- scummvm/trunk/engines/made/screen.h 2008-04-25 11:07:56 UTC (rev 31718)
+++ scummvm/trunk/engines/made/screen.h 2008-04-25 11:20:43 UTC (rev 31719)
@@ -31,6 +31,8 @@
#include "graphics/surface.h"
+#include "made/resource.h"
+
namespace Made {
struct SpriteChannel {
@@ -70,7 +72,6 @@
void setClip(uint16 clip) { _clip = clip; }
void setExclude(uint16 exclude) { _exclude = exclude; }
void setGround(uint16 ground) { _ground = ground; }
- void setFont(uint16 font) { _currentFont = font; }
void setTextColor(int16 color) { _textColor = color; }
void setOutlineColor(int16 color) {
@@ -116,7 +117,9 @@
void show();
void flash(int count);
- byte _screenPalette[256 * 4];
+ void setFont(int16 fontIndex);
+ void printChar(char c, int16 x, int16 y, byte color);
+
protected:
MadeEngine *_vm;
@@ -124,6 +127,7 @@
bool _screenLock;
bool _paletteLock;
+ byte _screenPalette[256 * 4];
byte _palette[768], _newPalette[768], _fxPalette[768];
int _paletteColorCount, _oldPaletteColorCount;
bool _paletteInitialized, _needPalette;
@@ -132,6 +136,11 @@
int16 _outlineColor;
int16 _dropShadowColor;
+ int16 _textX, _textY;
+ int16 _currentFontIndex;
+ FontResource *_font;
+ ClipInfo _fontDrawCtx;
+
uint16 _clip, _exclude, _ground;
int _visualEffectNum;
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