diff options
Diffstat (limited to 'core/os')
-rw-r--r-- | core/os/file_access.cpp | 4 | ||||
-rw-r--r-- | core/os/file_access.h | 2 | ||||
-rw-r--r-- | core/os/input.cpp | 4 | ||||
-rw-r--r-- | core/os/input_event.cpp | 11 | ||||
-rw-r--r-- | core/os/input_event.h | 1 | ||||
-rw-r--r-- | core/os/keyboard.h | 2 | ||||
-rw-r--r-- | core/os/main_loop.cpp | 2 | ||||
-rw-r--r-- | core/os/os.h | 3 |
8 files changed, 19 insertions, 10 deletions
diff --git a/core/os/file_access.cpp b/core/os/file_access.cpp index 3bd5ac3f41..9d1fefc925 100644 --- a/core/os/file_access.cpp +++ b/core/os/file_access.cpp @@ -475,9 +475,9 @@ void FileAccess::store_buffer(const uint8_t *p_src, int p_length) { store_8(p_src[i]); } -Vector<uint8_t> FileAccess::get_file_as_array(const String &p_file) { +Vector<uint8_t> FileAccess::get_file_as_array(const String &p_path) { - FileAccess *f = FileAccess::open(p_file, READ); + FileAccess *f = FileAccess::open(p_path, READ); ERR_FAIL_COND_V(!f, Vector<uint8_t>()); Vector<uint8_t> data; data.resize(f->get_len()); diff --git a/core/os/file_access.h b/core/os/file_access.h index 6d3e491167..beed7551fb 100644 --- a/core/os/file_access.h +++ b/core/os/file_access.h @@ -129,7 +129,7 @@ public: virtual void store_real(real_t p_real); virtual void store_string(const String &p_string); - virtual void store_line(const String &p_string); + virtual void store_line(const String &p_line); virtual void store_pascal_string(const String &p_string); virtual String get_pascal_string(); diff --git a/core/os/input.cpp b/core/os/input.cpp index a90a552d1d..c7b32b939a 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -83,8 +83,8 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("warp_mouse_pos", "to"), &Input::warp_mouse_pos); ClassDB::bind_method(D_METHOD("action_press", "action"), &Input::action_press); ClassDB::bind_method(D_METHOD("action_release", "action"), &Input::action_release); - ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image:Texture", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(Vector2())); - ClassDB::bind_method(D_METHOD("parse_input_event", "event:InputEvent"), &Input::parse_input_event); + ClassDB::bind_method(D_METHOD("set_custom_mouse_cursor", "image", "hotspot"), &Input::set_custom_mouse_cursor, DEFVAL(Vector2())); + ClassDB::bind_method(D_METHOD("parse_input_event", "event"), &Input::parse_input_event); BIND_CONSTANT(MOUSE_MODE_VISIBLE); BIND_CONSTANT(MOUSE_MODE_HIDDEN); diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 0a07b6b2b7..cb38eb67b6 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -134,12 +134,12 @@ void InputEvent::_bind_methods() { ClassDB::bind_method(D_METHOD("as_text"), &InputEvent::as_text); - ClassDB::bind_method(D_METHOD("action_match", "event:InputEvent"), &InputEvent::action_match); - ClassDB::bind_method(D_METHOD("shortcut_match", "event:InputEvent"), &InputEvent::shortcut_match); + ClassDB::bind_method(D_METHOD("action_match", "event"), &InputEvent::action_match); + ClassDB::bind_method(D_METHOD("shortcut_match", "event"), &InputEvent::shortcut_match); ClassDB::bind_method(D_METHOD("is_action_type"), &InputEvent::is_action_type); - ClassDB::bind_method(D_METHOD("xformed_by:InputEvent", "xform", "local_ofs"), &InputEvent::xformed_by, DEFVAL(Vector2())); + ClassDB::bind_method(D_METHOD("xformed_by", "xform", "local_ofs"), &InputEvent::xformed_by, DEFVAL(Vector2())); ADD_PROPERTY(PropertyInfo(Variant::INT, "device"), "set_device", "get_device"); } @@ -595,6 +595,11 @@ float InputEventJoypadMotion::get_axis_value() const { return axis_value; } +bool InputEventJoypadMotion::is_pressed() const { + + return Math::abs(axis_value) > 0.5f; +} + bool InputEventJoypadMotion::action_match(const Ref<InputEvent> &p_event) const { Ref<InputEventJoypadMotion> jm = p_event; diff --git a/core/os/input_event.h b/core/os/input_event.h index b120d4b840..d1fd7cc90f 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -348,6 +348,7 @@ public: void set_axis_value(float p_value); float get_axis_value() const; + virtual bool is_pressed() const; virtual bool action_match(const Ref<InputEvent> &p_event) const; virtual bool is_action_type() const { return true; } diff --git a/core/os/keyboard.h b/core/os/keyboard.h index 1ed93e3540..1ef26de183 100644 --- a/core/os/keyboard.h +++ b/core/os/keyboard.h @@ -324,7 +324,7 @@ enum KeyModifierMask { }; String keycode_get_string(uint32_t p_code); -bool keycode_has_unicode(uint32_t p_unicode); +bool keycode_has_unicode(uint32_t p_keycode); int find_keycode(const String &p_code); int keycode_get_count(); int keycode_get_value_by_index(int p_index); diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index 93658c07c2..248f5537c6 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -32,7 +32,7 @@ void MainLoop::_bind_methods() { - ClassDB::bind_method(D_METHOD("input_event", "ev:InputEvent"), &MainLoop::input_event); + ClassDB::bind_method(D_METHOD("input_event", "ev"), &MainLoop::input_event); ClassDB::bind_method(D_METHOD("input_text", "text"), &MainLoop::input_text); ClassDB::bind_method(D_METHOD("init"), &MainLoop::init); ClassDB::bind_method(D_METHOD("iteration", "delta"), &MainLoop::iteration); diff --git a/core/os/os.h b/core/os/os.h index 8e2257a0e4..4d64e4a9f0 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -63,6 +63,8 @@ class OS { void *_stack_bottom; public: + typedef void (*ImeCallback)(void *p_inp, String p_text, Point2 p_selection); + enum RenderThreadMode { RENDER_THREAD_UNSAFE, @@ -183,6 +185,7 @@ public: virtual bool get_borderless_window() { return 0; } virtual void set_ime_position(const Point2 &p_pos) {} + virtual void set_ime_intermediate_text_callback(ImeCallback p_callback, void *p_inp) {} virtual Error open_dynamic_library(const String p_path, void *&p_library_handle) { return ERR_UNAVAILABLE; } virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; } |