From bb57506d48e783027dbf09ab44c88b40ed7d2fa4 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 19 Sep 2002 16:06:51 +0000 Subject: Added overlay to OSystem interface; implemented overlay in SDL backend (all other backends, including SDL_gl, still need to implement this!); changed NewGUI to make use of the overlay; added Cmd-Q as a shortcut for Quit on MacOS X svn-id: r4971 --- gui/dialog.cpp | 80 +++++++--------------- gui/dialog.h | 24 +++---- gui/newgui.cpp | 205 ++++++++++++++++++++++++++------------------------------- gui/newgui.h | 34 +++++----- gui/widget.cpp | 7 +- 5 files changed, 150 insertions(+), 200 deletions(-) (limited to 'gui') diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 54b50e8958..e1886af83d 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -45,33 +45,6 @@ * ... */ -Dialog::~Dialog() -{ - teardownScreenBuf(); -} - -void Dialog::setupScreenBuf() -{ - // Create _screenBuf if it doesn't already exist - if (!_screenBuf) - _screenBuf = new byte[g_scumm->_realWidth * g_scumm->_realHeight]; - - // Draw the fixed parts of the dialog: background and border. - _gui->blendRect(_x, _y, _w, _h, _gui->_bgcolor); - _gui->box(_x, _y, _w, _h); - - // Finally blit this to _screenBuf - _gui->blitTo(_screenBuf, _x, _y, _w, _h); -} - -void Dialog::teardownScreenBuf() -{ - if (_screenBuf) { - delete [] _screenBuf; - _screenBuf = 0; - } -} - void Dialog::open() { Widget *w = _firstWidget; @@ -112,18 +85,15 @@ void Dialog::draw() if (!isVisible()) return; - if (_screenBuf) { - _gui->blitFrom(_screenBuf, _x, _y, _w, _h); - } else { - _gui->fillRect(_x, _y, _w, _h, _gui->_bgcolor); - _gui->box(_x, _y, _w, _h); - } - _gui->addDirtyRect(_x, _y, _w, _h); + _gui->blendRect(_x, _y, _w, _h, _gui->_bgcolor); + _gui->box(_x, _y, _w, _h); while (w) { w->draw(); w = w->_next; } + + _gui->addDirtyRect(_x, _y, _w, _h); } void Dialog::handleMouseDown(int x, int y, int button, int clickCount) @@ -314,8 +284,8 @@ enum { * method to Dialog for that. */ -SaveLoadDialog::SaveLoadDialog(NewGui *gui) - : Dialog (gui, 30, 20, 260, 124) +SaveLoadDialog::SaveLoadDialog(NewGui *gui, Scumm *scumm) + : Dialog (gui, 30, 20, 260, 124), _scumm(scumm) { addResText(10, 7, 240, 16, 1); // addResText(10, 7, 240, 16, 2); @@ -333,10 +303,9 @@ SaveLoadDialog::SaveLoadDialog(NewGui *gui) // Get savegame names ScummVM::StringList l; char name[32]; - Scumm *s = _gui->getScumm(); for (int i = 0; i <= 80; i++) { // 80 - got this value from the old GUI - s->getSavegameName(i, name); + _scumm->getSavegameName(i, name); l.push_back(name); } @@ -349,7 +318,7 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat case kListItemChangedCmd: case kSaveCmd: if (_savegameList->getSelected() >= 1 && !_savegameList->getSelectedString().isEmpty()) { - Scumm *s = _gui->getScumm(); + Scumm *s = _scumm; s->_saveLoadSlot = _savegameList->getSelected(); s->_saveLoadCompatible = false; s->_saveLoadFlag = 1; // 1 for save, I assume (Painelf) @@ -360,7 +329,7 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat case kListItemDoubleClickedCmd: case kLoadCmd: if (_savegameList->getSelected() >= 0 && !_savegameList->getSelectedString().isEmpty()) { - Scumm *s = _gui->getScumm(); + Scumm *s = _scumm; s->_saveLoadSlot = _savegameList->getSelected(); s->_saveLoadCompatible = false; s->_saveLoadFlag = 2; // 2 for load. Magic number anyone? @@ -374,8 +343,7 @@ void SaveLoadDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat _gui->optionsDialog(); break; case kQuitCmd: { - Scumm *s = _gui->getScumm(); - s->_system->quit(); + _scumm->_system->quit(); } break; default: @@ -441,8 +409,8 @@ PauseDialog::PauseDialog(NewGui *gui) addResText(4, 4, 220, 16, 10); } -SoundDialog::SoundDialog(NewGui *gui) - : Dialog (gui, 30, 20, 260, 110) +SoundDialog::SoundDialog(NewGui *gui, Scumm *scumm) + : Dialog (gui, 30, 20, 260, 110), _scumm(scumm) { // set up dialog @@ -471,14 +439,12 @@ SoundDialog::SoundDialog(NewGui *gui) void SoundDialog::open() { - Scumm *scumm = _gui->getScumm(); - Dialog::open(); // get current variables - _soundVolumeMaster = scumm->_sound->_sound_volume_master; - _soundVolumeMusic = scumm->_sound->_sound_volume_music; - _soundVolumeSfx = scumm->_sound->_sound_volume_sfx; + _soundVolumeMaster = _scumm->_sound->_sound_volume_master; + _soundVolumeMusic = _scumm->_sound->_sound_volume_music; + _soundVolumeSfx = _scumm->_sound->_sound_volume_sfx; masterVolumeSlider->setValue(_soundVolumeMaster); musicVolumeSlider->setValue(_soundVolumeMusic); @@ -509,17 +475,15 @@ void SoundDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) sfxVolumeLabel->draw(); break; case kOKCmd: { - Scumm *scumm = _gui->getScumm(); - // FIXME: Look at Fingolfins comments in Gui::handleSoundDialogCommand(), gui.cpp - scumm->_sound->_sound_volume_master = _soundVolumeMaster; // Master - scumm->_sound->_sound_volume_music = _soundVolumeMusic; // Music - scumm->_sound->_sound_volume_sfx = _soundVolumeSfx; // SFX + _scumm->_sound->_sound_volume_master = _soundVolumeMaster; // Master + _scumm->_sound->_sound_volume_music = _soundVolumeMusic; // Music + _scumm->_sound->_sound_volume_sfx = _soundVolumeSfx; // SFX - scumm->_imuse->set_music_volume(_soundVolumeMusic); - scumm->_imuse->set_master_volume(_soundVolumeMaster); - scumm->_mixer->setVolume(_soundVolumeSfx); - scumm->_mixer->setMusicVolume(_soundVolumeMusic); + _scumm->_imuse->set_music_volume(_soundVolumeMusic); + _scumm->_imuse->set_master_volume(_soundVolumeMaster); + _scumm->_mixer->setVolume(_soundVolumeSfx); + _scumm->_mixer->setMusicVolume(_soundVolumeMusic); scummcfg->setInt("master_volume", _soundVolumeMaster); scummcfg->setInt("music_volume", _soundVolumeMusic); diff --git a/gui/dialog.h b/gui/dialog.h index 4d5dd82d0b..3d1577b9e3 100644 --- a/gui/dialog.h +++ b/gui/dialog.h @@ -26,6 +26,7 @@ #include "ListWidget.h" class NewGui; +class Scumm; #define RES_STRING(id) _gui->queryResString(id) #define CUSTOM_STRING(id) _gui->queryCustomString(id) @@ -45,15 +46,14 @@ protected: Widget *_firstWidget; Widget *_mouseWidget; Widget *_focusedWidget; - byte *_screenBuf; bool _visible; public: Dialog(NewGui *gui, int x, int y, int w, int h) : _gui(gui), _x(x), _y(y), _w(w), _h(h), _firstWidget(0), - _mouseWidget(0), _focusedWidget(0), _screenBuf(0), _visible(false) + _mouseWidget(0), _focusedWidget(0), _visible(false) {} - virtual ~Dialog(); + virtual ~Dialog() {}; virtual void open(); virtual void close(); @@ -70,9 +70,6 @@ public: NewGui *getGui() { return _gui; } - virtual void setupScreenBuf(); - virtual void teardownScreenBuf(); - bool isVisible() const { return _visible; } protected: @@ -85,24 +82,25 @@ protected: class SaveLoadDialog : public Dialog { public: - SaveLoadDialog(NewGui *gui); + SaveLoadDialog(NewGui *gui, Scumm *scumm); virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); protected: + Scumm *_scumm; ListWidget *_savegameList; }; -class SoundDialog; -class KeysDialog; -class MiscDialog; - class AboutDialog : public Dialog { public: AboutDialog(NewGui *gui); }; +class SoundDialog; +class KeysDialog; +class MiscDialog; + class OptionsDialog : public Dialog { protected: SoundDialog *_soundDialog; @@ -138,7 +136,7 @@ public: class SoundDialog : public Dialog { public: - SoundDialog(NewGui *gui); + SoundDialog(NewGui *gui, Scumm *scumm); enum { kMasterVolumeChanged = 'mavc', @@ -153,6 +151,8 @@ public: virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); protected: + Scumm *_scumm; + int _soundVolumeMaster; int _soundVolumeMusic; int _soundVolumeSfx; diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 9da918525e..89a9cd49bb 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -37,11 +37,24 @@ * - ... */ -NewGui::NewGui(Scumm *s) : _s(s), _use_alpha_blending(false), - _need_redraw(false),_prepare_for_gui(true), +// FIXME - this macro assumes that we use 565 mode. But what if we are in 555 mode? +#define RGB_TO_16(r,g,b) (((((r)>>3)&0x1F) << 11) | ((((g)>>2)&0x3F) << 5) | (((b)>>3)&0x1F)) +//#define RGB_TO_16(r,g,b) (((((r)>>3)&0x1F) << 10) | ((((g)>>3)&0x1F) << 5) | (((b)>>3)&0x1F)) + +#define RED_FROM_16(x) ((((x)>>11)&0x1F) << 3) +#define GREEN_FROM_16(x) ((((x)>>5)&0x3F) << 2) +#define BLUE_FROM_16(x) (((x)&0x1F) << 3) + +//#define RED_FROM_16(x) ((((x)>>10)&0x1F) << 3) +//#define GREEN_FROM_16(x) ((((x)>>5)&0x1F) << 3) +//#define BLUE_FROM_16(x) (((x)&0x1F) << 3) + + +NewGui::NewGui(Scumm *s) : _s(s), _system(s->_system), _screen(0), + _use_alpha_blending(true), _need_redraw(false),_prepare_for_gui(true), _pauseDialog(0), _saveLoadDialog(0), _aboutDialog(0), _optionsDialog(0), _currentKeyDown(0) -{ +{ } void NewGui::pauseDialog() @@ -54,7 +67,7 @@ void NewGui::pauseDialog() void NewGui::saveloadDialog() { if (!_saveLoadDialog) - _saveLoadDialog = new SaveLoadDialog(this); + _saveLoadDialog = new SaveLoadDialog(this, _s); _saveLoadDialog->open(); } @@ -75,7 +88,7 @@ void NewGui::optionsDialog() void NewGui::soundDialog() { if (!_soundDialog) - _soundDialog = new SoundDialog(this); + _soundDialog = new SoundDialog(this, _s); _soundDialog->open(); } @@ -85,22 +98,14 @@ void NewGui::loop() int i; if (_prepare_for_gui) { - ClearBlendCache(_s->_currentPalette, 128); 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 + + // Setup some default GUI colors + _bgcolor = RGB_TO_16(0, 0, 0); + _color = RGB_TO_16(80, 80, 80); + _shadowcolor = RGB_TO_16(64, 64, 64); + _textcolor = RGB_TO_16(32, 192, 32); + _textcolorhi = RGB_TO_16(0, 255, 0); _eventList.clear(); _currentKeyDown = 0; @@ -115,6 +120,10 @@ void NewGui::loop() activeDialog->handleTickle(); if (_need_redraw) { + // Restore the overlay to its initial state, then draw all dialogs. + // This is necessary to get the blending right. + _system->clear_overlay(); + _system->grab_overlay(_screen, _screen_pitch); for (i = 0; i < _dialogStack.size(); i++) _dialogStack[i]->draw(); _need_redraw = false; @@ -152,7 +161,7 @@ void NewGui::loop() // We don't distinguish between mousebuttons (for now at least) case OSystem::EVENT_LBUTTONDOWN: case OSystem::EVENT_RBUTTONDOWN: { - uint32 time = _s->_system->get_msecs(); + uint32 time = _system->get_msecs(); if (_lastClick.count && (time < _lastClick.time + kDoubleClickDelay) && ABS(_lastClick.x - t.mouse.x) < 3 && ABS(_lastClick.y - t.mouse.y) < 3) { @@ -208,10 +217,16 @@ void NewGui::saveState() _old_cursorHeight = _s->_cursorHeight; _old_cursorHotspotX = _s->_cursorHotspotX; _old_cursorHotspotY = _s->_cursorHotspotY; - _old_cursor_mode = _s->_system->show_mouse(true); + _old_cursor_mode = _system->show_mouse(true); _s->_cursorAnimate++; _s->gdi._cursorActive = 1; + + // TODO - add getHeight & getWidth methods to OSystem + _system->show_overlay(); + _screen = new int16[_s->_realWidth * _s->_realHeight]; + _screen_pitch = _s->_realWidth; + _system->grab_overlay(_screen, _screen_pitch); } void NewGui::restoreState() @@ -228,17 +243,21 @@ void NewGui::restoreState() _s->_cursorHotspotY = _old_cursorHotspotY; _s->updateCursor(); - _s->_system->show_mouse(_old_cursor_mode); + _system->show_mouse(_old_cursor_mode); _s->_sound->pauseSounds(_old_soundsPaused); + + _system->hide_overlay(); + if (_screen) { + delete _screen; + _screen = 0; + } } void NewGui::openDialog(Dialog *dialog) { if (_dialogStack.empty()) _prepare_for_gui = true; - else if (_use_alpha_blending) - dialog->setupScreenBuf(); _dialogStack.push(dialog); _need_redraw = true; @@ -250,10 +269,6 @@ void NewGui::closeTopDialog() if (_dialogStack.empty()) return; - // Tear down its screenBuf - if (_use_alpha_blending) - _dialogStack.top()->teardownScreenBuf(); - // Remove the dialog from the stack _dialogStack.pop(); if (_dialogStack.empty()) @@ -304,15 +319,9 @@ const char *NewGui::queryCustomString(int stringno) #pragma mark - -byte *NewGui::getBasePtr(int x, int y) +int16 *NewGui::getBasePtr(int x, int y) { - VirtScreen *vs = _s->findVirtScreen(y); - - if (vs == NULL) - return NULL; - - return vs->screenPtr + x + (y - vs->topline) * _s->_realWidth + - _s->_screenStartStrip * 8 + (_s->camera._cur.y - (_s->_realHeight / 2)) * _s->_realWidth; + return _screen + x + y * _screen_pitch; } void NewGui::box(int x, int y, int width, int height) @@ -328,9 +337,9 @@ void NewGui::box(int x, int y, int width, int height) vline(x + width - 2, y + 1, y + height - 1, _shadowcolor); } -void NewGui::line(int x, int y, int x2, int y2, byte color) +void NewGui::line(int x, int y, int x2, int y2, int16 color) { - byte *ptr; + int16 *ptr; if (x2 < x) x2 ^= x ^= x2 ^= x; // Swap x2 and x @@ -347,7 +356,7 @@ void NewGui::line(int x, int y, int x2, int y2, byte color) /* vertical line */ while (y++ <= y2) { *ptr = color; - ptr += _s->_realWidth; + ptr += _screen_pitch; } } else if (y == y2) { /* horizontal line */ @@ -357,53 +366,61 @@ void NewGui::line(int x, int y, int x2, int y2, byte color) } } -void NewGui::blendRect(int x, int y, int w, int h, byte color) +void NewGui::blendRect(int x, int y, int w, int h, int16 color) { - byte *ptr = getBasePtr(x, y); + int r = RED_FROM_16(color); + int g = GREEN_FROM_16(color); + int b = BLUE_FROM_16(color); + int16 *ptr = getBasePtr(x, y); if (ptr == NULL) return; while (h--) { for (int i = 0; i < w; i++) { - ptr[i] = Blend(ptr[i], color, _s->_currentPalette); + ptr[i] = RGB_TO_16((RED_FROM_16(ptr[i])+r)/2, + (GREEN_FROM_16(ptr[i])+g)/2, + (BLUE_FROM_16(ptr[i])+b)/2); +// ptr[i] = color; } - ptr += _s->_realWidth; + ptr += _screen_pitch; } } -void NewGui::fillRect(int x, int y, int w, int h, byte color) +void NewGui::fillRect(int x, int y, int w, int h, int16 color) { - byte *ptr = getBasePtr(x, y); + int i; + int16 *ptr = getBasePtr(x, y); if (ptr == NULL) return; while (h--) { - for (int i = 0; i < w; i++) { + for (i = 0; i < w; i++) { ptr[i] = color; } - ptr += _s->_realWidth; + ptr += _screen_pitch; } } -void NewGui::checkerRect(int x, int y, int w, int h, byte color) +void NewGui::checkerRect(int x, int y, int w, int h, int16 color) { - byte *ptr = getBasePtr(x, y); + int i; + int16 *ptr = getBasePtr(x, y); if (ptr == NULL) return; while (h--) { - for (int i = 0; i < w; i++) { + for (i = 0; i < w; i++) { if ((h ^ i) & 1) ptr[i] = color; } - ptr += _s->_realWidth; + ptr += _screen_pitch; } } -void NewGui::frameRect(int x, int y, int w, int h, byte color) +void NewGui::frameRect(int x, int y, int w, int h, int16 color) { int i; - byte *ptr, *basePtr = getBasePtr(x, y); + int16 *ptr, *basePtr = getBasePtr(x, y); if (basePtr == NULL) return; @@ -411,57 +428,57 @@ void NewGui::frameRect(int x, int y, int w, int h, byte color) for (i = 0; i < w; i++, ptr++) *ptr = color; ptr--; - for (i = 0; i < h; i++, ptr += _s->_realWidth) + for (i = 0; i < h; i++, ptr += _screen_pitch) *ptr = color; ptr = basePtr; - for (i = 0; i < h; i++, ptr += _s->_realWidth) + for (i = 0; i < h; i++, ptr += _screen_pitch) *ptr = color; - ptr -= _s->_realWidth; + ptr -= _screen_pitch; 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); - - if (vs != NULL) - _s->setVirtscreenDirty(vs, x, y, x + w, y + h); + // For now we don't keep yet another list of dirty rects but simply + // blit the affected area directly to the overlay. At least for our current + // GUI/widget/dialog code that is just fine. + int16 *buf = getBasePtr(x, y); + _system->copy_rect_overlay(buf, _screen_pitch, x, y, w, h); } -void NewGui::drawChar(const char str, int xx, int yy) +void NewGui::drawChar(const char str, int xx, int yy, int16 color) { unsigned int buffer = 0, mask = 0, x, y; byte *tmp; - int tempc = _color; - _color = _textcolor; tmp = &guifont[0]; tmp += 224 + (str + 1) * 8; - byte *ptr = getBasePtr(xx, yy); + int16 *ptr = getBasePtr(xx, yy); if (ptr == NULL) return; for (y = 0; y < 8; y++) { for (x = 0; x < 8; x++) { - unsigned char color; + unsigned char c; if ((mask >>= 1) == 0) { buffer = *tmp++; mask = 0x80; } - color = ((buffer & mask) != 0); - if (color) - ptr[x] = _color; + c = ((buffer & mask) != 0); + if (c) + ptr[x] = color; } - ptr += _s->_realWidth; + ptr += _screen_pitch; } - _color = tempc; - } -void NewGui::drawString(const char *str, int x, int y, int w, byte color, int align) +void NewGui::drawString(const char *str, int x, int y, int w, int16 color, int align) { +#if 1 + if (0) { +#else if (_s->_gameId) { /* If a game is active.. */ StringTab *st = &_s->string[5]; st->charset = 1; @@ -480,22 +497,23 @@ void NewGui::drawString(const char *str, int x, int y, int w, byte color, int al _s->_messagePtr = (byte *)str; _s->drawString(5); +#endif } else { // FIXME - support center/right align, use nicer custom font. // Ultimately, we might want to *always* draw our messages this way, // but only if we have a nice font. uint len = strlen(str); for (uint letter = 0; letter < len; letter++) - drawChar(str[letter], x + (letter * 8), y); + drawChar(str[letter], x + (letter * 8), y, color); } } /* * Draw an 8x8 bitmap at location (x,y) */ -void NewGui::drawBitmap(uint32 bitmap[8], int x, int y, byte color) +void NewGui::drawBitmap(uint32 bitmap[8], int x, int y, int16 color) { - byte *ptr = getBasePtr(x, y); + int16 *ptr = getBasePtr(x, y); if (ptr == NULL) return; @@ -506,39 +524,6 @@ void NewGui::drawBitmap(uint32 bitmap[8], int x, int y, byte color) ptr[x2] = color; mask >>= 4; } - ptr += _s->_realWidth; - } -} - -void NewGui::blitTo(byte buffer[320*200], int x, int y, int w, int h) -{ - byte *dstPtr = buffer + x + y * _s->_realWidth; - byte *srcPtr = getBasePtr(x, y); - if (srcPtr == NULL) - return; - - while (h--) { - for (int i = 0; i < w; i++) { - *dstPtr++ = *srcPtr++; - } - dstPtr += _s->_realWidth - w; - srcPtr += _s->_realWidth - w; + ptr += _screen_pitch; } } - -void NewGui::blitFrom(byte buffer[320*200], int x, int y, int w, int h) -{ - byte *srcPtr = buffer + x + y * _s->_realWidth; - byte *dstPtr = getBasePtr(x, y); - if (dstPtr == NULL) - return; - - while (h--) { - for (int i = 0; i < w; i++) { - *dstPtr++ = *srcPtr++; - } - dstPtr += _s->_realWidth - w; - srcPtr += _s->_realWidth - w; - } -} - diff --git a/gui/newgui.h b/gui/newgui.h index 0b0aef913a..0df581d31b 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -63,10 +63,10 @@ typedef ScummVM::List EventList; class NewGui { friend class Dialog; public: - byte _color, _shadowcolor; - byte _bgcolor; - byte _textcolor; - byte _textcolorhi; + int16 _color, _shadowcolor; + int16 _bgcolor; + int16 _textcolor; + int16 _textcolorhi; // Dialogs void pauseDialog(); @@ -82,11 +82,13 @@ public: NewGui(Scumm *s); void handleEvent(const OSystem::Event &event) { _eventList.push_back(event); } - - Scumm *getScumm() { return _s; } protected: Scumm *_s; + OSystem *_system; + int16 *_screen; + int _screen_pitch; + bool _use_alpha_blending; bool _need_redraw; bool _prepare_for_gui; @@ -129,20 +131,18 @@ protected: public: // Drawing - byte *getBasePtr(int x, int y); + int16 *getBasePtr(int x, int y); void box(int x, int y, int width, int height); - void line(int x, int y, int x2, int y2, byte color); - void blendRect(int x, int y, int w, int h, byte color); - void fillRect(int x, int y, int w, int h, byte color); - void checkerRect(int x, int y, int w, int h, byte color); - void frameRect(int x, int y, int w, int h, byte color); + void line(int x, int y, int x2, int y2, int16 color); + void blendRect(int x, int y, int w, int h, int16 color); + void fillRect(int x, int y, int w, int h, int16 color); + void checkerRect(int x, int y, int w, int h, int16 color); + void frameRect(int x, int y, int w, int h, int16 color); void addDirtyRect(int x, int y, int w, int h); - void drawChar(const char c, int x, int y); - void drawString(const char *str, int x, int y, int w, byte color, int align = kTextAlignLeft); + void drawChar(const char c, int x, int y, int16 color); + void drawString(const char *str, int x, int y, int w, int16 color, int align = kTextAlignLeft); - void drawBitmap(uint32 bitmap[8], int x, int y, byte color); - void blitTo(byte buffer[320*200], int x, int y, int w, int h); - void blitFrom(byte buffer[320*200], int x, int y, int w, int h); + void drawBitmap(uint32 bitmap[8], int x, int y, int16 color); // Query a string from the resources const char *queryResString(int stringno); diff --git a/gui/widget.cpp b/gui/widget.cpp index e822617460..f6aedbad76 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -58,9 +58,6 @@ void Widget::draw() // Now perform the actual widget draw drawWidget(_flags & WIDGET_HILITED); - - // Flag the draw area as dirty - gui->addDirtyRect(_x, _y, _w, _h); // Restore x/y if (_flags & WIDGET_BORDER) { @@ -68,6 +65,10 @@ void Widget::draw() _y -= 4; _w += 8; } + + // Flag the draw area as dirty + gui->addDirtyRect(_x, _y, _w, _h); + _x -= _boss->_x; _y -= _boss->_y; } -- cgit v1.2.3