[Scummvm-cvs-logs] CVS: scummvm newgui.h,1.17,1.18 newgui.cpp,1.22,1.23 readme.txt,1.72,1.73

Max Horn fingolfin at users.sourceforge.net
Thu Jul 18 07:48:07 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv14905

Modified Files:
	newgui.h newgui.cpp readme.txt 
Log Message:
painelf's key repeat patch

Index: newgui.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- newgui.h	17 Jul 2002 20:55:36 -0000	1.17
+++ newgui.h	18 Jul 2002 14:47:25 -0000	1.18
@@ -82,6 +82,11 @@
 	Dialog		*_aboutDialog;
 	Dialog		*_optionsDialog;
 
+	// for continuous events (keyDown)
+	int			_currentKeyDown, _currentKeyDownFlags;
+	int			_loopCount;
+	int			_eventFiredCount;
+
 	// sound state
 	bool		_old_soundsPaused;
 

Index: newgui.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/newgui.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- newgui.cpp	17 Jul 2002 20:55:35 -0000	1.22
+++ newgui.cpp	18 Jul 2002 14:47:25 -0000	1.23
@@ -39,7 +39,8 @@
 
 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)
+	_pauseDialog(0), _saveLoadDialog(0), _aboutDialog(0), _optionsDialog(0),
+	_currentKeyDown(0)
 {	
 }
 
@@ -115,9 +116,18 @@
 			switch(t.event_code) {
 				case OSystem::EVENT_KEYDOWN:
 					activeDialog->handleKeyDown(t.kbd.ascii, t.kbd.flags);
+
+					// init continuous event stream
+					_currentKeyDown = t.kbd.ascii;
+					_currentKeyDownFlags = t.kbd.flags;
+					_eventFiredCount = 1;
+					_loopCount = 0;
 					break;
 				case OSystem::EVENT_KEYUP:
 					activeDialog->handleKeyUp(t.kbd.ascii, t.kbd.flags);
+					if (t.kbd.ascii == _currentKeyDown)
+						// only stop firing events if it's the current key
+						_currentKeyDown = 0;
 					break;
 				case OSystem::EVENT_MOUSEMOVE:
 					activeDialog->handleMouseMoved(t.mouse.x - activeDialog->_x, t.mouse.y - activeDialog->_y, 0);
@@ -135,6 +145,22 @@
 		}
 
 		_eventList.clear();
+	}
+
+	// check if event should be sent again (keydown)
+	if (_currentKeyDown != 0)
+	{
+		// if only fired once, wait longer
+		if ( _loopCount >= ((_eventFiredCount > 1) ? 2 : 4) )
+		//                                               ^  loops to wait first event
+		//                                           ^      loops to wait after first event
+		{
+			// fire event
+			activeDialog->handleKeyDown(_currentKeyDown, _currentKeyDownFlags);
+			_eventFiredCount++;
+			_loopCount = 0;
+		}
+		_loopCount++;
 	}
 
 	_s->drawDirtyScreenParts();

Index: readme.txt
===================================================================
RCS file: /cvsroot/scummvm/scummvm/readme.txt,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- readme.txt	16 Jul 2002 21:03:14 -0000	1.72
+++ readme.txt	18 Jul 2002 14:47:25 -0000	1.73
@@ -535,6 +535,7 @@
         Felix Jakschitsc   - His hard work on Zak256
         Andre Souza        - SDL-based OpenGL renderer
         Kovacs Endre Janos - Several fixes for Simon1
+        Ralph Brorsen      - Helped write the new GUI
 
         And to all the contributors, users, and beta testers we've missed.
         Thanks!





More information about the Scummvm-git-logs mailing list