diff options
author | Max Horn | 2002-07-10 22:49:41 +0000 |
---|---|---|
committer | Max Horn | 2002-07-10 22:49:41 +0000 |
commit | c60670d561b0ad8106cd54adf163a0c39412575e (patch) | |
tree | 63cf3e40942ca6e8f8bc61649abc5beb286fb657 /newgui.cpp | |
parent | 9b3784ef6dcb26e4864844cc626e472ae49393b2 (diff) | |
download | scummvm-rg350-c60670d561b0ad8106cd54adf163a0c39412575e.tar.gz scummvm-rg350-c60670d561b0ad8106cd54adf163a0c39412575e.tar.bz2 scummvm-rg350-c60670d561b0ad8106cd54adf163a0c39412575e.zip |
added prototype ListWidget (doesn't do anything yet, only serves to demo how it might look); renamed various NewGui methods and added frameRect method; made NewGui use our 'own' GUI colors (no worries if you don't like them, this is just an experiment); StaticTextWidget now clones its label (preventing problems when a game was loaded, thus invalidating string locations in memory)
svn-id: r4513
Diffstat (limited to 'newgui.cpp')
-rw-r--r-- | newgui.cpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/newgui.cpp b/newgui.cpp index b16f3fbc83..199fb720ff 100644 --- a/newgui.cpp +++ b/newgui.cpp @@ -24,9 +24,6 @@ #include "guimaps.h" #include "gui/dialog.h" -#define hline(x, y, x2, color) line(x, y, x2, y, color); -#define vline(x, y, y2, color) line(x, y, x, y2, color); - // 8-bit alpha blending routines int BlendCache[256][256]; @@ -51,7 +48,7 @@ int RGBMatch(byte *palette, int r, int g, int b) { } int Blend(int src, int dst, byte *palette) { - int r, g, b, idx; + int r, g, b; int alpha = 128; // Level of transparency [0-256] byte *srcpal = palette + (dst * 3); byte *dstpal = palette + (src * 3); @@ -138,6 +135,18 @@ void NewGui::loop() saveState(); if (_use_alpha_blending) activeDialog->setupScreenBuf(); +#if 1 + // FIXME - hack to encode our own custom GUI colors. Since we have to live + // with a given 8 bit palette, the result is not always as nice as one + // would wish, but this is just an experiment after all. + _bgcolor = RGBMatch(_s->_currentPalette, 0, 0, 0); + + _color = RGBMatch(_s->_currentPalette, 80, 80, 80); + _shadowcolor = RGBMatch(_s->_currentPalette, 64, 64, 64); + + _textcolor = RGBMatch(_s->_currentPalette, 32, 192, 32); + _textcolorhi = RGBMatch(_s->_currentPalette, 0, 256, 0); +#endif _prepare_for_gui = false; } @@ -320,7 +329,7 @@ void NewGui::line(int x, int y, int x2, int y2, byte color) } } -void NewGui::blendArea(int x, int y, int w, int h, byte color) +void NewGui::blendRect(int x, int y, int w, int h, byte color) { byte *ptr = getBasePtr(x, y); if (ptr == NULL) @@ -334,7 +343,7 @@ void NewGui::blendArea(int x, int y, int w, int h, byte color) } } -void NewGui::fillArea(int x, int y, int w, int h, byte color) +void NewGui::fillRect(int x, int y, int w, int h, byte color) { byte *ptr = getBasePtr(x, y); if (ptr == NULL) @@ -348,7 +357,28 @@ void NewGui::fillArea(int x, int y, int w, int h, byte color) } } -void NewGui::setAreaDirty(int x, int y, int w, int h) +void NewGui::frameRect(int x, int y, int w, int h, byte color) +{ + int i; + byte *ptr, *basePtr = getBasePtr(x, y); + if (basePtr == NULL) + return; + + ptr = basePtr; + for (i = 0; i < w; i++, ptr++) + *ptr = color; + ptr--; + for (i = 0; i < h; i++, ptr += 320) + *ptr = color; + ptr = basePtr; + for (i = 0; i < h; i++, ptr += 320) + *ptr = color; + ptr -= 320; + for (i = 0; i < w; i++, ptr++) + *ptr = color; +} + +void NewGui::addDirtyRect(int x, int y, int w, int h) { VirtScreen *vs = _s->findVirtScreen(y); |