diff options
author | Andreas Haas <liu.gam3@gmail.com> | 2017-03-26 15:59:13 +0200 |
---|---|---|
committer | Andreas Haas <liu.gam3@gmail.com> | 2017-03-26 15:59:32 +0200 |
commit | c0b67568757ccc22811e16348713ef3119e18f3e (patch) | |
tree | c2f13f324454478a76c623141611f79628d52ce6 /platform/uwp | |
parent | a0b0dff6fdbdc4be78087aa572f3da5dbb8daa01 (diff) |
Input: Remove usage of platform dependent event IDs.
The ID property for InputEvents is set by `SceneTree` when sending the event down the tree.
So there's no need for the platform specific code to set this value when it will later be overriden anyway...
Diffstat (limited to 'platform/uwp')
-rw-r--r-- | platform/uwp/joypad_uwp.cpp | 18 | ||||
-rw-r--r-- | platform/uwp/joypad_uwp.h | 2 | ||||
-rw-r--r-- | platform/uwp/os_uwp.cpp | 6 | ||||
-rw-r--r-- | platform/uwp/os_uwp.h | 1 |
4 files changed, 10 insertions, 17 deletions
diff --git a/platform/uwp/joypad_uwp.cpp b/platform/uwp/joypad_uwp.cpp index dd57ed94ae..7860994a79 100644 --- a/platform/uwp/joypad_uwp.cpp +++ b/platform/uwp/joypad_uwp.cpp @@ -40,7 +40,7 @@ void JoypadUWP::register_events() { ref new EventHandler<Gamepad ^>(this, &JoypadUWP::OnGamepadRemoved); } -uint32_t JoypadUWP::process_controllers(uint32_t p_last_id) { +void JoypadUWP::process_controllers() { for (int i = 0; i < MAX_CONTROLLERS; i++) { @@ -55,23 +55,21 @@ uint32_t JoypadUWP::process_controllers(uint32_t p_last_id) { int button_mask = (int)GamepadButtons::Menu; for (int j = 0; j < 14; j++) { - p_last_id = input->joy_button(p_last_id, controllers[i].id, j, (int)reading.Buttons & button_mask); + input->joy_button(controllers[i].id, j, (int)reading.Buttons & button_mask); button_mask *= 2; } - p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_0, axis_correct(reading.LeftThumbstickX)); - p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_1, axis_correct(reading.LeftThumbstickY, true)); - p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_2, axis_correct(reading.RightThumbstickX)); - p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_3, axis_correct(reading.RightThumbstickY, true)); - p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_4, axis_correct(reading.LeftTrigger, false, true)); - p_last_id = input->joy_axis(p_last_id, controllers[i].id, JOY_AXIS_5, axis_correct(reading.RightTrigger, false, true)); + input->joy_axis(controllers[i].id, JOY_AXIS_0, axis_correct(reading.LeftThumbstickX)); + input->joy_axis(controllers[i].id, JOY_AXIS_1, axis_correct(reading.LeftThumbstickY, true)); + input->joy_axis(controllers[i].id, JOY_AXIS_2, axis_correct(reading.RightThumbstickX)); + input->joy_axis(controllers[i].id, JOY_AXIS_3, axis_correct(reading.RightThumbstickY, true)); + input->joy_axis(controllers[i].id, JOY_AXIS_4, axis_correct(reading.LeftTrigger, false, true)); + input->joy_axis(controllers[i].id, JOY_AXIS_5, axis_correct(reading.RightTrigger, false, true)); break; } } } - - return p_last_id; } JoypadUWP::JoypadUWP() { diff --git a/platform/uwp/joypad_uwp.h b/platform/uwp/joypad_uwp.h index e5a961e70e..a2572eae3d 100644 --- a/platform/uwp/joypad_uwp.h +++ b/platform/uwp/joypad_uwp.h @@ -37,7 +37,7 @@ ref class JoypadUWP sealed { /* clang-format off */ internal: void register_events(); - uint32_t process_controllers(uint32_t p_last_id); + void process_controllers(); /* clang-format on */ JoypadUWP(); diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 19ed2b57a3..907156d280 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -344,15 +344,12 @@ String OSUWP::get_clipboard() const { void OSUWP::input_event(InputEvent &p_event) { - p_event.ID = ++last_id; - input->parse_input_event(p_event); if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.pressed && p_event.mouse_button.button_index > 3) { //send release for mouse wheel p_event.mouse_button.pressed = false; - p_event.ID = ++last_id; input->parse_input_event(p_event); } }; @@ -680,7 +677,7 @@ uint64_t OSUWP::get_ticks_usec() const { void OSUWP::process_events() { - last_id = joypad->process_controllers(last_id); + joypad->process_controllers(); process_key_events(); } @@ -907,7 +904,6 @@ OSUWP::OSUWP() { pressrc = 0; old_invalid = true; - last_id = 0; mouse_mode = MOUSE_MODE_VISIBLE; #ifdef STDOUT_FILE stdo = fopen("stdout.txt", "wb"); diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index ebbb8af39c..95b834acc4 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -92,7 +92,6 @@ private: bool outside; int old_x, old_y; Point2i center; - unsigned int last_id; VisualServer *visual_server; Rasterizer *rasterizer; PhysicsServer *physics_server; |