Browse Source

Implement touch-screen check in HTML5 platform

L. Krause 8 years ago
parent
commit
0c693595d6
1 changed files with 5 additions and 1 deletions
  1. 5 1
      platform/javascript/os_javascript.cpp

+ 5 - 1
platform/javascript/os_javascript.cpp

@@ -857,7 +857,11 @@ void OS_JavaScript::process_accelerometer(const Vector3 &p_accelerometer) {
 
 
 bool OS_JavaScript::has_touchscreen_ui_hint() const {
 bool OS_JavaScript::has_touchscreen_ui_hint() const {
 
 
-	return false; //???
+	/* clang-format off */
+	return EM_ASM_INT_V(
+		return 'ontouchstart' in window;
+	);
+	/* clang-format on */
 }
 }
 
 
 void OS_JavaScript::main_loop_request_quit() {
 void OS_JavaScript::main_loop_request_quit() {