Add SDL3-based controller input service
Integrate SDL3 controller support and wire it into the InputRouter.
- Add ControllerInputService (src/ControllerInputService.{h,cpp}) to discover, poll and translate SDL3 gamepad events into InputRouter actions, with axis repeat handling and debouncing.
- Update CMakeLists to find or fetch SDL3, add the new source files to the target, link the SDL3 target, and copy runtime DLLs on Windows.
- Add triggerAction(Action) to InputRouter and use it from existing keyboard handling to centralize action dispatch.
- Instantiate ControllerInputService in main so controllers feed the InputRouter.
- Update QML views (ShellWindow, HomeView, LibraryView, SettingsView) to use numeric action IDs and add small UI/status text and navigation tweaks for controller-driven flows.
These changes enable gamepad/controller input for Bigscreen via SDL3 and adapt UI code to handle the mapped actions.
This commit is contained in:
@@ -9,6 +9,30 @@ set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
find_package(Qt6 6.5 REQUIRED COMPONENTS Quick Gui)
|
||||
find_package(SDL3 CONFIG QUIET)
|
||||
|
||||
if(NOT SDL3_FOUND)
|
||||
include(FetchContent)
|
||||
set(SDL_SHARED ON CACHE BOOL "" FORCE)
|
||||
set(SDL_STATIC OFF CACHE BOOL "" FORCE)
|
||||
set(SDL_TEST_LIBRARY OFF CACHE BOOL "" FORCE)
|
||||
set(SDL_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(SDL_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
|
||||
FetchContent_Declare(SDL3
|
||||
URL https://github.com/libsdl-org/SDL/releases/download/release-3.2.30/SDL3-3.2.30.tar.gz
|
||||
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(SDL3)
|
||||
endif()
|
||||
|
||||
if(TARGET SDL3::SDL3)
|
||||
set(BIGSCREEN_SDL_TARGET SDL3::SDL3)
|
||||
elseif(TARGET SDL3::SDL3-shared)
|
||||
set(BIGSCREEN_SDL_TARGET SDL3::SDL3-shared)
|
||||
else()
|
||||
message(FATAL_ERROR "SDL3 target was not found after package lookup/fetch")
|
||||
endif()
|
||||
|
||||
qt_standard_project_setup(REQUIRES 6.5)
|
||||
qt_policy(SET QTP0004 NEW)
|
||||
@@ -31,6 +55,8 @@ set_source_files_properties(qml/Theme.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
|
||||
|
||||
qt_add_executable(nebula-bigscreen
|
||||
src/main.cpp
|
||||
src/ControllerInputService.cpp
|
||||
src/ControllerInputService.h
|
||||
src/InputRouter.cpp
|
||||
src/InputRouter.h
|
||||
)
|
||||
@@ -45,8 +71,21 @@ target_link_libraries(nebula-bigscreen
|
||||
PRIVATE
|
||||
Qt6::Quick
|
||||
Qt6::Gui
|
||||
${BIGSCREEN_SDL_TARGET}
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
add_custom_command(
|
||||
TARGET nebula-bigscreen
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
$<TARGET_RUNTIME_DLLS:nebula-bigscreen>
|
||||
$<TARGET_FILE_DIR:nebula-bigscreen>
|
||||
COMMAND_EXPAND_LISTS
|
||||
COMMENT "Copying runtime DLLs next to nebula-bigscreen"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
set_target_properties(nebula-bigscreen PROPERTIES WIN32_EXECUTABLE TRUE)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user