2002-07-05 16:56:53 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2002 The ScummVM project
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "scumm.h"
|
|
|
|
#include "newgui.h"
|
|
|
|
#include "guimaps.h"
|
|
|
|
#include "gui/dialog.h"
|
2002-07-12 16:24:11 +00:00
|
|
|
#include "gui/util.h"
|
2002-07-05 16:56:53 +00:00
|
|
|
|
2002-07-07 22:44:30 +00:00
|
|
|
/*
|
|
|
|
* TODO list
|
2002-07-08 01:04:29 +00:00
|
|
|
* - implement the missing / incomplete dialogs
|
2002-07-07 22:44:30 +00:00
|
|
|
* - add more widgets
|
2002-07-08 01:04:29 +00:00
|
|
|
* - add support for right/center aligned text
|
|
|
|
* - allow multi line (l/c/r aligned) text via StaticTextWidget ?
|
2002-07-07 22:44:30 +00:00
|
|
|
* - add "close" widget to all dialogs (with a flag to turn it off) ?
|
|
|
|
* - make dialogs "moveable" ?
|
2002-07-09 12:38:50 +00:00
|
|
|
* - come up with a new look&feel / theme for the GUI
|
2002-07-07 22:44:30 +00:00
|
|
|
* - ...
|
|
|
|
*/
|
|
|
|
|
2002-07-10 16:49:45 +00:00
|
|
|
NewGui::NewGui(Scumm *s) : _s(s), _use_alpha_blending(true),
|
|
|
|
_need_redraw(false),_prepare_for_gui(true),
|
|
|
|
_pauseDialog(0), _saveLoadDialog(0), _aboutDialog(0), _optionsDialog(0)
|
2002-07-09 12:33:09 +00:00
|
|
|
{
|
2002-07-05 16:56:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void NewGui::pauseDialog()
|
|
|
|
{
|
2002-07-08 00:10:11 +00:00
|
|
|
if (!_pauseDialog)
|
|
|
|
_pauseDialog = new PauseDialog(this);
|
2002-07-07 21:46:53 +00:00
|
|
|
openDialog(_pauseDialog);
|
2002-07-05 16:56:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void NewGui::saveloadDialog()
|
|
|
|
{
|
2002-07-08 00:10:11 +00:00
|
|
|
if (!_saveLoadDialog)
|
|
|
|
_saveLoadDialog = new SaveLoadDialog(this);
|
2002-07-07 21:46:53 +00:00
|
|
|
openDialog(_saveLoadDialog);
|
2002-07-05 16:56:53 +00:00
|
|
|
}
|
|
|
|
|
2002-07-07 22:44:30 +00:00
|
|
|
void NewGui::aboutDialog()
|
|
|
|
{
|
2002-07-08 00:10:11 +00:00
|
|
|
// if (!_aboutDialog)
|
|
|
|
// _aboutDialog = new AboutDialog(this);
|
2002-07-07 22:44:30 +00:00
|
|
|
// openDialog(_aboutDialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NewGui::optionsDialog()
|
|
|
|
{
|
2002-07-08 00:10:11 +00:00
|
|
|
if (!_optionsDialog)
|
|
|
|
_optionsDialog = new OptionsDialog(this);
|
2002-07-07 22:44:30 +00:00
|
|
|
openDialog(_optionsDialog);
|
|
|
|
}
|
|
|
|
|
2002-07-05 16:56:53 +00:00
|
|
|
void NewGui::loop()
|
|
|
|
{
|
2002-07-07 21:46:53 +00:00
|
|
|
Dialog *activeDialog = _dialogStack.top();
|
|
|
|
|
2002-07-10 16:49:45 +00:00
|
|
|
if (_prepare_for_gui) {
|
|
|
|
ClearBlendCache(_s->_currentPalette, 128);
|
|
|
|
saveState();
|
|
|
|
if (_use_alpha_blending)
|
|
|
|
activeDialog->setupScreenBuf();
|
2002-07-13 22:41:29 +00:00
|
|
|
#if 0
|
2002-07-13 18:32:09 +00:00
|
|
|
// 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);
|
2002-07-10 22:49:41 +00:00
|
|
|
#endif
|
2002-07-10 16:49:45 +00:00
|
|
|
_prepare_for_gui = false;
|
|
|
|
}
|
2002-07-13 22:41:29 +00:00
|
|
|
|
|
|
|
activeDialog->handleTickle();
|
|
|
|
|
2002-07-05 16:56:53 +00:00
|
|
|
if (_need_redraw) {
|
2002-07-07 21:46:53 +00:00
|
|
|
activeDialog->draw();
|
2002-07-05 16:56:53 +00:00
|
|
|
_need_redraw = false;
|
|
|
|
}
|
2002-07-10 16:49:45 +00:00
|
|
|
|
2002-07-05 16:56:53 +00:00
|
|
|
_s->animateCursor();
|
2002-07-13 18:32:09 +00:00
|
|
|
|
|
|
|
if (_eventList.size() > 0)
|
|
|
|
{
|
|
|
|
OSystem::Event t;
|
|
|
|
|
|
|
|
for (int i = 0; i < _eventList.size(); i++)
|
|
|
|
{
|
|
|
|
t = _eventList.getEvent(i);
|
|
|
|
|
|
|
|
switch(t.event_code) {
|
|
|
|
case OSystem::EVENT_KEYDOWN:
|
|
|
|
activeDialog->handleKeyDown(t.kbd.ascii, t.kbd.flags);
|
|
|
|
break;
|
|
|
|
// case OSystem::EVENT_KEYUP:
|
|
|
|
// activeDialog->handleKeyUp(t.kbd.ascii, t.kbd.flags);
|
|
|
|
break;
|
|
|
|
case OSystem::EVENT_MOUSEMOVE:
|
2002-07-13 22:41:29 +00:00
|
|
|
activeDialog->handleMouseMoved(t.mouse.x - activeDialog->_x, t.mouse.y - activeDialog->_y, 0);
|
2002-07-13 18:32:09 +00:00
|
|
|
break;
|
|
|
|
// We don't distinguish between mousebuttons (for now at least)
|
|
|
|
case OSystem::EVENT_LBUTTONDOWN:
|
|
|
|
case OSystem::EVENT_RBUTTONDOWN:
|
2002-07-13 22:41:29 +00:00
|
|
|
activeDialog->handleMouseDown(t.mouse.x - activeDialog->_x, t.mouse.y - activeDialog->_y, 1);
|
2002-07-13 18:32:09 +00:00
|
|
|
break;
|
|
|
|
case OSystem::EVENT_LBUTTONUP:
|
|
|
|
case OSystem::EVENT_RBUTTONUP:
|
2002-07-13 22:41:29 +00:00
|
|
|
activeDialog->handleMouseUp(t.mouse.x - activeDialog->_x, t.mouse.y - activeDialog->_y, 1);
|
2002-07-13 18:32:09 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_eventList.clear();
|
2002-07-05 16:56:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_s->drawDirtyScreenParts();
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
|
|
|
|
void NewGui::saveState()
|
|
|
|
{
|
|
|
|
_old_soundsPaused = _s->_soundsPaused;
|
|
|
|
_s->pauseSounds(true);
|
|
|
|
|
|
|
|
// Backup old cursor
|
|
|
|
memcpy(_old_grabbedCursor, _s->_grabbedCursor, sizeof(_old_grabbedCursor));
|
|
|
|
_old_cursorWidth = _s->_cursorWidth;
|
|
|
|
_old_cursorHeight = _s->_cursorHeight;
|
|
|
|
_old_cursorHotspotX = _s->_cursorHotspotX;
|
|
|
|
_old_cursorHotspotY = _s->_cursorHotspotY;
|
|
|
|
_old_cursor_mode = _s->_system->show_mouse(true);
|
|
|
|
|
|
|
|
_s->_cursorAnimate++;
|
|
|
|
_s->gdi._cursorActive = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void NewGui::restoreState()
|
|
|
|
{
|
|
|
|
_s->_fullRedraw = true;
|
|
|
|
_s->_completeScreenRedraw = true;
|
|
|
|
_s->_cursorAnimate--;
|
|
|
|
|
|
|
|
// Restore old cursor
|
|
|
|
memcpy(_s->_grabbedCursor, _old_grabbedCursor, sizeof(_old_grabbedCursor));
|
|
|
|
_s->_cursorWidth = _old_cursorWidth;
|
|
|
|
_s->_cursorHeight = _old_cursorHeight;
|
|
|
|
_s->_cursorHotspotX = _old_cursorHotspotX;
|
|
|
|
_s->_cursorHotspotY = _old_cursorHotspotY;
|
|
|
|
_s->updateCursor();
|
|
|
|
|
|
|
|
_s->_system->show_mouse(_old_cursor_mode);
|
|
|
|
|
|
|
|
_s->pauseSounds(_old_soundsPaused);
|
|
|
|
}
|
|
|
|
|
2002-07-07 21:46:53 +00:00
|
|
|
void NewGui::openDialog(Dialog *dialog)
|
|
|
|
{
|
2002-07-10 16:49:45 +00:00
|
|
|
if (_dialogStack.empty())
|
|
|
|
_prepare_for_gui = true;
|
|
|
|
else if (_use_alpha_blending)
|
|
|
|
dialog->setupScreenBuf();
|
|
|
|
|
2002-07-07 21:46:53 +00:00
|
|
|
_dialogStack.push(dialog);
|
|
|
|
_need_redraw = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void NewGui::closeTopDialog()
|
|
|
|
{
|
2002-07-10 16:49:45 +00:00
|
|
|
// Don't do anything if no dialog is open
|
|
|
|
if (_dialogStack.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Tear down its screenBuf
|
|
|
|
if (_use_alpha_blending)
|
|
|
|
_dialogStack.top()->teardownScreenBuf();
|
|
|
|
|
|
|
|
// Remove the dialog from the stack
|
2002-07-07 21:46:53 +00:00
|
|
|
_dialogStack.pop();
|
|
|
|
if (_dialogStack.empty())
|
|
|
|
restoreState();
|
|
|
|
else
|
2002-07-10 16:49:45 +00:00
|
|
|
_need_redraw = true;
|
2002-07-07 21:46:53 +00:00
|
|
|
}
|
|
|
|
|
2002-07-05 16:56:53 +00:00
|
|
|
#pragma mark -
|
|
|
|
|
2002-07-07 22:44:30 +00:00
|
|
|
const char *NewGui::queryResString(int stringno)
|
2002-07-05 16:56:53 +00:00
|
|
|
{
|
|
|
|
char *result;
|
|
|
|
int string;
|
|
|
|
|
|
|
|
if (stringno == 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (_s->_features & GF_AFTER_V7)
|
|
|
|
string = _s->_vars[string_map_table_v7[stringno - 1].num];
|
|
|
|
else if (_s->_features & GF_AFTER_V6)
|
|
|
|
string = _s->_vars[string_map_table_v6[stringno - 1].num];
|
|
|
|
else
|
|
|
|
string = string_map_table_v5[stringno - 1].num;
|
|
|
|
|
|
|
|
result = (char *)_s->getStringAddress(string);
|
|
|
|
|
2002-07-07 13:14:34 +00:00
|
|
|
if (!result) { // Gracelessly degrade to english :)
|
2002-07-05 16:56:53 +00:00
|
|
|
if (_s->_features & GF_AFTER_V6)
|
|
|
|
return string_map_table_v6[stringno - 1].string;
|
|
|
|
else
|
|
|
|
return string_map_table_v5[stringno - 1].string;
|
|
|
|
}
|
2002-07-07 13:14:34 +00:00
|
|
|
|
2002-07-05 16:56:53 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2002-07-07 22:44:30 +00:00
|
|
|
const char *NewGui::queryCustomString(int stringno)
|
|
|
|
{
|
|
|
|
return string_map_table_custom[stringno];
|
|
|
|
}
|
|
|
|
|
2002-07-07 23:37:47 +00:00
|
|
|
|
2002-07-05 16:56:53 +00:00
|
|
|
#pragma mark -
|
|
|
|
|
2002-07-07 23:37:47 +00:00
|
|
|
|
2002-07-08 00:10:11 +00:00
|
|
|
byte *NewGui::getBasePtr(int x, int y)
|
2002-07-05 16:56:53 +00:00
|
|
|
{
|
2002-07-08 00:10:11 +00:00
|
|
|
VirtScreen *vs = _s->findVirtScreen(y);
|
2002-07-05 16:56:53 +00:00
|
|
|
|
|
|
|
if (vs == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
return vs->screenPtr + x + (y - vs->topline) * 320 +
|
2002-07-07 13:14:34 +00:00
|
|
|
_s->_screenStartStrip * 8 + (_s->camera._cur.y - 100) * 320;
|
2002-07-05 16:56:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void NewGui::box(int x, int y, int width, int height)
|
|
|
|
{
|
|
|
|
hline(x + 1, y, x + width - 2, _color);
|
|
|
|
hline(x, y + 1, x + width - 1, _color);
|
|
|
|
vline(x, y + 1, y + height - 2, _color);
|
|
|
|
vline(x + 1, y, y + height - 1, _color);
|
|
|
|
|
|
|
|
hline(x + 1, y + height - 2, x + width - 1, _shadowcolor);
|
|
|
|
hline(x + 1, y + height - 1, x + width - 2, _shadowcolor);
|
|
|
|
vline(x + width - 1, y + 1, y + height - 2, _shadowcolor);
|
|
|
|
vline(x + width - 2, y + 1, y + height - 1, _shadowcolor);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NewGui::line(int x, int y, int x2, int y2, byte color)
|
|
|
|
{
|
|
|
|
byte *ptr;
|
2002-07-07 13:14:34 +00:00
|
|
|
|
2002-07-05 16:56:53 +00:00
|
|
|
if (x2 < x)
|
2002-07-07 13:14:34 +00:00
|
|
|
x2 ^= x ^= x2 ^= x; // Swap x2 and x
|
2002-07-05 16:56:53 +00:00
|
|
|
|
|
|
|
if (y2 < y)
|
2002-07-07 13:14:34 +00:00
|
|
|
y2 ^= y ^= y2 ^= y; // Swap y2 and y
|
2002-07-05 16:56:53 +00:00
|
|
|
|
|
|
|
ptr = getBasePtr(x, y);
|
|
|
|
|
|
|
|
if (ptr == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (x == x2) {
|
|
|
|
/* vertical line */
|
|
|
|
while (y++ <= y2) {
|
|
|
|
*ptr = color;
|
|
|
|
ptr += 320;
|
|
|
|
}
|
|
|
|
} else if (y == y2) {
|
|
|
|
/* horizontal line */
|
|
|
|
while (x++ <= x2) {
|
|
|
|
*ptr++ = color;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-10 22:49:41 +00:00
|
|
|
void NewGui::blendRect(int x, int y, int w, int h, byte color)
|
2002-07-10 16:49:45 +00:00
|
|
|
{
|
|
|
|
byte *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 += 320;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-10 22:49:41 +00:00
|
|
|
void NewGui::fillRect(int x, int y, int w, int h, byte color)
|
2002-07-05 16:56:53 +00:00
|
|
|
{
|
2002-07-08 00:10:11 +00:00
|
|
|
byte *ptr = getBasePtr(x, y);
|
2002-07-05 16:56:53 +00:00
|
|
|
if (ptr == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while (h--) {
|
2002-07-09 12:33:09 +00:00
|
|
|
for (int i = 0; i < w; i++) {
|
2002-07-10 16:49:45 +00:00
|
|
|
ptr[i] = color;
|
2002-07-09 12:33:09 +00:00
|
|
|
}
|
2002-07-05 16:56:53 +00:00
|
|
|
ptr += 320;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-12 16:24:11 +00:00
|
|
|
void NewGui::checkerRect(int x, int y, int w, int h, byte color)
|
|
|
|
{
|
|
|
|
byte *ptr = getBasePtr(x, y);
|
|
|
|
if (ptr == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while (h--) {
|
|
|
|
for (int i = 0; i < w; i++) {
|
|
|
|
if ((h ^ i) & 1)
|
|
|
|
ptr[i] = color;
|
|
|
|
}
|
|
|
|
ptr += 320;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-10 22:49:41 +00:00
|
|
|
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)
|
2002-07-08 00:10:11 +00:00
|
|
|
{
|
|
|
|
VirtScreen *vs = _s->findVirtScreen(y);
|
|
|
|
|
|
|
|
if (vs != NULL)
|
|
|
|
_s->setVirtscreenDirty(vs, x, y, x + w, y + h);
|
|
|
|
}
|
|
|
|
|
2002-07-05 16:56:53 +00:00
|
|
|
void NewGui::drawChar(const char str, int xx, int yy)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
if (ptr == NULL)
|
2002-07-07 13:14:34 +00:00
|
|
|
return;
|
|
|
|
|
2002-07-05 16:56:53 +00:00
|
|
|
for (y = 0; y < 8; y++) {
|
|
|
|
for (x = 0; x < 8; x++) {
|
|
|
|
unsigned char color;
|
|
|
|
if ((mask >>= 1) == 0) {
|
|
|
|
buffer = *tmp++;
|
|
|
|
mask = 0x80;
|
|
|
|
}
|
|
|
|
color = ((buffer & mask) != 0);
|
|
|
|
if (color)
|
|
|
|
ptr[x] = _color;
|
|
|
|
}
|
|
|
|
ptr += 320;
|
|
|
|
}
|
|
|
|
_color = tempc;
|
|
|
|
|
|
|
|
}
|
2002-07-07 23:37:47 +00:00
|
|
|
|
2002-07-15 12:59:56 +00:00
|
|
|
void NewGui::drawString(const char *str, int x, int y, int w, byte color, bool center)
|
2002-07-05 16:56:53 +00:00
|
|
|
{
|
|
|
|
if (_s->_gameId) { /* If a game is active.. */
|
2002-07-15 12:59:56 +00:00
|
|
|
StringTab *st = &_s->string[5];
|
|
|
|
st->charset = 1;
|
|
|
|
st->center = center;
|
|
|
|
st->color = color;
|
|
|
|
st->xpos = center ? x+w/2 : x;
|
|
|
|
st->ypos = y;
|
|
|
|
st->right = x + w;
|
|
|
|
|
2002-07-05 16:56:53 +00:00
|
|
|
_s->_messagePtr = (byte *)str;
|
|
|
|
_s->drawString(5);
|
|
|
|
} else {
|
2002-07-15 12:59:56 +00:00
|
|
|
// FIXME - support center, use nicer custom font. Ultimately, we might
|
|
|
|
// want to *always* draw our messages this way.
|
2002-07-05 16:56:53 +00:00
|
|
|
uint len = strlen(str);
|
|
|
|
for (uint letter = 0; letter < len; letter++)
|
2002-07-15 12:59:56 +00:00
|
|
|
drawChar(str[letter], x + (letter * 8), y);
|
2002-07-05 16:56:53 +00:00
|
|
|
}
|
|
|
|
}
|
2002-07-07 23:37:47 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Draw an 8x8 bitmap at location (x,y)
|
|
|
|
*/
|
|
|
|
void NewGui::drawBitmap(uint32 bitmap[8], int x, int y, byte color)
|
|
|
|
{
|
2002-07-08 00:10:11 +00:00
|
|
|
byte *ptr = getBasePtr(x, y);
|
2002-07-07 23:37:47 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2002-07-10 16:49:45 +00:00
|
|
|
|
|
|
|
void NewGui::blitTo(byte buffer[320*200], int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
byte *dstPtr = buffer + x + y*320;
|
|
|
|
byte *srcPtr = getBasePtr(x, y);
|
|
|
|
if (srcPtr == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while (h--) {
|
|
|
|
for (int i = 0; i < w; i++) {
|
|
|
|
*dstPtr++ = *srcPtr++;
|
|
|
|
}
|
|
|
|
dstPtr += 320 - w;
|
|
|
|
srcPtr += 320 - w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void NewGui::blitFrom(byte buffer[320*200], int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
byte *srcPtr = buffer + x + y*320;
|
|
|
|
byte *dstPtr = getBasePtr(x, y);
|
|
|
|
if (dstPtr == NULL)
|
|
|
|
return;
|
|
|
|
|
|
|
|
while (h--) {
|
|
|
|
for (int i = 0; i < w; i++) {
|
|
|
|
*dstPtr++ = *srcPtr++;
|
|
|
|
}
|
|
|
|
dstPtr += 320 - w;
|
|
|
|
srcPtr += 320 - w;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|