Browse Source

Merge pull request #35237 from akien-mga/emscripten-1.39.5-timestamp-removal

HTML5: Address removal of 'timestamp' in Emscripten 1.39.5
Rémi Verschelde 5 years ago
parent
commit
a6f3e1345c
2 changed files with 3 additions and 2 deletions
  1. 2 1
      platform/javascript/os_javascript.cpp
  2. 1 1
      platform/javascript/os_javascript.h

+ 2 - 1
platform/javascript/os_javascript.cpp

@@ -301,6 +301,7 @@ EM_BOOL OS_JavaScript::mouse_button_callback(int p_event_type, const EmscriptenM
 	ev->set_position(correct_canvas_position(p_event->canvasX, p_event->canvasY));
 	ev->set_position(correct_canvas_position(p_event->canvasX, p_event->canvasY));
 	ev->set_global_position(ev->get_position());
 	ev->set_global_position(ev->get_position());
 	dom2godot_mod(p_event, ev);
 	dom2godot_mod(p_event, ev);
+
 	switch (p_event->button) {
 	switch (p_event->button) {
 		case DOM_BUTTON_LEFT: ev->set_button_index(BUTTON_LEFT); break;
 		case DOM_BUTTON_LEFT: ev->set_button_index(BUTTON_LEFT); break;
 		case DOM_BUTTON_MIDDLE: ev->set_button_index(BUTTON_MIDDLE); break;
 		case DOM_BUTTON_MIDDLE: ev->set_button_index(BUTTON_MIDDLE); break;
@@ -312,7 +313,7 @@ EM_BOOL OS_JavaScript::mouse_button_callback(int p_event_type, const EmscriptenM
 
 
 	if (ev->is_pressed()) {
 	if (ev->is_pressed()) {
 
 
-		uint64_t diff = p_event->timestamp - os->last_click_ms;
+		double diff = emscripten_get_now() - os->last_click_ms;
 
 
 		if (ev->get_button_index() == os->last_click_button_index) {
 		if (ev->get_button_index() == os->last_click_button_index) {
 
 

+ 1 - 1
platform/javascript/os_javascript.h

@@ -55,7 +55,7 @@ class OS_JavaScript : public OS_Unix {
 	Point2 touches[32];
 	Point2 touches[32];
 
 
 	Point2i last_click_pos;
 	Point2i last_click_pos;
-	uint64_t last_click_ms;
+	double last_click_ms;
 	int last_click_button_index;
 	int last_click_button_index;
 
 
 	MainLoop *main_loop;
 	MainLoop *main_loop;