diff options
author | Benjamin Haisch | 2008-04-25 11:20:43 +0000 |
---|---|---|
committer | Benjamin Haisch | 2008-04-25 11:20:43 +0000 |
commit | 3dc6263b171f7b351dd13962f1094bb4ee3129a2 (patch) | |
tree | 49cecdd4312a102fa72a0923eb2fd5ae558df2fd /engines/made | |
parent | 134762be381ef76cb3a13f7ea37e9f0a6464ae00 (diff) | |
download | scummvm-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')
-rw-r--r-- | engines/made/screen.cpp | 46 | ||||
-rw-r--r-- | engines/made/screen.h | 13 |
2 files changed, 57 insertions, 2 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 diff --git a/engines/made/screen.h b/engines/made/screen.h index d95e9440ae..d5dc1bb3e2 100644 --- a/engines/made/screen.h +++ b/engines/made/screen.h @@ -31,6 +31,8 @@ #include "graphics/surface.h" +#include "made/resource.h" + namespace Made { struct SpriteChannel { @@ -70,7 +72,6 @@ public: 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 @@ public: 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 @@ protected: 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 @@ protected: int16 _outlineColor; int16 _dropShadowColor; + int16 _textX, _textY; + int16 _currentFontIndex; + FontResource *_font; + ClipInfo _fontDrawCtx; + uint16 _clip, _exclude, _ground; int _visualEffectNum; |