mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-21 14:03:11 -07:00
Add support for touchpad and sensor handling via SDL
This should enable support for more controllers besides the DS4 and DualSense, basically any controller supported by SDL that has at least one touchpad, an accelerometer and a gyroscope. Older SDL versions have been tested down to 2.0.9. Versions older than 2.0.14 won't have sensors and touchpad support, though. Setsu is deprecated and remains in-tree for now, but defaults to being disabled if SDL2 is found and >= 2.0.14. If Setsu is enabled explicitly, touchpad and sensors are not handled by SDL.
This commit is contained in:
parent
76690a319c
commit
4c8209762c
9 changed files with 298 additions and 59 deletions
|
@ -1,6 +1,26 @@
|
|||
|
||||
find_package(SDL2 NO_MODULE QUIET)
|
||||
|
||||
# Adapted from libsdl-org/SDL_ttf: https://github.com/libsdl-org/SDL_ttf/blob/main/cmake/FindPrivateSDL2.cmake#L19-L31
|
||||
# Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
|
||||
# Licensed under the zlib license (https://github.com/libsdl-org/SDL_ttf/blob/main/LICENSE.txt)
|
||||
set(SDL2_VERSION_MAJOR)
|
||||
set(SDL2_VERSION_MINOR)
|
||||
set(SDL2_VERSION_PATCH)
|
||||
set(SDL2_VERSION)
|
||||
if(SDL2_INCLUDE_DIR)
|
||||
file(READ "${SDL2_INCLUDE_DIR}/SDL_version.h" _sdl_version_h)
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl2_major_re "${_sdl_version_h}")
|
||||
set(SDL2_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl2_minor_re "${_sdl_version_h}")
|
||||
set(SDL2_VERSION_MINOR "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)" _sdl2_patch_re "${_sdl_version_h}")
|
||||
set(SDL2_VERSION_PATCH "${CMAKE_MATCH_1}")
|
||||
if(_sdl2_major_re AND _sdl2_minor_re AND _sdl2_patch_re)
|
||||
set(SDL2_VERSION "${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL2_FOUND AND (NOT TARGET SDL2::SDL2))
|
||||
add_library(SDL2::SDL2 UNKNOWN IMPORTED GLOBAL)
|
||||
if(NOT SDL2_LIBDIR)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue