[Scummvm-cvs-logs] CVS: scummvm/sword2 sword2.cpp,1.145,1.146 sword2.h,1.80,1.81
Torbjörn Andersson
eriktorbjorn at users.sourceforge.net
Tue May 31 05:54:54 CEST 2005
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.134,1.135 actor.h,1.74,1.75 interface.cpp,1.97,1.98 puzzle.cpp,1.5,1.6 puzzle.h,1.2,1.3 render.cpp,1.60,1.61 saga.cpp,1.113,1.114
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga input.cpp,1.44,1.45 interface.cpp,1.98,1.99 interface.h,1.54,1.55 saga.h,1.97,1.98 saveload.cpp,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4427
Modified Files:
sword2.cpp sword2.h
Log Message:
Added keyboard auto-repeat. (I've been meaning to do that for a long time.)
Index: sword2.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.cpp,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- sword2.cpp 12 May 2005 13:12:13 -0000 1.145
+++ sword2.cpp 31 May 2005 12:53:55 -0000 1.146
@@ -132,6 +132,7 @@
_debugger = NULL;
_keyboardEvent.pending = false;
+ _keyboardEvent.repeat = 0;
_mouseEvent.pending = false;
_wantSfxDebug = false;
@@ -475,17 +476,23 @@
void Sword2Engine::parseEvents() {
OSystem::Event event;
+
+ uint32 now = _system->getMillis();
while (_system->pollEvent(event)) {
switch (event.type) {
case OSystem::EVENT_KEYDOWN:
if (!(_eventFilter & RD_KEYDOWN)) {
_keyboardEvent.pending = true;
+ _keyboardEvent.repeat = now + 400;
_keyboardEvent.ascii = event.kbd.ascii;
_keyboardEvent.keycode = event.kbd.keycode;
_keyboardEvent.modifiers = event.kbd.flags;
}
break;
+ case OSystem::EVENT_KEYUP:
+ _keyboardEvent.repeat = 0;
+ break;
case OSystem::EVENT_MOUSEMOVE:
if (!(_eventFilter & RD_KEYDOWN)) {
_mouse->setPos(event.mouse.x, event.mouse.y - MENUDEEP);
@@ -534,6 +541,12 @@
break;
}
}
+
+ // Handle keyboard auto-repeat
+ if (!_keyboardEvent.pending && _keyboardEvent.repeat && now >= _keyboardEvent.repeat) {
+ _keyboardEvent.pending = true;
+ _keyboardEvent.repeat = now + 100;
+ }
}
void Sword2Engine::gameCycle() {
Index: sword2.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/sword2.h,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- sword2.h 23 Apr 2005 12:55:54 -0000 1.80
+++ sword2.h 31 May 2005 12:53:55 -0000 1.81
@@ -78,6 +78,7 @@
struct KeyboardEvent {
bool pending;
+ uint32 repeat;
uint16 ascii;
int keycode;
int modifiers;
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/saga actor.cpp,1.134,1.135 actor.h,1.74,1.75 interface.cpp,1.97,1.98 puzzle.cpp,1.5,1.6 puzzle.h,1.2,1.3 render.cpp,1.60,1.61 saga.cpp,1.113,1.114
- Next message: [Scummvm-cvs-logs] CVS: scummvm/saga input.cpp,1.44,1.45 interface.cpp,1.98,1.99 interface.h,1.54,1.55 saga.h,1.97,1.98 saveload.cpp,1.11,1.12
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list