From 899e0bd16bcf80b0a1badbafeb83d3f474f24261 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 22 Oct 2019 16:41:19 +0200 Subject: input: add gamepad support through SDL2 The code is very basic: - only handles gamepads, could be extended for generic joysticks in the future. - only has button mappings for controllers natively supported by SDL2. I heard more can be added through env vars, there's also ways to load mappings from text files, but I'd rather not go there yet. Common ones like Dualshock are supported natively. - analog buttons (TRIGGER and AXIS) are mapped to discrete buttons using an activation threshold. - only supports one gamepad at a time. the feature is intented to use gamepads as evolved remote controls, not play multiplayer games in mpv :) --- wscript_build.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'wscript_build.py') diff --git a/wscript_build.py b/wscript_build.py index 9f47153413..951584ec9d 100644 --- a/wscript_build.py +++ b/wscript_build.py @@ -257,7 +257,7 @@ def build(ctx): ( "audio/out/ao_pcm.c" ), ( "audio/out/ao_pulse.c", "pulse" ), ( "audio/out/ao_rsound.c", "rsound" ), - ( "audio/out/ao_sdl.c", "sdl2" ), + ( "audio/out/ao_sdl.c", "sdl2-audio" ), ( "audio/out/ao_sndio.c", "sndio" ), ( "audio/out/ao_wasapi.c", "wasapi" ), ( "audio/out/ao_wasapi_changenotify.c", "wasapi" ), @@ -320,6 +320,7 @@ def build(ctx): ( ipc_c ), ( "input/keycodes.c" ), ( "input/pipe-win32.c", "win32-pipes" ), + ( "input/sdl_gamepad.c", "sdl2-gamepad" ), ## Misc ( "misc/bstr.c" ), @@ -490,7 +491,7 @@ def build(ctx): ( "video/out/vo_mediacodec_embed.c", "android" ), ( "video/out/vo_null.c" ), ( "video/out/vo_rpi.c", "rpi-mmal" ), - ( "video/out/vo_sdl.c", "sdl2" ), + ( "video/out/vo_sdl.c", "sdl2-video" ), ( "video/out/vo_tct.c" ), ( "video/out/vo_vaapi.c", "vaapi-x11 && gpl" ), ( "video/out/vo_vdpau.c", "vdpau" ), -- cgit v1.2.3