瀏覽代碼

Fixed some stuff MingW patch broke and added mouse warp support in Windows

Ivan Safrin 13 年之前
父節點
當前提交
19d64a03df

+ 4 - 0
Core/Contents/Include/PolyGLHeaders.h

@@ -1,5 +1,9 @@
 #pragma once
 
+#if defined(_WINDOWS) && !defined(_MINGW)
+#include <windows.h>
+#endif
+
 #ifdef _MINGW 
 #include "GLee.h"
 typedef GLEEPFNGLACTIVETEXTUREPROC PFNGLACTIVETEXTUREPROC;

+ 1 - 0
Core/Contents/Include/PolyWinCore.h

@@ -174,6 +174,7 @@ public:
 		~Win32Core();
 
 		void enableMouse(bool newval);
+		void warpCursor(int x, int y);
 		unsigned int getTicks();		
 		bool Update();
 

+ 5 - 4
Core/Contents/Source/PolyGLSLShaderModule.cpp

@@ -20,6 +20,11 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
 */
 
+
+#ifdef _WINDOWS
+#include <windows.h>
+#endif
+
 #include "PolyGLHeaders.h"
 
 #include "PolyGLSLShaderModule.h"
@@ -34,10 +39,6 @@ THE SOFTWARE.
 
 #include "tinyxml.h"
 
-#ifdef _WINDOWS
-#include <windows.h>
-#endif
-
 using std::vector;
 
 using namespace Polycode;

+ 0 - 3
Core/Contents/Source/PolyScreenEntity.cpp

@@ -468,8 +468,6 @@ void ScreenEntity::_onMouseWheelUp(Number x, Number y, int timestamp, Vector2 pa
 		}
 	}
 	}		
-	
-	return retVal;
 }
 
 void ScreenEntity::_onMouseWheelDown(Number x, Number y, int timestamp, Vector2 parentAdjust) {
@@ -519,7 +517,6 @@ void ScreenEntity::_onMouseWheelDown(Number x, Number y, int timestamp, Vector2
 	}
 	}		
 	
-	return retVal;	
 }
 
 

+ 11 - 1
Core/Contents/Source/PolyWinCore.cpp

@@ -20,8 +20,8 @@
  THE SOFTWARE.
 */		
 
-#include "PolyGLHeaders.h"
 #include "PolyWinCore.h"
+#include "PolyGLHeaders.h"
 #include "PolyCoreInput.h"
 #include "PolyCoreServices.h"
 #include "PolyInputEvent.h"
@@ -100,6 +100,16 @@ void Win32Core::enableMouse(bool newval) {
 	ShowCursor(newval);	
 }
 
+void Win32Core::warpCursor(int x, int y) {
+	POINT point;
+	point.x = x;
+	point.y = y;
+	ClientToScreen(hWnd, &point);
+	SetCursorPos(point.x,point.y);
+	lastMouseX = x;
+	lastMouseY = y;
+}
+
 unsigned int Win32Core::getTicks() {
 	return GetTickCount();
 }