[Scummvm-cvs-logs] CVS: scummvm newgui.cpp,1.3,1.4 newgui.h,1.2,1.3
Max Horn
fingolfin at users.sourceforge.net
Sun Jul 7 14:47:04 CEST 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm insane.cpp,1.38,1.39 sound.cpp,1.98,1.99 main.cpp,1.23,1.24
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui dialog.cpp,1.4,1.5 widget.cpp,1.4,1.5 widget.h,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv32080
Modified Files:
newgui.cpp newgui.h
Log Message:
added dialog nesting code (for now using std::stack, I will provide my own stack class later
Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- newgui.cpp 7 Jul 2002 13:14:34 -0000 1.3
+++ newgui.cpp 7 Jul 2002 21:46:53 -0000 1.4
@@ -28,7 +28,7 @@
#define vline(x, y, y2, color) line(x, y, x, y2, color);
-NewGui::NewGui(Scumm *s):_s(s), _active(false), _need_redraw(false), _activeDialog(0)
+NewGui::NewGui(Scumm *s) : _s(s), _need_redraw(false)
{
_pauseDialog = new PauseDialog(this);
_saveLoadDialog = new SaveLoadDialog(this);
@@ -36,33 +36,31 @@
void NewGui::pauseDialog()
{
- _active = true;
- _activeDialog = _pauseDialog;
- _need_redraw = true;
+ openDialog(_pauseDialog);
}
void NewGui::saveloadDialog()
{
- _active = true;
- _activeDialog = _saveLoadDialog;
- _need_redraw = true;
+ openDialog(_saveLoadDialog);
}
void NewGui::loop()
{
+ Dialog *activeDialog = _dialogStack.top();
+
if (_need_redraw) {
- _activeDialog->draw();
+ activeDialog->draw();
saveState();
_need_redraw = false;
}
_s->animateCursor();
_s->getKeyInput(0);
if (_s->_mouseButStat & MBS_LEFT_CLICK) {
- _activeDialog->handleClick(_s->mouse.x, _s->mouse.y, _s->_mouseButStat);
+ activeDialog->handleClick(_s->mouse.x, _s->mouse.y, _s->_mouseButStat);
} else if (_s->_lastKeyHit) {
- _activeDialog->handleKey(_s->_lastKeyHit, 0);
+ 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->_mouseButStat);
+ activeDialog->handleMouseMoved(_s->mouse.x, _s->mouse.y, _s->_mouseButStat);
_old_mouse.x = _s->mouse.x;
_old_mouse.y = _s->mouse.y;
}
@@ -107,6 +105,21 @@
_s->_system->show_mouse(_old_cursor_mode);
_s->pauseSounds(_old_soundsPaused);
+}
+
+void NewGui::openDialog(Dialog *dialog)
+{
+ _dialogStack.push(dialog);
+ _need_redraw = true;
+}
+
+void NewGui::closeTopDialog()
+{
+ _dialogStack.pop();
+ if (_dialogStack.empty())
+ restoreState();
+ else
+ _dialogStack.top()->draw();
}
#pragma mark -
Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- newgui.h 6 Jul 2002 12:57:51 -0000 1.2
+++ newgui.h 7 Jul 2002 21:46:53 -0000 1.3
@@ -21,11 +21,15 @@
#ifndef NEWGUI_H
#define NEWGUI_H
+#include <stack>
+
#include "scummsys.h"
class Scumm;
class Dialog;
+typedef std::stack<Dialog *> DialogStack;
+
class NewGui {
friend class Dialog;
public:
@@ -39,15 +43,15 @@
void saveloadDialog();
void loop();
- bool isActive() { return _active; }
+ bool isActive() { return ! _dialogStack.empty(); }
NewGui(Scumm *s);
protected:
Scumm *_s;
- bool _active;
bool _need_redraw;
- Dialog *_activeDialog;
+// Dialog *_activeDialog;
+ DialogStack _dialogStack;
Dialog *_pauseDialog;
Dialog *_saveLoadDialog;
@@ -67,6 +71,9 @@
void saveState();
void restoreState();
+
+ void openDialog(Dialog *dialog);
+ void closeTopDialog();
public:
// Drawing
- Previous message: [Scummvm-cvs-logs] CVS: scummvm insane.cpp,1.38,1.39 sound.cpp,1.98,1.99 main.cpp,1.23,1.24
- Next message: [Scummvm-cvs-logs] CVS: scummvm/gui dialog.cpp,1.4,1.5 widget.cpp,1.4,1.5 widget.h,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list