summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/os/input_event.cpp4
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.cpp5
-rw-r--r--editor/editor_themes.cpp9
-rw-r--r--editor/plugins/canvas_item_editor_plugin.cpp4
-rw-r--r--methods.py118
-rw-r--r--modules/gdnative/godot/godot_array.cpp10
-rw-r--r--modules/gdnative/godot/godot_array.h2
-rw-r--r--modules/gdnative/godot/godot_dictionary.cpp9
-rw-r--r--modules/gdnative/godot/godot_dictionary.h2
-rw-r--r--platform/iphone/app_delegate.mm8
-rw-r--r--platform/iphone/os_iphone.cpp18
-rw-r--r--platform/uwp/app.cpp117
-rw-r--r--platform/uwp/detect.py15
-rw-r--r--platform/uwp/gl_context_egl.cpp2
-rw-r--r--platform/uwp/os_uwp.cpp29
-rw-r--r--platform/uwp/os_uwp.h4
-rw-r--r--platform/windows/os_windows.cpp2
-rw-r--r--platform/windows/os_windows.h3
-rw-r--r--scene/gui/tree.cpp2
-rw-r--r--scene/resources/texture.cpp3
-rw-r--r--scene/resources/texture.h2
21 files changed, 184 insertions, 184 deletions
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp
index 2538e8dad2..73eaa33dbb 100644
--- a/core/os/input_event.cpp
+++ b/core/os/input_event.cpp
@@ -57,7 +57,7 @@ bool InputEvent::is_pressed() const {
bool InputEvent::is_action(const StringName &p_action) const {
- return InputMap::get_singleton()->event_is_action(Ref<InputEvent>(this), p_action);
+ return InputMap::get_singleton()->event_is_action(Ref<InputEvent>((InputEvent *)this), p_action);
}
bool InputEvent::is_action_pressed(const StringName &p_action) const {
@@ -816,7 +816,7 @@ void InputEventAction::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pressed", "pressed"), &InputEventAction::set_pressed);
//ClassDB::bind_method(D_METHOD("is_pressed"), &InputEventAction::is_pressed);
- ClassDB::bind_method(D_METHOD("is_action", "name"), &InputEventAction::is_action);
+ // ClassDB::bind_method(D_METHOD("is_action", "name"), &InputEventAction::is_action);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "action"), "set_action", "get_action");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "pressed"), "set_pressed", "is_pressed");
diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp
index a7996b09d3..79c6f7f01f 100644
--- a/drivers/gles3/rasterizer_scene_gles3.cpp
+++ b/drivers/gles3/rasterizer_scene_gles3.cpp
@@ -4831,7 +4831,12 @@ void RasterizerSceneGLES3::initialize() {
glGenTextures(1, &e.color);
glBindTexture(GL_TEXTURE_2D, e.color);
+#ifdef IPHONE_ENABLED
+ ///@TODO ugly hack to get around iOS not supporting 32bit single channel floating point textures...
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_R16F, max_exposure_shrink_size, max_exposure_shrink_size, 0, GL_RED, GL_FLOAT, NULL);
+#else
glTexImage2D(GL_TEXTURE_2D, 0, GL_R32F, max_exposure_shrink_size, max_exposure_shrink_size, 0, GL_RED, GL_FLOAT, NULL);
+#endif
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, e.color, 0);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index b88474e2c3..1d73192f76 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -293,12 +293,13 @@ Ref<Theme> create_editor_theme() {
// LineEdit
Ref<StyleBoxFlat> style_lineedit = make_flat_stylebox(dark_color_1, 4, 4, 4, 4);
style_lineedit->set_border_size(1 * EDSCALE);
- style_lineedit->set_light_color(light_color_1);
- style_lineedit->set_dark_color(light_color_1);
+ style_lineedit = change_border_color(style_lineedit, light_color_1);
Ref<StyleBoxFlat> style_lineedit_disabled = style_lineedit->duplicate();
- style_lineedit_disabled->set_bg_color(light_color_2);
+ style_lineedit_disabled->set_bg_color(light_color_1);
+ Ref<StyleBoxFlat> style_lineedit_focus = change_border_color(style_lineedit, highlight_color);
+ style_lineedit_focus->set_draw_center(false);
theme->set_stylebox("normal", "LineEdit", style_lineedit);
- theme->set_stylebox("focus", "LineEdit", change_border_color(style_lineedit, highlight_color));
+ theme->set_stylebox("focus", "LineEdit", style_lineedit_focus);
theme->set_stylebox("read_only", "LineEdit", style_lineedit_disabled);
// TextEdit
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp
index 2f1a4ce115..a626dffc3c 100644
--- a/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/editor/plugins/canvas_item_editor_plugin.cpp
@@ -1531,8 +1531,8 @@ void CanvasItemEditor::_viewport_gui_input(const Ref<InputEvent> &p_event) {
continue;
}
- bool uniform = b->get_shift();
- bool symmetric = b->get_alt();
+ bool uniform = m->get_shift();
+ bool symmetric = m->get_alt();
dto = dto - (drag == DRAG_ALL || drag == DRAG_NODE_2D ? drag_from - drag_point_from : Vector2(0, 0));
diff --git a/methods.py b/methods.py
index 40f7deedbc..5af6c6aed0 100644
--- a/methods.py
+++ b/methods.py
@@ -1594,61 +1594,69 @@ def detect_visual_c_compiler_version(tools_env):
vc_chosen_compiler_index = -1
vc_chosen_compiler_str = ""
- # find() works with -1 so big ifs bellow are needed... the simplest solution, in fact
- # First test if amd64 and amd64_x86 compilers are present in the path
- vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64;")
- if(vc_amd64_compiler_detection_index > -1):
- vc_chosen_compiler_index = vc_amd64_compiler_detection_index
- vc_chosen_compiler_str = "amd64"
-
- vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64_x86;")
- if(vc_amd64_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
- vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
- vc_chosen_compiler_str = "amd64_x86"
-
- # Now check the 32 bit compilers
- vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN;")
- if(vc_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
- vc_chosen_compiler_index = vc_x86_compiler_detection_index
- vc_chosen_compiler_str = "x86"
-
- vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR'] + "BIN\\x86_amd64;")
- if(vc_x86_amd64_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
- vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
- vc_chosen_compiler_str = "x86_amd64"
-
- # Newer versions have a different path available
- vc_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X64;")
- if(vc_amd64_compiler_detection_index > -1):
- vc_chosen_compiler_index = vc_amd64_compiler_detection_index
- vc_chosen_compiler_str = "amd64"
-
- vc_amd64_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X86;")
- if(vc_amd64_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
- vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
- vc_chosen_compiler_str = "amd64_x86"
-
- vc_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X86;")
- if(vc_x86_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
- vc_chosen_compiler_index = vc_x86_compiler_detection_index
- vc_chosen_compiler_str = "x86"
-
- vc_x86_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X64;")
- if(vc_x86_amd64_compiler_detection_index > -1
- and (vc_chosen_compiler_index == -1
- or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
- vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
- vc_chosen_compiler_str = "x86_amd64"
+ # Start with Pre VS 2017 checks which uses VCINSTALLDIR:
+ if 'VCINSTALLDIR' in tools_env:
+ # print "Checking VCINSTALLDIR"
+
+ # find() works with -1 so big ifs bellow are needed... the simplest solution, in fact
+ # First test if amd64 and amd64_x86 compilers are present in the path
+ vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64;")
+ if(vc_amd64_compiler_detection_index > -1):
+ vc_chosen_compiler_index = vc_amd64_compiler_detection_index
+ vc_chosen_compiler_str = "amd64"
+
+ vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64_x86;")
+ if(vc_amd64_x86_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
+ vc_chosen_compiler_str = "amd64_x86"
+
+ # Now check the 32 bit compilers
+ vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN;")
+ if(vc_x86_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_x86_compiler_detection_index
+ vc_chosen_compiler_str = "x86"
+
+ vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR'] + "BIN\\x86_amd64;")
+ if(vc_x86_amd64_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
+ vc_chosen_compiler_str = "x86_amd64"
+
+ # and for VS 2017 and newer we check VCTOOLSINSTALLDIR:
+ if 'VCTOOLSINSTALLDIR' in tools_env:
+ # print "Checking VCTOOLSINSTALLDIR"
+
+ # Newer versions have a different path available
+ vc_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X64;")
+ if(vc_amd64_compiler_detection_index > -1):
+ vc_chosen_compiler_index = vc_amd64_compiler_detection_index
+ vc_chosen_compiler_str = "amd64"
+
+ vc_amd64_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X86;")
+ if(vc_amd64_x86_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
+ vc_chosen_compiler_str = "amd64_x86"
+
+ vc_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X86;")
+ if(vc_x86_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_x86_compiler_detection_index
+ vc_chosen_compiler_str = "x86"
+
+ vc_x86_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X64;")
+ if(vc_x86_amd64_compiler_detection_index > -1
+ and (vc_chosen_compiler_index == -1
+ or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
+ vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
+ vc_chosen_compiler_str = "x86_amd64"
# debug help
# print vc_amd64_compiler_detection_index
diff --git a/modules/gdnative/godot/godot_array.cpp b/modules/gdnative/godot/godot_array.cpp
index 65353c5b0f..bf2ef35972 100644
--- a/modules/gdnative/godot/godot_array.cpp
+++ b/modules/gdnative/godot/godot_array.cpp
@@ -139,13 +139,9 @@ void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godo
a->operator[](p_idx) = *val;
}
-godot_variant GDAPI godot_array_get(const godot_array *p_arr, const godot_int p_idx) {
- godot_variant raw_dest;
- Variant *dest = (Variant *)&raw_dest;
- memnew_placement(dest, Variant);
- const Array *a = (const Array *)p_arr;
- *dest = a->operator[](p_idx);
- return raw_dest;
+godot_variant GDAPI *godot_array_get(const godot_array *p_arr, const godot_int p_idx) {
+ Array *a = (Array *)p_arr;
+ return (godot_variant *)&a->operator[](p_idx);
}
void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value) {
diff --git a/modules/gdnative/godot/godot_array.h b/modules/gdnative/godot/godot_array.h
index 29a76304d0..f7150950fc 100644
--- a/modules/gdnative/godot/godot_array.h
+++ b/modules/gdnative/godot/godot_array.h
@@ -59,7 +59,7 @@ void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_
void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value);
-godot_variant GDAPI godot_array_get(const godot_array *p_arr, const godot_int p_idx);
+godot_variant GDAPI *godot_array_get(const godot_array *p_arr, const godot_int p_idx);
void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value);
diff --git a/modules/gdnative/godot/godot_dictionary.cpp b/modules/gdnative/godot/godot_dictionary.cpp
index dda245e59e..b98ee5b5c9 100644
--- a/modules/gdnative/godot/godot_dictionary.cpp
+++ b/modules/gdnative/godot/godot_dictionary.cpp
@@ -101,13 +101,10 @@ godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self) {
return dest;
}
-godot_variant GDAPI godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) {
- godot_variant raw_dest;
- Variant *dest = (Variant *)&raw_dest;
- const Dictionary *dict = (const Dictionary *)p_dict;
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) {
+ Dictionary *dict = (Dictionary *)p_dict;
const Variant *key = (const Variant *)p_key;
- *dest = dict->operator[](*key);
- return raw_dest;
+ return (godot_variant *)&dict->operator[](*key);
}
godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b) {
diff --git a/modules/gdnative/godot/godot_dictionary.h b/modules/gdnative/godot/godot_dictionary.h
index 9f6de77aac..42f7f872a1 100644
--- a/modules/gdnative/godot/godot_dictionary.h
+++ b/modules/gdnative/godot/godot_dictionary.h
@@ -68,7 +68,7 @@ godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self);
godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self);
-godot_variant GDAPI godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b);
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 5dc0fb08b1..0d9750d701 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -604,7 +604,12 @@ static int frame_count = 0;
glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES,
GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
- iphone_main(backingWidth, backingHeight, gargc, gargv);
+ int err = iphone_main(backingWidth, backingHeight, gargc, gargv);
+ if (err != 0) {
+ // bail, things did not go very well for us, should probably output a message on screen with our error code...
+ exit(0);
+ return;
+ };
view_controller = [[ViewController alloc] init];
view_controller.view = glView;
@@ -668,6 +673,7 @@ static int frame_count = 0;
isAdvertisingTrackingEnabled]];
#endif
+
};
- (void)applicationWillTerminate:(UIApplication *)application {
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index 3e95d1a706..7023021c66 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -196,8 +196,8 @@ bool OSIPhone::iterate() {
void OSIPhone::key(uint32_t p_key, bool p_pressed) {
Ref<InputEventKey> ev;
- ev.instance()
- ev->set_echo(false);
+ ev.instance();
+ ev->set_echo(false);
ev->set_pressed(p_pressed);
ev->set_scancode(p_key);
ev->set_unicode(p_key);
@@ -207,7 +207,7 @@ void OSIPhone::key(uint32_t p_key, bool p_pressed) {
void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_doubleclick, bool p_use_as_mouse) {
if (!GLOBAL_DEF("debug/disable_touch", false)) {
- Ref<InputEventSreenTouch> ev;
+ Ref<InputEventScreenTouch> ev;
ev.instance();
ev->set_index(p_idx);
@@ -216,7 +216,7 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_
queue_event(ev);
};
- mouse_list->is_pressed()[p_idx] = p_pressed;
+ mouse_list.pressed[p_idx] = p_pressed;
if (p_use_as_mouse) {
@@ -225,10 +225,10 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_
// swaped it for tilted screen
//ev->get_pos().x = ev.mouse_button.global_x = video_mode.height - p_y;
//ev->get_pos().y = ev.mouse_button.global_y = p_x;
- ev->set_pos(Vector2(ev.mouse_button.global_x, ev.mouse_button.global_y));
- ev->set_global_pos(Vector2(ev.mouse_button.global_x, ev.mouse_button.global_y));
+ ev->set_pos(Vector2(video_mode.height - p_y, p_x));
+ ev->set_global_pos(Vector2(video_mode.height - p_y, p_x));
- //mouse_list->is_pressed()[p_idx] = p_pressed;
+ //mouse_list.pressed[p_idx] = p_pressed;
input->set_mouse_position(ev->get_pos());
ev->set_button_index(BUTTON_LEFT);
@@ -278,7 +278,7 @@ void OSIPhone::touches_cancelled() {
for (int i = 0; i < MAX_MOUSE_COUNT; i++) {
- if (mouse_list->is_pressed()[i]) {
+ if (mouse_list.pressed[i]) {
// send a mouse_up outside the screen
mouse_button(i, -1, -1, false, false, false);
@@ -398,7 +398,7 @@ Point2 OSIPhone::get_mouse_position() const {
int OSIPhone::get_mouse_button_state() const {
- return mouse_list->is_pressed()[0];
+ return mouse_list.pressed[0];
};
void OSIPhone::set_window_title(const String &p_title){};
diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp
index 7c8f09b27b..51aba9b7fd 100644
--- a/platform/uwp/app.cpp
+++ b/platform/uwp/app.cpp
@@ -259,45 +259,48 @@ void App::pointer_event(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Cor
int but = _get_button(point);
if (_is_touch(point)) {
- Ref<InputEvent> event;
- event.type = InputEvent::SCREEN_TOUCH;
- event.device = 0;
- event.screen_touch->is_pressed() = p_pressed;
- event.screen_touch.x = pos.X;
- event.screen_touch.y = pos.Y;
- event.screen_touch.index = _get_finger(point->PointerId);
-
- last_touch_x[event.screen_touch.index] = pos.X;
- last_touch_y[event.screen_touch.index] = pos.Y;
-
- os->input_event(event);
+ Ref<InputEventScreenTouch> screen_touch;
+ screen_touch.instance();
+ screen_touch->set_device(0);
+ screen_touch->set_pressed(p_pressed);
+ screen_touch->set_pos(Vector2(pos.X, pos.Y));
+ screen_touch->set_index(_get_finger(point->PointerId));
+
+ last_touch_x[screen_touch->get_index()] = pos.X;
+ last_touch_y[screen_touch->get_index()] = pos.Y;
+
+ os->input_event(screen_touch);
if (number_of_contacts > 1)
return;
}; // fallthrought of sorts
- Ref<InputEvent> event;
- event.type = InputEvent::MOUSE_BUTTON;
- event.device = 0;
- event->is_pressed() = p_pressed;
- event->get_button_index() = but;
- event->get_pos().x = pos.X;
- event->get_pos().y = pos.Y;
- event.mouse_button.global_x = pos.X;
- event.mouse_button.global_y = pos.Y;
+ Ref<InputEventMouseButton> mouse_button;
+ mouse_button.instance();
+ mouse_button->set_device(0);
+ mouse_button->set_pressed(p_pressed);
+ mouse_button->set_button_index(but);
+ mouse_button->set_pos(Vector2(pos.X, pos.Y));
+ mouse_button->set_global_pos(Vector2(pos.X, pos.Y));
if (p_is_wheel) {
if (point->Properties->MouseWheelDelta > 0) {
- event->get_button_index() = point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_UP;
+ mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_UP);
} else if (point->Properties->MouseWheelDelta < 0) {
- event->get_button_index() = point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_LEFT : BUTTON_WHEEL_DOWN;
+ mouse_button->set_button_index(point->Properties->IsHorizontalMouseWheel ? BUTTON_WHEEL_LEFT : BUTTON_WHEEL_DOWN);
}
}
last_touch_x[31] = pos.X;
last_touch_y[31] = pos.Y;
- os->input_event(event);
+ os->input_event(mouse_button);
+
+ if (p_is_wheel) {
+ // Send release for mouse wheel
+ mouse_button->set_pressed(false);
+ os->input_event(mouse_button);
+ }
};
void App::OnPointerPressed(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args) {
@@ -349,16 +352,14 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Co
if (point->IsInContact && _is_touch(point)) {
- InputEvent event;
- event.type = Ref<InputEvent>::SCREEN_DRAG;
- event.device = 0;
- event.screen_drag.x = pos.X;
- event.screen_drag.y = pos.Y;
- event.screen_drag.index = _get_finger(point->PointerId);
- event.screen_drag.relative_x = event.screen_drag.x - last_touch_x[event.screen_drag.index];
- event.screen_drag.relative_y = event.screen_drag.y - last_touch_y[event.screen_drag.index];
+ Ref<InputEventScreenDrag> screen_drag;
+ screen_drag.instance();
+ screen_drag->set_device(0);
+ screen_drag->set_pos(Vector2(pos.X, pos.Y));
+ screen_drag->set_index(_get_finger(point->PointerId));
+ screen_drag->set_relative(Vector2(screen_drag->get_pos().x - last_touch_x[screen_drag->get_index()], screen_drag->get_pos().y - last_touch_y[screen_drag->get_index()]));
- os->input_event(event);
+ os->input_event(screen_drag);
if (number_of_contacts > 1)
return;
@@ -368,19 +369,16 @@ void App::OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Co
if (os->get_mouse_mode() == OS::MouseMode::MOUSE_MODE_CAPTURED)
return;
- InputEvent event;
- event.type = Ref<InputEvent>::MOUSE_MOTION;
- event.device = 0;
- event.mouse_motion.x = pos.X;
- event.mouse_motion.y = pos.Y;
- event.mouse_motion.global_x = pos.X;
- event.mouse_motion.global_y = pos.Y;
- event->get_relative().x = pos.X - last_touch_x[31];
- event->get_relative().y = pos.Y - last_touch_y[31];
+ Ref<InputEventMouseMotion> mouse_motion;
+ mouse_motion.instance();
+ mouse_motion->set_device(0);
+ mouse_motion->set_pos(Vector2(pos.X, pos.Y));
+ mouse_motion->set_global_pos(Vector2(pos.X, pos.Y));
+ mouse_motion->set_relative(Vector2(pos.X - last_touch_x[31], pos.Y - last_touch_y[31]));
last_mouse_pos = pos;
- os->input_event(event);
+ os->input_event(mouse_motion);
}
void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) {
@@ -393,47 +391,40 @@ void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) {
pos.X = last_mouse_pos.X + args->MouseDelta.X;
pos.Y = last_mouse_pos.Y + args->MouseDelta.Y;
- InputEvent event;
- event.type = Ref<InputEvent>::MOUSE_MOTION;
- event.device = 0;
- event.mouse_motion.x = pos.X;
- event.mouse_motion.y = pos.Y;
- event.mouse_motion.global_x = pos.X;
- event.mouse_motion.global_y = pos.Y;
- event->get_relative().x = args->MouseDelta.X;
- event->get_relative().y = args->MouseDelta.Y;
+ Ref<InputEventMouseMotion> mouse_motion;
+ mouse_motion.instance();
+ mouse_motion->set_device(0);
+ mouse_motion->set_pos(Vector2(pos.X, pos.Y));
+ mouse_motion->set_global_pos(Vector2(pos.X, pos.Y));
+ mouse_motion->set_relative(Vector2(args->MouseDelta.X, args->MouseDelta.Y));
last_mouse_pos = pos;
- os->input_event(event);
+ os->input_event(mouse_motion);
}
void App::key_event(Windows::UI::Core::CoreWindow ^ sender, bool p_pressed, Windows::UI::Core::KeyEventArgs ^ key_args, Windows::UI::Core::CharacterReceivedEventArgs ^ char_args) {
OSUWP::KeyEvent ke;
- InputModifierState mod;
- mod.meta = false;
- mod.command = false;
- mod.control = sender->GetAsyncKeyState(VirtualKey::Control) == CoreVirtualKeyStates::Down;
- mod.alt = sender->GetAsyncKeyState(VirtualKey::Menu) == CoreVirtualKeyStates::Down;
- mod.shift = sender->GetAsyncKeyState(VirtualKey::Shift) == CoreVirtualKeyStates::Down;
- ke.mod_state = mod;
+ ke.control = sender->GetAsyncKeyState(VirtualKey::Control) == CoreVirtualKeyStates::Down;
+ ke.alt = sender->GetAsyncKeyState(VirtualKey::Menu) == CoreVirtualKeyStates::Down;
+ ke.shift = sender->GetAsyncKeyState(VirtualKey::Shift) == CoreVirtualKeyStates::Down;
- ke->is_pressed() = p_pressed;
+ ke.pressed = p_pressed;
if (key_args != nullptr) {
ke.type = OSUWP::KeyEvent::MessageType::KEY_EVENT_MESSAGE;
ke.unicode = 0;
- ke->get_scancode() = KeyMappingWindows::get_keysym((unsigned int)key_args->VirtualKey);
+ ke.scancode = KeyMappingWindows::get_keysym((unsigned int)key_args->VirtualKey);
ke.echo = (!p_pressed && !key_args->KeyStatus.IsKeyReleased) || (p_pressed && key_args->KeyStatus.WasKeyDown);
} else {
ke.type = OSUWP::KeyEvent::MessageType::CHAR_EVENT_MESSAGE;
ke.unicode = char_args->KeyCode;
- ke->get_scancode() = 0;
+ ke.scancode = 0;
ke.echo = (!p_pressed && !char_args->KeyStatus.IsKeyReleased) || (p_pressed && char_args->KeyStatus.WasKeyDown);
}
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index f1e0716241..baff7f9788 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -49,6 +49,8 @@ def configure(env):
arch = ""
env['ENV'] = os.environ
+ vc_base_path = os.environ['VCTOOLSINSTALLDIR'] if "VCTOOLSINSTALLDIR" in os.environ else os.environ['VCINSTALLDIR']
+
# ANGLE
angle_root = os.getenv("ANGLE_SRC_PATH")
env.Append(CPPPATH=[angle_root + '/include'])
@@ -65,7 +67,7 @@ def configure(env):
arch = "arm"
env["bits"] = "32"
env.Append(LINKFLAGS=['/MACHINE:ARM'])
- env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/arm'])
+ env.Append(LIBPATH=[vc_base_path + 'lib/store/arm'])
angle_build_cmd += "ARM"
@@ -92,7 +94,7 @@ def configure(env):
env.Append(CPPFLAGS=['/DPNG_ABORT=abort'])
env.Append(LINKFLAGS=['/MACHINE:X86'])
- env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store'])
+ env.Append(LIBPATH=[vc_base_path + 'lib/store'])
env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_Win32/lib'])
else:
@@ -107,10 +109,9 @@ def configure(env):
env.Append(CPPPATH=['#platform/uwp', '#drivers/windows'])
env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"'])
env.Append(CPPFLAGS=['/D', '__WRL_NO_DEFAULT_LIB__', '/D', 'WIN32'])
- env.Append(CPPFLAGS=['/FU', os.environ['VCINSTALLDIR'] + 'lib/store/references/platform.winmd'])
- env.Append(CPPFLAGS=['/AI', os.environ['VCINSTALLDIR'] + 'lib/store/references'])
-
- env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/references'])
+
+ env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/store/references'])
+ env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/x86/store/references'])
if (env["target"] == "release"):
@@ -133,7 +134,7 @@ def configure(env):
env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'))
env.Append(CXXFLAGS=string.split('/ZW /FS'))
- env.Append(CCFLAGS=['/AI', os.environ['VCINSTALLDIR'] + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral'])
+ env.Append(CCFLAGS=['/AI', vc_base_path + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral'])
env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"]
env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"]
diff --git a/platform/uwp/gl_context_egl.cpp b/platform/uwp/gl_context_egl.cpp
index d79ce75db5..57c4c5d572 100644
--- a/platform/uwp/gl_context_egl.cpp
+++ b/platform/uwp/gl_context_egl.cpp
@@ -97,7 +97,7 @@ Error ContextEGL::initialize() {
EGLContext context = EGL_NO_CONTEXT;
EGLSurface surface = EGL_NO_SURFACE;
EGLConfig config = nullptr;
- EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE, EGL_NONE };
+ EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE, EGL_NONE };
try {
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 47f4b3f3c8..28aaf9161b 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -330,16 +330,9 @@ String OSUWP::get_clipboard() const {
return "";
};
-void OSUWP::input_event(Ref<InputEvent> &p_event) {
+void OSUWP::input_event(const Ref<InputEvent> &p_event) {
input->parse_input_event(p_event);
-
- if (p_event.type == Ref<InputEvent>::MOUSE_BUTTON && p_event->is_pressed() && p_event->get_button_index() > 3) {
-
- //send release for mouse wheel
- p_event->is_pressed() = false;
- input->parse_input_event(p_event);
- }
};
void OSUWP::delete_main_loop() {
@@ -663,16 +656,18 @@ void OSUWP::process_key_events() {
for (int i = 0; i < key_event_pos; i++) {
KeyEvent &kev = key_event_buffer[i];
- Ref<InputEvent> iev;
-
- iev.type = Ref<InputEvent>::KEY;
- iev.key.mod = kev.mod_state;
- iev->is_echo() = kev.echo;
- iev->get_scancode() = kev->get_scancode();
- iev.key.unicode = kev.unicode;
- iev->is_pressed() = kev->is_pressed();
- input_event(iev);
+ Ref<InputEventKey> key_event;
+ key_event.instance();
+ key_event->set_alt(kev.alt);
+ key_event->set_shift(kev.shift);
+ key_event->set_control(kev.control);
+ key_event->set_echo(kev.echo);
+ key_event->set_scancode(kev.scancode);
+ key_event->set_unicode(kev.unicode);
+ key_event->set_pressed(kev.pressed);
+
+ input_event(key_event);
}
key_event_pos = 0;
}
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index d2a51aad4c..45b8eefdee 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -63,7 +63,7 @@ public:
CHAR_EVENT_MESSAGE
};
- InputModifierState mod_state;
+ bool alt, shift, control;
MessageType type;
bool pressed;
unsigned int scancode;
@@ -257,7 +257,7 @@ public:
virtual bool get_swap_ok_cancel() { return true; }
- void input_event(Ref<InputEvent> &p_event);
+ void input_event(const Ref<InputEvent> &p_event);
virtual PowerState get_power_state();
virtual int get_power_seconds_left();
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index ba5db05dab..830aae5515 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -565,7 +565,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
ScreenToClient(hWnd, &coords);
- mb->set_pos(coords);
+ mb->set_pos(Vector2(coords.x, coords.y));
}
if (main_loop) {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index bd5acde417..6cbdd58830 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -68,8 +68,7 @@ class OS_Windows : public OS {
struct KeyEvent {
- InputModifierState mod_state;
- bool alt, shift, ctrl, meta;
+ bool alt, shift, control, meta;
UINT uMsg;
WPARAM wParam;
LPARAM lParam;
diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp
index 9ada68f5dc..b17192fe4f 100644
--- a/scene/gui/tree.cpp
+++ b/scene/gui/tree.cpp
@@ -3032,7 +3032,7 @@ void Tree::ensure_cursor_is_visible() {
int screenh = get_size().height - h_scroll->get_combined_minimum_size().height;
if (ofs + h > v_scroll->get_value() + screenh)
- v_scroll->call_deferred("set_val", ofs - screenh + h);
+ v_scroll->call_deferred("set_value", ofs - screenh + h);
else if (ofs < v_scroll->get_value())
v_scroll->set_value(ofs);
}
diff --git a/scene/resources/texture.cpp b/scene/resources/texture.cpp
index beccbb1ba8..bc8deb501e 100644
--- a/scene/resources/texture.cpp
+++ b/scene/resources/texture.cpp
@@ -402,7 +402,7 @@ Image::Format StreamTexture::get_format() const {
return format;
}
-Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &flags, Ref<Image> image, int p_size_limit) {
+Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &flags, Ref<Image> &image, int p_size_limit) {
ERR_FAIL_COND_V(image.is_null(), ERR_INVALID_PARAMETER);
@@ -498,6 +498,7 @@ Error StreamTexture::_load_data(const String &p_path, int &tw, int &th, int &fla
memdelete(f);
ERR_FAIL_COND_V(img->empty(), ERR_FILE_CORRUPT);
}
+
total_size += img->get_data().size();
mipmap_images.push_back(img);
diff --git a/scene/resources/texture.h b/scene/resources/texture.h
index 3aa007fa00..07416529ae 100644
--- a/scene/resources/texture.h
+++ b/scene/resources/texture.h
@@ -170,7 +170,7 @@ public:
};
private:
- Error _load_data(const String &p_path, int &tw, int &th, int &flags, Ref<Image> image, int p_size_limit = 0);
+ Error _load_data(const String &p_path, int &tw, int &th, int &flags, Ref<Image> &image, int p_size_limit = 0);
String path_to_file;
RID texture;
Image::Format format;