Bläddra i källkod

Android input fix for samples

Panagiotis Christopoulos Charitos 3 år sedan
förälder
incheckning
751abeac86

+ 2 - 0
AnKi/Input/Input.h

@@ -132,6 +132,8 @@ public:
 		return m_touchPointerPosWin[p];
 	}
 
+	Bool hasTouchDevice() const;
+
 protected:
 	NativeWindow* m_nativeWindow = nullptr;
 	HeapAllocator<U8> m_alloc;

+ 5 - 0
AnKi/Input/InputAndroid.cpp

@@ -85,6 +85,11 @@ void Input::hideCursor(Bool hide)
 	// do nothing
 }
 
+Bool Input::hasTouchDevice() const
+{
+	return true;
+}
+
 Error InputAndroid::init()
 {
 	ANKI_ASSERT(m_nativeWindow);

+ 5 - 0
AnKi/Input/InputDummy.cpp

@@ -54,4 +54,9 @@ void Input::hideCursor(Bool hide)
 	// Nothing
 }
 
+Bool Input::hasTouchDevice() const
+{
+	return false;
+}
+
 } // end namespace anki

+ 5 - 0
AnKi/Input/InputSdl.cpp

@@ -97,6 +97,11 @@ void Input::hideCursor(Bool hide)
 	SDL_ShowCursor(!hide);
 }
 
+Bool Input::hasTouchDevice() const
+{
+	return false;
+}
+
 Error InputSdl::init()
 {
 	ANKI_ASSERT(m_nativeWindow);

+ 1 - 1
Samples/Common/SampleApp.cpp

@@ -130,7 +130,7 @@ Error SampleApp::userMainLoop(Bool& quit, Second elapsedTime)
 		mousePosOn1stClick = in.getMousePosition();
 	}
 
-	if(in.getMouseButton(MouseButton::RIGHT))
+	if(in.getMouseButton(MouseButton::RIGHT) || in.hasTouchDevice())
 	{
 		in.hideCursor(true);