Thomas Buck 11 роки тому
джерело
коміт
d325c492ef
3 змінених файлів з 11 додано та 1 видалено
  1. 4
    0
      ChangeLog
  2. 6
    1
      src/SDLSystem.cpp
  3. 1
    0
      src/SDLSystem.h

+ 4
- 0
ChangeLog Переглянути файл

6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
7
 
7
 
8
 	[ 20140101 ]
8
 	[ 20140101 ]
9
+	* Added bool mFirstMouseEvent to SDLSystem used to ignore
10
+	  the first received mouse event, because its faulty, thanks
11
+	  to an SDL bug:
12
+	  http://gamedev.stackexchange.com/questions/33519/trap-mouse-in-sdl#comment56642_33554
9
 	* Fixed incredibly slow mouse/camera movements
13
 	* Fixed incredibly slow mouse/camera movements
10
 	* Fixed mouse grabbing in fullscreen mode. Also make mouse
14
 	* Fixed mouse grabbing in fullscreen mode. Also make mouse
11
 	  invisible and grab it in windowed mode
15
 	  invisible and grab it in windowed mode

+ 6
- 1
src/SDLSystem.cpp Переглянути файл

130
 	mWindow = 0x0;
130
 	mWindow = 0x0;
131
 	gWidth = &m_width;
131
 	gWidth = &m_width;
132
 	gHeight = &m_height;
132
 	gHeight = &m_height;
133
+    mFirstMouseEvent = false;
133
 }
134
 }
134
 
135
 
135
 
136
 
340
 				break;
341
 				break;
341
 			case SDL_MOUSEMOTION:
342
 			case SDL_MOUSEMOTION:
342
 				// Wrap motion
343
 				// Wrap motion
343
-				handleMouseMotionEvent(event.motion.xrel/2, -event.motion.yrel/2);
344
+                if (!mFirstMouseEvent) {
345
+                    mFirstMouseEvent = true;
346
+                } else {
347
+                    handleMouseMotionEvent(event.motion.xrel/2, event.motion.yrel/2);
348
+                }
344
 				break;
349
 				break;
345
 			case SDL_MOUSEBUTTONDOWN:
350
 			case SDL_MOUSEBUTTONDOWN:
346
 			case SDL_MOUSEBUTTONUP:
351
 			case SDL_MOUSEBUTTONUP:

+ 1
- 0
src/SDLSystem.h Переглянути файл

223
  protected:
223
  protected:
224
     int m_old_width;
224
     int m_old_width;
225
     int m_old_height;
225
     int m_old_height;
226
+    bool mFirstMouseEvent; // Filter first mouse event (SDL bug)
226
 
227
 
227
  private:
228
  private:
228
 
229
 

Завантаження…
Відмінити
Зберегти