diff options
author | Max Horn | 2002-07-07 23:37:47 +0000 |
---|---|---|
committer | Max Horn | 2002-07-07 23:37:47 +0000 |
commit | c3b606cd9b0b0445b0360f9a95225186252ae1c1 (patch) | |
tree | 00b31845f07a89afb6f2bb425d3e2e7a478554e1 /newgui.cpp | |
parent | 10d86be56456b57392cca05d5a2135408289223c (diff) | |
download | scummvm-rg350-c3b606cd9b0b0445b0360f9a95225186252ae1c1.tar.gz scummvm-rg350-c3b606cd9b0b0445b0360f9a95225186252ae1c1.tar.bz2 scummvm-rg350-c3b606cd9b0b0445b0360f9a95225186252ae1c1.zip |
added CheckboxWidget; added NewGui::drawBitmap
svn-id: r4486
Diffstat (limited to 'newgui.cpp')
-rw-r--r-- | newgui.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/newgui.cpp b/newgui.cpp index 4a9828bb26..ab79428254 100644 --- a/newgui.cpp +++ b/newgui.cpp @@ -179,11 +179,14 @@ const char *NewGui::queryCustomString(int stringno) return string_map_table_custom[stringno]; } + #pragma mark - -byte *NewGui::getBasePtr(int x, int y) + +byte *NewGui::getBasePtr(int x, int y, VirtScreen *vs) { - VirtScreen *vs = _s->findVirtScreen(y); + if (vs == NULL) + vs = _s->findVirtScreen(y); if (vs == NULL) return NULL; @@ -237,7 +240,7 @@ void NewGui::line(int x, int y, int x2, int y2, byte color) void NewGui::clearArea(int x, int y, int w, int h) { VirtScreen *vs = _s->findVirtScreen(y); - byte *ptr = getBasePtr(x, y); + byte *ptr = getBasePtr(x, y, vs); if (ptr == NULL) return; @@ -280,6 +283,7 @@ void NewGui::drawChar(const char str, int xx, int yy) _color = tempc; } + void NewGui::drawString(const char *str, int x, int y, int w, byte color) { StringTab *st = &_s->string[5]; @@ -299,3 +303,26 @@ void NewGui::drawString(const char *str, int x, int y, int w, byte color) drawChar(str[letter], st->xpos + (letter * 8), st->ypos); } } + +/* + * Draw an 8x8 bitmap at location (x,y) + */ +void NewGui::drawBitmap(uint32 bitmap[8], int x, int y, byte color) +{ + VirtScreen *vs = _s->findVirtScreen(y); + byte *ptr = getBasePtr(x, y, vs); + if (ptr == NULL) + return; + + for (int y2 = 0; y2 < 8; y2++) { + uint32 mask = 0xF0000000; + for (int x2 = 0; x2 < 8; x2++) { + if (bitmap[y2] & mask) + ptr[x2] = color; + mask >>= 4; + } + ptr += 320; + } + + _s->setVirtscreenDirty(vs, x, y, x + 8, y + 8); +} |