aboutsummaryrefslogtreecommitdiff
path: root/engines/made/screen.cpp
diff options
context:
space:
mode:
authorBenjamin Haisch2008-04-25 11:20:43 +0000
committerBenjamin Haisch2008-04-25 11:20:43 +0000
commit3dc6263b171f7b351dd13962f1094bb4ee3129a2 (patch)
tree49cecdd4312a102fa72a0923eb2fd5ae558df2fd /engines/made/screen.cpp
parent134762be381ef76cb3a13f7ea37e9f0a6464ae00 (diff)
downloadscummvm-rg350-3dc6263b171f7b351dd13962f1094bb4ee3129a2.tar.gz
scummvm-rg350-3dc6263b171f7b351dd13962f1094bb4ee3129a2.tar.bz2
scummvm-rg350-3dc6263b171f7b351dd13962f1094bb4ee3129a2.zip
Started work on text drawing code.
svn-id: r31719
Diffstat (limited to 'engines/made/screen.cpp')
-rw-r--r--engines/made/screen.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/engines/made/screen.cpp b/engines/made/screen.cpp
index ede49e25f4..dc08bc0a88 100644
--- a/engines/made/screen.cpp
+++ b/engines/made/screen.cpp
@@ -63,6 +63,16 @@ Screen::Screen(MadeEngine *vm) : _vm(vm) {
_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 @@ void Screen::show() {
return;
drawSpriteChannels(_clipInfo1, 3, 0);
+
memcpy(_screen2->pixels, _screen1->pixels, 64000);
drawSpriteChannels(_clipInfo2, 1, 2);
@@ -488,4 +499,39 @@ void Screen::flash(int flashCount) {
}
}
+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