[Scummvm-cvs-logs] CVS: scummvm newgui.cpp,1.16,1.17 newgui.h,1.11,1.12 scummvm.cpp,1.172,1.173
Max Horn
fingolfin at users.sourceforge.net
Sat Jul 13 11:33:02 CEST 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/gui ListWidget.cpp,1.5,1.6 ScrollBarWidget.cpp,1.3,1.4 dialog.cpp,1.18,1.19 widget.cpp,1.14,1.15 ListWidget.h,1.5,1.6 ScrollBarWidget.h,1.2,1.3 dialog.h,1.9,1.10 widget.h,1.12,1.13
- Next message: [Scummvm-cvs-logs] CVS: scummvm newgui.cpp,1.17,1.18 newgui.h,1.12,1.13 scummvm.cpp,1.173,1.174
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv7919
Modified Files:
newgui.cpp newgui.h scummvm.cpp
Log Message:
took painelf's change, modified it a lot, and now here's the result :-)
Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- newgui.cpp 12 Jul 2002 16:24:11 -0000 1.16
+++ newgui.cpp 13 Jul 2002 18:32:09 -0000 1.17
@@ -81,16 +81,16 @@
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);
+ // 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;
}
@@ -101,19 +101,41 @@
}
_s->animateCursor();
- _s->getKeyInput(0);
- if (_s->_mouseButStat & MBS_LEFT_CLICK) {
- activeDialog->handleClick(_s->mouse.x, _s->mouse.y, _s->_mouseButStat);
- } else if (_s->_lastKeyHit) {
- activeDialog->handleKey(_s->_lastKeyHit, 0);
- } else if (_old_mouse.x != _s->mouse.x || _old_mouse.y != _s->mouse.y) {
- activeDialog->handleMouseMoved(_s->mouse.x, _s->mouse.y, _s->_leftBtnPressed);
- _old_mouse.x = _s->mouse.x;
- _old_mouse.y = _s->mouse.y;
+
+ 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:
+ activeDialog->handleMouseMoved(t.mouse.x, t.mouse.y, 0);
+ break;
+ // We don't distinguish between mousebuttons (for now at least)
+ case OSystem::EVENT_LBUTTONDOWN:
+ case OSystem::EVENT_RBUTTONDOWN:
+ activeDialog->handleMouseDown(t.mouse.x, t.mouse.y, 1);
+ break;
+ case OSystem::EVENT_LBUTTONUP:
+ case OSystem::EVENT_RBUTTONUP:
+ activeDialog->handleMouseUp(t.mouse.x, t.mouse.y, 1);
+ break;
+ }
+ }
+
+ _eventList.clear();
}
_s->drawDirtyScreenParts();
- _s->_mouseButStat = 0;
}
#pragma mark -
Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- newgui.h 12 Jul 2002 16:24:11 -0000 1.11
+++ newgui.h 13 Jul 2002 18:32:09 -0000 1.12
@@ -22,6 +22,8 @@
#define NEWGUI_H
#include "scummsys.h"
+#include "system.h" // For events
+#include "scumm.h" // For events
class Dialog;
class Scumm;
@@ -43,6 +45,27 @@
void pop() { if (_size > 0) _stack[--_size] = 0; }
};
+
+class EventList {
+protected:
+ OSystem::Event _stack[100];
+ int _size;
+public:
+ EventList() : _size(0) {}
+
+ void addEvent(const OSystem::Event &d) {
+ if (_size<(100-1))
+ _stack[_size++] = d;
+ else
+ error("EventList overflow.");
+ }
+
+ const OSystem::Event &getEvent(int i) const { return _stack[i]; }
+ int size() const { return _size; }
+ void clear() { _size = 0; }
+};
+
+
// This class hopefully will replace the old Gui class completly one day
class NewGui {
friend class Dialog;
@@ -64,6 +87,8 @@
NewGui(Scumm *s);
+ void handleEvent(const OSystem::Event &event) { _eventList.addEvent(event); }
+
protected:
Scumm *_s;
bool _use_alpha_blending;
@@ -88,6 +113,9 @@
struct {
int16 x,y;
} _old_mouse;
+
+ // List of events to be handled
+ EventList _eventList;
void saveState();
void restoreState();
Index: scummvm.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scummvm.cpp,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -d -r1.172 -r1.173
--- scummvm.cpp 13 Jul 2002 14:07:36 -0000 1.172
+++ scummvm.cpp 13 Jul 2002 18:32:09 -0000 1.173
@@ -1254,6 +1254,7 @@
for(;;) {
while (_system->poll_event(&event)) {
+
switch(event.event_code) {
case OSystem::EVENT_KEYDOWN:
if (event.kbd.keycode >= '0' && event.kbd.keycode<='9'
@@ -1309,6 +1310,12 @@
_rightBtnPressed &= ~msDown;
break;
}
+
+ // if newgui is running, copy event to EventList, and let the GUI handle it itself
+ // we might consider this approach for ScummLoop as well, and clean up the current mess
+ if (_newgui->isActive())
+ _newgui->handleEvent(event);
+
}
#ifdef COMPRESSED_SOUND_FILE
if (updateMP3CD() == -1)
@@ -1557,12 +1564,11 @@
_gui->_textcolor = getDefaultGUIColor(2);
_gui->_textcolorhi = getDefaultGUIColor(6);
_gui->_shadowcolor = getDefaultGUIColor(8);
-#if 0
- _newgui->_bgcolor = getDefaultGUIColor(0);
- _newgui->_color = getDefaultGUIColor(1);
- _newgui->_textcolor = getDefaultGUIColor(2);
- _newgui->_textcolorhi = getDefaultGUIColor(6);
- _newgui->_shadowcolor = getDefaultGUIColor(8);
-#endif
+
+ _newgui->_bgcolor = _gui->_bgcolor;
+ _newgui->_color = _gui->_color;
+ _newgui->_textcolor = _gui->_textcolor;
+ _newgui->_textcolorhi = _gui->_textcolorhi;
+ _newgui->_shadowcolor = _gui->_shadowcolor;
}
}
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/gui ListWidget.cpp,1.5,1.6 ScrollBarWidget.cpp,1.3,1.4 dialog.cpp,1.18,1.19 widget.cpp,1.14,1.15 ListWidget.h,1.5,1.6 ScrollBarWidget.h,1.2,1.3 dialog.h,1.9,1.10 widget.h,1.12,1.13
- Next message: [Scummvm-cvs-logs] CVS: scummvm newgui.cpp,1.17,1.18 newgui.h,1.12,1.13 scummvm.cpp,1.173,1.174
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list