summaryrefslogtreecommitdiff
path: root/platform/javascript
diff options
context:
space:
mode:
authorAndreas Haas <liu.gam3@gmail.com>2017-03-26 15:59:13 +0200
committerAndreas Haas <liu.gam3@gmail.com>2017-03-26 15:59:32 +0200
commitc0b67568757ccc22811e16348713ef3119e18f3e (patch)
treec2f13f324454478a76c623141611f79628d52ce6 /platform/javascript
parenta0b0dff6fdbdc4be78087aa572f3da5dbb8daa01 (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/javascript')
-rw-r--r--platform/javascript/os_javascript.cpp18
-rw-r--r--platform/javascript/os_javascript.h1
2 files changed, 3 insertions, 16 deletions
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 83072c30aa..08c17e1e9c 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -520,7 +520,6 @@ void OS_JavaScript::main_loop_focusin() {
void OS_JavaScript::push_input(const InputEvent &p_ev) {
InputEvent ev = p_ev;
- ev.ID = last_id++;
if (ev.type == InputEvent::MOUSE_MOTION) {
input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y));
} else if (ev.type == InputEvent::MOUSE_BUTTON) {
@@ -540,7 +539,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
//end all if exist
InputEvent ev;
ev.type = InputEvent::MOUSE_BUTTON;
- ev.ID = last_id++;
ev.mouse_button.button_index = BUTTON_LEFT;
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
ev.mouse_button.pressed = false;
@@ -554,7 +552,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
InputEvent ev;
ev.type = InputEvent::SCREEN_TOUCH;
- ev.ID = last_id++;
ev.screen_touch.index = touch[i].id;
ev.screen_touch.pressed = false;
ev.screen_touch.x = touch[i].pos.x;
@@ -573,7 +570,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
//send mouse
InputEvent ev;
ev.type = InputEvent::MOUSE_BUTTON;
- ev.ID = last_id++;
ev.mouse_button.button_index = BUTTON_LEFT;
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
ev.mouse_button.pressed = true;
@@ -590,7 +586,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
InputEvent ev;
ev.type = InputEvent::SCREEN_TOUCH;
- ev.ID = last_id++;
ev.screen_touch.index = touch[i].id;
ev.screen_touch.pressed = true;
ev.screen_touch.x = touch[i].pos.x;
@@ -605,7 +600,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
//send mouse, should look for point 0?
InputEvent ev;
ev.type = InputEvent::MOUSE_MOTION;
- ev.ID = last_id++;
ev.mouse_motion.button_mask = BUTTON_MASK_LEFT;
ev.mouse_motion.x = p_points[0].pos.x;
ev.mouse_motion.y = p_points[0].pos.y;
@@ -638,7 +632,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
InputEvent ev;
ev.type = InputEvent::SCREEN_DRAG;
- ev.ID = last_id++;
ev.screen_drag.index = touch[i].id;
ev.screen_drag.x = p_points[idx].pos.x;
ev.screen_drag.y = p_points[idx].pos.y;
@@ -655,7 +648,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
//end all if exist
InputEvent ev;
ev.type = InputEvent::MOUSE_BUTTON;
- ev.ID = last_id++;
ev.mouse_button.button_index = BUTTON_LEFT;
ev.mouse_button.button_mask = BUTTON_MASK_LEFT;
ev.mouse_button.pressed = false;
@@ -669,7 +661,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
InputEvent ev;
ev.type = InputEvent::SCREEN_TOUCH;
- ev.ID = last_id++;
ev.screen_touch.index = touch[i].id;
ev.screen_touch.pressed = false;
ev.screen_touch.x = touch[i].pos.x;
@@ -689,7 +680,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
InputEvent ev;
ev.type = InputEvent::SCREEN_TOUCH;
- ev.ID = last_id++;
ev.screen_touch.index = tp.id;
ev.screen_touch.pressed = true;
ev.screen_touch.x = tp.pos.x;
@@ -704,7 +694,6 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP
InputEvent ev;
ev.type = InputEvent::SCREEN_TOUCH;
- ev.ID = last_id++;
ev.screen_touch.index = touch[i].id;
ev.screen_touch.pressed = false;
ev.screen_touch.x = touch[i].pos.x;
@@ -790,9 +779,9 @@ void OS_JavaScript::process_joypads() {
InputDefault::JoyAxis jx;
jx.min = 0;
jx.value = value;
- last_id = input->joy_axis(last_id, i, j, jx);
+ input->joy_axis(i, j, jx);
} else {
- last_id = input->joy_button(last_id, i, j, value);
+ input->joy_button(i, j, value);
}
}
for (int j = 0; j < num_axes; j++) {
@@ -800,7 +789,7 @@ void OS_JavaScript::process_joypads() {
InputDefault::JoyAxis jx;
jx.min = -1;
jx.value = state.axis[j];
- last_id = input->joy_axis(last_id, i, j, jx);
+ input->joy_axis(i, j, jx);
}
}
}
@@ -844,7 +833,6 @@ OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func, void *p_gfx_init_ud, G
gfx_init_ud = p_gfx_init_ud;
last_button_mask = 0;
main_loop = NULL;
- last_id = 1;
gl_extensions = NULL;
window_maximized = false;
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index b16918b2da..d21834b3dc 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -58,7 +58,6 @@ private:
Vector<TouchPos> touch;
Point2 last_mouse;
int last_button_mask;
- unsigned int last_id;
GFXInitFunc gfx_init_func;
void *gfx_init_ud;