summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2014-09-02 23:13:40 -0300
committerDana Olson <dana@shineuponthee.com>2014-09-15 17:43:28 -0400
commit247e7ed716a4c0bd5140c2b2a938f7118e84fb14 (patch)
tree2487f84d19ea60c4140c085164219a893a4f8566 /platform/windows
parentdbae857b293231882307c52217e9569a17da0f23 (diff)
3D Physics and Other Stuff
-=-=-=-=-=-=-=-=-=-=-=-=-= -New Vehicle (Based on Bullet's RaycastVehicle) - Vehiclebody/VehicleWheel. Demo will come soon, old vehicle (CarBody) will go away soon too. -A lot of fixes to the 3D physics engine -Added KinematicBody with demo -Fixed the space query API for 2D (demo will come soon). 3D is WIP. -Fixed long-standing bug with body_enter/body_exit for Area and Area2D -Performance variables now includes physics (active bodies, collision pairs and islands) -Ability to see what's inside of instanced scenes! -Fixed Blend Shapes (no bs+skeleton yet) -Added an Android JavaClassWrapper singleton for using Android native classes directly from GDScript. This is very Alpha!
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/detect.py3
-rw-r--r--platform/windows/os_windows.cpp102
-rw-r--r--platform/windows/os_windows.h4
3 files changed, 93 insertions, 16 deletions
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 0e21540e13..b866dd2ec3 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -51,7 +51,7 @@ def get_flags():
return [
('freetype','builtin'), #use builtin freetype
- ('openssl','builtin'), #use builtin openssl
+ ('openssl','builtin'), #use builtin openssl
]
@@ -166,6 +166,7 @@ def configure(env):
env.Append(CCFLAGS=['-O3','-ffast-math','-fomit-frame-pointer','-msse2'])
env['OBJSUFFIX'] = "_opt"+env['OBJSUFFIX']
env['LIBSUFFIX'] = "_opt"+env['LIBSUFFIX']
+ env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])
elif (env["target"]=="release_debug"):
env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 778609950e..5e57827c68 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -206,6 +206,54 @@ bool OS_Windows::can_draw() const {
return !minimized;
};
+#define MI_WP_SIGNATURE 0xFF515700
+#define SIGNATURE_MASK 0xFFFFFF00
+#define IsPenEvent(dw) (((dw) & SIGNATURE_MASK) == MI_WP_SIGNATURE)
+
+
+void OS_Windows::_touch_event(int idx, UINT uMsg, WPARAM wParam, LPARAM lParam) {
+
+ InputEvent event;
+ event.type = InputEvent::SCREEN_TOUCH;
+ event.ID=++last_id;
+ event.screen_touch.index = idx;
+
+ switch (uMsg) {
+ case WM_LBUTTONDOWN:
+ case WM_MBUTTONDOWN:
+ case WM_RBUTTONDOWN: {
+
+ event.screen_touch.pressed = true;
+ } break;
+
+ case WM_LBUTTONUP:
+ case WM_MBUTTONUP:
+ case WM_RBUTTONUP: {
+ event.screen_touch.pressed = false;
+ } break;
+ };
+
+ event.screen_touch.x=GET_X_LPARAM(lParam);
+ event.screen_touch.y=GET_Y_LPARAM(lParam);
+
+ if (main_loop) {
+ input->parse_input_event(event);
+ }
+};
+
+void OS_Windows::_drag_event(int idx,UINT uMsg, WPARAM wParam, LPARAM lParam) {
+
+ InputEvent event;
+ event.type = InputEvent::SCREEN_DRAG;
+ event.ID=++last_id;
+ event.screen_drag.index = idx;
+
+ event.screen_drag.x=GET_X_LPARAM(lParam);
+ event.screen_drag.y=GET_Y_LPARAM(lParam);
+
+ if (main_loop)
+ input->parse_input_event(event);
+};
LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
@@ -270,28 +318,41 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
}
case WM_MOUSELEAVE: {
- old_invalid=true;
- outside=true;
+ old_invalid=true;
+ outside=true;
} break;
case WM_MOUSEMOVE: {
- if (outside) {
+ if (outside) {
+
+ CursorShape c=cursor_shape;
+ cursor_shape=CURSOR_MAX;
+ set_cursor_shape(c);
+ outside=false;
- CursorShape c=cursor_shape;
- cursor_shape=CURSOR_MAX;
- set_cursor_shape(c);
- outside=false;
+ //Once-Off notification, must call again....
+ TRACKMOUSEEVENT tme;
+ tme.cbSize=sizeof(TRACKMOUSEEVENT);
+ tme.dwFlags=TME_LEAVE;
+ tme.hwndTrack=hWnd;
+ tme.dwHoverTime=HOVER_DEFAULT;
+ TrackMouseEvent(&tme);
+
+ }
+
+ LPARAM extra = GetMessageExtraInfo();
+ if (IsPenEvent(extra)) {
+
+ int idx = extra & 0x7f;
+ _drag_event(idx, uMsg, wParam, lParam);
+ if (idx != 0) {
+ return 0;
+ };
+ // fallthrough for mouse event
+ };
- //Once-Off notification, must call again....
- TRACKMOUSEEVENT tme;
- tme.cbSize=sizeof(TRACKMOUSEEVENT);
- tme.dwFlags=TME_LEAVE;
- tme.hwndTrack=hWnd;
- tme.dwHoverTime=HOVER_DEFAULT;
- TrackMouseEvent(&tme);
- }
InputEvent event;
event.type=InputEvent::MOUSE_MOTION;
event.ID=++last_id;
@@ -360,6 +421,17 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
/*case WM_XBUTTONDOWN:
case WM_XBUTTONUP: */{
+ LPARAM extra = GetMessageExtraInfo();
+ if (IsPenEvent(extra)) {
+
+ int idx = extra & 0x7f;
+ _touch_event(idx, uMsg, wParam, lParam);
+ if (idx != 0) {
+ return 0;
+ };
+ // fallthrough for mouse event
+ };
+
InputEvent event;
event.type=InputEvent::MOUSE_BUTTON;
event.ID=++last_id;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index c9eb475e1a..1a41b9d77d 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -160,6 +160,10 @@ class OS_Windows : public OS {
void _post_dpad(DWORD p_dpad, int p_device, bool p_pressed);
+ void _drag_event(int idx,UINT uMsg, WPARAM wParam, LPARAM lParam);
+ void _touch_event(int idx, UINT uMsg, WPARAM wParam, LPARAM lParam);
+
+
// functions used by main to initialize/deintialize the OS
protected:
virtual int get_video_driver_count() const;