aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheBrokenRail <17478432+TheBrokenRail@users.noreply.github.com>2021-08-27 04:58:46 -0400
committerGitHub <noreply@github.com>2021-08-27 10:58:46 +0200
commitc26ff3476f5cce6c6ce2d6fa1b88c9dfff3674ca (patch)
tree3250ed07346eb1a1b0b1654028a4511b8a1dba36
parentda33f80bb8afa6c18ea047ca230cf5dce90c963d (diff)
downloadirrlicht-c26ff3476f5cce6c6ce2d6fa1b88c9dfff3674ca.tar.xz
CIrrDeviceLinux: Add support For TouchInput.touchedCount
-rw-r--r--source/Irrlicht/CIrrDeviceLinux.cpp11
-rw-r--r--source/Irrlicht/CIrrDeviceLinux.h4
-rw-r--r--source/Irrlicht/CMakeLists.txt6
3 files changed, 21 insertions, 0 deletions
diff --git a/source/Irrlicht/CIrrDeviceLinux.cpp b/source/Irrlicht/CIrrDeviceLinux.cpp
index 82aa243..755f32f 100644
--- a/source/Irrlicht/CIrrDeviceLinux.cpp
+++ b/source/Irrlicht/CIrrDeviceLinux.cpp
@@ -113,6 +113,9 @@ CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
XInputMethod(0), XInputContext(0),
HasNetWM(false),
#endif
+#if defined(_IRR_LINUX_X11_XINPUT2_)
+ currentTouchedCount(0),
+#endif
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
WindowHasFocus(false), WindowMinimized(false),
ExternalWindow(false), AutorepeatSupport(0)
@@ -1051,6 +1054,14 @@ bool CIrrDeviceLinux::run()
irrevent.TouchInput.X = de->event_x;
irrevent.TouchInput.Y = de->event_y;
+ if (irrevent.TouchInput.Event == ETIE_PRESSED_DOWN) {
+ currentTouchedCount++;
+ }
+ irrevent.TouchInput.touchedCount = currentTouchedCount;
+ if (currentTouchedCount > 0 && irrevent.TouchInput.Event == ETIE_LEFT_UP) {
+ currentTouchedCount--;
+ }
+
postEventFromUser(irrevent);
}
}
diff --git a/source/Irrlicht/CIrrDeviceLinux.h b/source/Irrlicht/CIrrDeviceLinux.h
index a69b7b6..609ad26 100644
--- a/source/Irrlicht/CIrrDeviceLinux.h
+++ b/source/Irrlicht/CIrrDeviceLinux.h
@@ -425,6 +425,10 @@ namespace irr
};
core::array<JoystickInfo> ActiveJoysticks;
#endif
+
+#if defined(_IRR_LINUX_X11_XINPUT2_)
+ int currentTouchedCount;
+#endif
};
diff --git a/source/Irrlicht/CMakeLists.txt b/source/Irrlicht/CMakeLists.txt
index 122bd58..d4cd384 100644
--- a/source/Irrlicht/CMakeLists.txt
+++ b/source/Irrlicht/CMakeLists.txt
@@ -37,6 +37,7 @@ set(CMAKE_REQUIRED_INCLUDES ${PROJECT_SOURCE_DIR}/include)
unset(OGLES1_ENABLED CACHE)
unset(OGLES2_ENABLED CACHE)
unset(OGL_ENABLED CACHE)
+unset(XINPUT2_ENABLED CACHE)
check_symbol_exists(_IRR_COMPILE_WITH_OGLES1_ "IrrCompileConfig.h" OGLES1_ENABLED)
if(OGLES1_ENABLED)
@@ -55,6 +56,10 @@ if(OGL_ENABLED)
set(OpenGL_GL_PREFERENCE "LEGACY")
find_package(OpenGL REQUIRED)
endif()
+check_symbol_exists(_IRR_LINUX_X11_XINPUT2_ "IrrCompileConfig.h" XINPUT2_ENABLED)
+if(XINPUT2_ENABLED)
+ find_library(XINPUT_LIBRARY Xi REQUIRED)
+endif()
# Platform-specific libs
@@ -96,6 +101,7 @@ set(link_libs
${OPENGLES_LIBRARY}
${OPENGLES2_LIBRARIES}
${EGL_LIBRARY}
+ ${XINPUT_LIBRARY}
"$<$<PLATFORM_ID:Android>:native_app_glue -landroid -llog>"
${COCOA_LIB}