|
6460151c
|
2021-06-21T15:03:31
|
|
Vita: add missing stub
|
|
2465444f
|
2021-06-14T21:27:09
|
|
Add missing dependencies
|
|
bbdd08e0
|
2021-06-10T13:20:39
|
|
Build without PIB support by default and add flag to enable it
|
|
6a2af48a
|
2021-05-06T15:43:16
|
|
CMake: Generic check for desktop GL and EGL on Linux systems
|
|
ded02387
|
2021-05-16T17:16:54
|
|
Make CMake script more accurate to autoconf script
DBus, IBus and inotify is now able to be used outside Linux like in configure.
KMSDRM input is now working on FreeBSD with CMake compilation.
|
|
ca969eb2
|
2021-04-24T10:29:52
|
|
Remove gles2 vita render
|
|
d4e96e11
|
2021-04-16T09:44:07
|
|
Android: enable audio driver OpenSLES when building with CMake
|
|
02b1ebc9
|
2021-04-15T21:13:17
|
|
Android: add openslES and AAudio compilation to CMakeLists
|
|
69203851
|
2021-04-14T21:40:50
|
|
rename PKG_CONFIG_LIBS_PRIV to PKGCONFIG_LIBS_PRIV
i.e.: do not steal PKG_CONFIG namespace.
|
|
401f4854
|
2021-04-11T19:29:01
|
|
cmake: Weak link with CoreHaptics
Add link to CoreHaptics so we can compile against latest iOS SDKs.
|
|
dbedaece
|
2021-04-11T15:10:28
|
|
Adding checks to see if any ASAN flags are set, if so then we set(HAVE_ASAN ON) so the infomartion output will properly list ASAN as on.
|
|
70bd205b
|
2021-04-11T15:08:14
|
|
Adding messages to output CMAKE_C_FLAGS_DEBUG and CMAKE_CXX_FLAGS_DEBUG, this way when using Debug builds you can see which debug flags are set
|
|
32066604
|
2021-04-11T15:05:58
|
|
Moving ASAN macros and calls to macros above the information output section so we can display ASAN information properly.
|
|
732cc8ed
|
2021-04-08T21:28:45
|
|
cmake: Fix UWP DLL build by removing /NODEFAUTLIB
On UWP, we need default C runtime for C++ sources.
|
|
50db4a59
|
2021-04-02T12:05:45
|
|
* Support for intrinsics in MSW + Clang scenario.
Utility polyfill is provided, removed the no-longer-needed
conditionals.
|
|
7b8c7509
|
2021-04-03T22:21:35
|
|
CMake: Enable WASAPI on WinRT
WASAPI backend on WinRT was implemented with 2.0.8
https://github.com/libsdl-org/SDL/commit/351d6d478443fe8a1ede1e993712f07cb369d483
but CMake source here was written for 2.0.7 in vcpkg
https://github.com/microsoft/vcpkg/commit/e6c65b93b125cf0be13254cf2f5a9d27cb009707
|
|
a81fe272
|
2021-04-04T00:16:30
|
|
configure/cmake: Hook up Emscripten threads (disabled by default).
Fixes #3795.
|
|
e213f37a
|
2021-03-15T12:53:16
|
|
[KMSDRM] Enable full OpenGL detection (MESA/libglvnd) on both the make and cmake buildsystems.
|
|
e58a955e
|
2021-03-08T18:39:00
|
|
Deprecate dolcesdk
|
|
4708c6bb
|
2021-02-14T11:52:43
|
|
Remove pkg-config prefix hack
|
|
b52e9459
|
2021-01-29T01:26:13
|
|
Add support for open URL
|
|
a43f4889
|
2021-01-20T23:33:05
|
|
Don't search for pthread
|
|
54134fdd
|
2021-01-10T00:09:46
|
|
Use Clib mem funcs
|
|
e928b92f
|
2020-12-18T16:42:57
|
|
CMake support
|
|
34ecd71e
|
2021-03-04T18:44:04
|
|
CMake: don't add -Wl,--no-undefined to LDFLAGS for clang+windows cases
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
|
|
3880174a
|
2021-03-04T18:40:56
|
|
CMake: set OPT_DEF_LIBC to ON for clang case, too.
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
|
|
05cc9e37
|
2021-03-04T18:40:50
|
|
CMake: move GCC check after CLANG, so that CLANG is properly recognized
from a patchset by Vladislav Dmitrievich Turbanov:
https://github.com/libsdl-org/SDL/pull/4062
|
|
0a683221
|
2021-03-01T15:11:50
|
|
add missing PIPEWIRE defines to SDL_config.h.in
also specify 'audio' in Pipepire configuration enable messages.
|
|
2f0b99a7
|
2021-02-13T11:56:05
|
|
audio: Add Pipewire playback/capture sink
|
|
fe6f62e6
|
2021-02-10T15:17:02
|
|
Add ALIAS targets to all installed SDL2 targets
This provides a linking interface that matches the one available when `find_package()` is used, by aliasing all of SDL's public targets into the SDL2:: namespace. Thus, dependees link to the same-named targets regardless of how SDL was acquired.
This approach permits the use of wrappers around CMake's FetchContent API such as https://github.com/cpm-cmake/CPM.cmake
|
|
2170c7bf
|
2021-02-08T23:55:50
|
|
make AddressSanitizer optional and disabled by default
|
|
5045d299
|
2021-02-08T20:50:00
|
|
enable AddressSanitizer only for GCC 5 onwards (bug #5533)
|
|
066960c2
|
2021-02-08T02:15:50
|
|
add '-shared-libasan' to debug flags (bug #5533)
|
|
bb9e049d
|
2021-02-07T00:37:00
|
|
minor updates to libc function checks
|
|
2426949a
|
2021-02-01T21:56:56
|
|
Removed support for clock_gettime_nsec_np()
SDL_GetTicks() was broken and it's not adding any real value here.
|
|
42798cec
|
2021-02-01T20:25:24
|
|
cmake: enable AddressSanitizer in Debug builds if supported
|
|
b7f711cd
|
2021-01-31T19:11:49
|
|
Don't enable address sanitize flags without checking compiler first
|
|
f8b4a6e2
|
2021-01-31T19:09:25
|
|
cmake: enable AddressSanitizer in Debug builds
|
|
091a4649
|
2021-01-29T23:11:13
|
|
added --enable-xinput switch for windows builds
|
|
de1c19b3
|
2021-01-25T20:43:21
|
|
Fixed bug 5481 - iOS-specific main sources not used for CMake build.
Aaron Barany
The CMake build for SDL doesn't set SDLMAIN_SOURCES on iOS to the sources in src/main/ios. As a result, SDL fails to initialize since it falls back to the dummy main. Adding the line file(GLOB SDLMAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/uikit/*.c) fixes the issue.
|
|
aa4a6b0b
|
2021-01-25T04:11:40
|
|
better check for clock_gettime_nsec_np() -- cf. bug #5467.
|
|
d327bbfb
|
2021-01-24T17:37:24
|
|
CMakeLists.txt: fix check_symbol_exists() for clock_gettime_nsec_np
|
|
96cfb812
|
2021-01-23T09:50:43
|
|
Fixed bug 5467 - SDL sys timer Mac OS update proposal
David Carlier
Change of api from 2016 which reduce code complexity a bit.
|
|
f3835702
|
2021-01-17T05:00:50
|
|
fix build with --disable-directx
|
|
d54b125a
|
2021-01-14T14:53:34
|
|
Fixed bug 5287 - Support building for UWP with CMake
Jan Niklas Hasse
Actually the SDL2-static target works, if I set SDL_SENSOR to OFF. Awesome!
See this patch: https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/0003-sdl2-fix-uwp-build.patch
|
|
8a32ee24
|
2020-12-30T01:00:24
|
|
removed MSVC strtok_s use from SDL_strtokr().
no other ??_s are used elsewhere in SDL_stdinc. besides, C11 has a
strtok_s with a different signature.
|
|
2443e51e
|
2020-12-28T11:42:49
|
|
Add optional suffix `_generic` to generic SDL_cond impl
Allows for runtime selectable implementation
|
|
471d3c36
|
2020-12-27T14:00:30
|
|
fix bug #5415 -- fatal error: 'Cocoa/Cocoa.h' file not found in iOS build
|
|
9f6fddb4
|
2020-12-27T05:20:10
|
|
CMake: don't check for --no-undefined linker flag for OpenBSD (bug #5174)
it now matches autotools.
|
|
93ccdee8
|
2020-12-23T13:47:49
|
|
Fixed bug 5404 - stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf
Cameron Cawley
stdlib: Added SDL_round, SDL_roundf, SDL_lround and SDL_lroundf
The default implementation is based on the one used in the Windows RT video driver.
|
|
b4b674da
|
2020-12-22T22:10:50
|
|
CMakeLists.txt: sync DYLIB_CURRENT_VERSION to Xcode project
|
|
350f1b0d
|
2020-12-22T10:36:15
|
|
Updated SDL to version 2.0.15 for development
|
|
13244de5
|
2020-12-22T17:17:30
|
|
[Buildsystem] Only build KMSDRM support if EGL+OpenGL is detected by CMake.
|
|
22275b35
|
2020-12-20T21:55:02
|
|
cmake: fix building for mac (bug #5407.)
|
|
6bd4c717
|
2020-12-17T21:41:23
|
|
Fixed bug 5402 - ARM support little update proposal
David Carlier
No fix but mostly an update for ARM architecture.
|
|
b6e63625
|
2020-12-13T15:32:24
|
|
fix bug #5395: handle old systems where inotify_init1 is not available
|
|
45e3521d
|
2020-12-09T07:32:10
|
|
Backed out changes for 5366 - cmake build doesn't detect Metal on macOS
These changes introduce regressions for other build environments, so I'm backing them out until we sort out the correct fix.
|
|
479db430
|
2020-12-09T06:56:34
|
|
Fixed bug 5250 - updaterev.sh failed using CMake Tools on VSCode Remote
Sebastian Vargas Vargas
Running CMake configure from a Windows Subsystem for Linux using Visual Studio Code Remote doesn't generate the header file with the current source revision, it throws "/home/sebva/SDL/build-scripts/updaterev.sh: 13: cannot create /mnt/c/Users/sebva/.vscode/extensions/ms-vscode-remote.remote-wsl-0.44.4/include/SDL_revision.h.new: Directory nonexistent".
|
|
42c5b4ac
|
2020-12-09T06:17:55
|
|
Fixed bug 5366 - cmake build doesn't detect Metal on macOS
Tom Seddon
2nd time lucky, perhaps. patch 2 applies to current HEAD at time of writing - 4eb049c9bb1ca94efe3c40b57beda3169984d0cb from https://github.com/SDL-mirror/SDL.
This basically goes back to what was there originally, but now manually adding "-x objective-c" to the clang command line rather than "-ObjC". clang is then invoked without the "-x c" that was causing the problem, the snippet builds, and Metal is detected. (I had a quick trawl through the cmake code, but I couldn't see where this is handled.)
I was moved to try this after finding SDL's own CHECK_OBJC_SOURCE_COMPILES macro, and noting what it does: https://github.com/SDL-mirror/SDL/blob/4eb049c9bb1ca94efe3c40b57beda3169984d0cb/cmake/macros.cmake#L67
An alternative fix of course would be to use CHECK_OBJC_SOURCE_COMPILES instead of cmake's check_objc_source_compiles - but that had the same problem of getting confused by "return 0;". (Maybe that's because it's a macro? I'll defer to a cmake expert on this one.)
I decided in the end to err on the side of leaving things looking basically the same as they were before my first patch.
|
|
475405e0
|
2020-12-09T12:03:24
|
|
CMakeLists.txt: sync DYLIB_CURRENT_VERSION to Xcode project
|
|
250a0557
|
2020-12-09T12:01:10
|
|
fix bug #5384 -- define DLL_EXPORT in DLL builds and adjust begin_code.h
|
|
a2098a47
|
2020-12-08T18:56:06
|
|
Updated SDL to 2.0.14 in preparation for release candidate
|
|
2a9591a9
|
2020-12-08T09:16:34
|
|
Accepted patch https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/fix-space-in-path.patch
|
|
7f1c6e82
|
2020-12-08T09:13:08
|
|
Accepted patch https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/enable-winrt-cmake.patch
|
|
7665f887
|
2020-12-08T09:07:21
|
|
Accepted patch https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/disable-wcslcpy-and-wcslcat-for-windows.patch
|
|
695499ae
|
2020-12-08T09:04:28
|
|
Accepted patch https://github.com/microsoft/vcpkg/blob/master/ports/sdl2/disable-hidapi-for-uwp.patch
|
|
4b35a18d
|
2020-12-01T13:50:42
|
|
Fixed bug 5366 - cmake build doesn't detect Metal on macOS
Tom Seddon
This is as of commit 50d804ea729accf9e3a9ce83238d0a2976a17545 from https://github.com/SDL-mirror/SDL, which is HEAD as I write (apologies, not confident with Mercurial)
# Config
macOS: 10.14.6 (18G6042)
cmake --version: cmake version 3.16.20200101-g23e782c
clang --version: Apple clang version 11.0.0 (clang-1100.0.33.17)
Xcode version: Version 11.3.1 (11C504)
# Repro steps
Run the following commands in the shell.
cd /tmp/
git clone https://github.com/SDL-mirror/SDL
mkdir build.SDL
cd build.SDL
cmake -G ../SDL/
Examine cmake output.
# Expected result
Metal is detected.
# Actual result
It appears that Metal is not detected! Note this line in the summary:
-- RENDER_METAL (Wanted: 0): OFF
# Fix
Change check_c_source_compiles to check_objc_source_compiles. The cmake script tries to add -ObjC to the clang command line, but, for whatever reason, this doesn't seem to work.
Change the test source to have an empty main. The "return 0;" line seems to confuse cmake somehow, causing it to crap out with an error about HAVE_FRAMEWORK_METAL being an unknown argument. (Maybe I'm just dense, but it's not obvious to me what the problem is here.)
With these two changes:
-- RENDER_METAL (Wanted: ON): ON
Patch attached.
|
|
e5783e11
|
2020-11-25T14:51:56
|
|
cmake: add missing checks for wcscasecmp, _wcsicmp, wcsncasecmp, _wcsnicmp
|
|
711d4090
|
2020-11-24T14:10:30
|
|
CMakeLists.txt: add src/joystick/iphoneos/*.m to Darwin joystick sources
.. so that there won't be missing symbols.
TODO: add checks for SDL_JOYSTICK_MFI ???
|
|
4c96faee
|
2020-11-23T20:37:10
|
|
remove non-existing tslib support from autofoo and cmake
|
|
8db3171b
|
2020-11-11T19:14:34
|
|
udev: Factor out SDL_EVDEV_GuessDeviceClass
This works on capability bitfields that can either come from udev or
from ioctls, so it is equally applicable to both udev and non-udev
input device detection.
Signed-off-by: Simon McVittie <smcv@collabora.com>
|
|
2daa670c
|
2020-10-13T15:20:03
|
|
cmake: look for iconv in libc, too (bug #5316.)
|
|
67568518
|
2020-10-13T14:45:10
|
|
cmake: run updaterev.sh if(NOT CMAKE_HOST_WIN32)
... not if(NOT WINDOWS OR CYGWIN)
This way, it generates SDL_revision.h in cross-build environments too.
|
|
665cfa49
|
2020-10-13T14:32:15
|
|
cmake: check for alloca() in stdlib.h and malloc.h, too (bug #5316)
|
|
48c03d9a
|
2020-10-12T02:40:00
|
|
cmake: reduce STDC_HEADER_NAMES list to only relevant headers,
i.e. stddef.h, stdarg.h, stdlib.h, string.h, stdio.h, wchar.h, float.h.
Fixes issue described at:
https://bugzilla.libsdl.org/show_bug.cgi?id=4885#c2
|
|
196cda69
|
2020-10-12T01:02:28
|
|
build: fix / update sensors (windows) configuration
- SDL_config.h.in: add missing defines SDL_SENSOR_COREMOTION
and SDL_SENSOR_WINDOWS (configure did set SDL_SENSOR_WINDOWS
but it never went in SDL_config.h or Makefile.)
- SDL_config.h.cmake: remove duplicated SDL_SENSOR_XXX cmake
defines.
- autofoo, cmake: check for sensorsapi.h header before enabling
windows sensors.
|
|
59022829
|
2020-10-11T17:32:32
|
|
riscos: Implement SDL_OpenURL()
|
|
77c9d73b
|
2020-10-05T11:30:33
|
|
Removed SDL_AndroidOpenURL, added SDL_OpenURL.
Still needs to be wired into Xcode and Visual Studio projects.
|
|
b1626295
|
2020-07-08T17:28:34
|
|
cmake: Fix building with -DSDL_HAPTIC=Off
|
|
e294639a
|
2020-06-27T02:00:58
|
|
cmake: Fix Metal detection on macOS/iOS.
Apparently the "-x objective-c" made it down to the linker, who then treats
the .o file as Objective-C source code. Apparently the -ObjC argument does
the same thing but gets ignored by the linker.
Fixes Bugzilla #4988.
|
|
363fd52b
|
2020-06-26T23:30:59
|
|
configure/cmake: Disable ARM SIMD and NEON by default.
It's buggy at the moment.
|
|
21482c15
|
2020-06-26T20:11:32
|
|
cmake: Bump minimum required CMake to 3.0.0 and mark link libraries PRIVATE.
Fixes Bugzilla #2992.
|
|
d955d63b
|
2020-06-26T17:42:30
|
|
cmake: Build Linux-specific files like the configure script does.
Otherwise we unconditionally compile things we shouldn't.
Fixes Bugzilla #5175.
|
|
718e1fb8
|
2020-06-26T22:45:15
|
|
cmake: Fix building with -DSDL_SENSOR=Off
|
|
dd753ce7
|
2020-06-26T15:04:57
|
|
cmake: Fix building with -DSDL_POWER=Off
Fixes Bugzilla #5193.
|
|
efe09359
|
2020-06-15T10:31:16
|
|
Fix compile without DIRECTX
|
|
a8400dc3
|
2020-05-29T16:31:05
|
|
Fixed bug 5105 - sndio support not working in dynamic mode (dlopen)
Giovanni Bajo
The CMake build system supports several audio frameworks for Linux: one of them is sndio.
All frameworks can be built with "runtime linking" (that is, using dlopen to load the library at runtime). In sdlchecks.cmake, there's code to do the same with sndio:
=================================================================
# Requires:
# - n/a
# Optional:
# - SNDIO_SHARED opt
# - HAVE_DLOPEN opt
macro(CheckSNDIO)
if(SNDIO)
# TODO: set include paths properly, so the sndio headers are found
check_include_file(sndio.h HAVE_SNDIO_H)
find_library(D_SNDIO_LIB sndio)
if(HAVE_SNDIO_H AND D_SNDIO_LIB)
set(HAVE_SNDIO TRUE)
file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES})
set(SDL_AUDIO_DRIVER_SNDIO 1)
if(SNDIO_SHARED)
if(NOT HAVE_DLOPEN)
message_warn("You must have SDL_LoadObject() support for dynamic sndio loading")
else()
FindLibraryAndSONAME("sndio")
set(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC "\"${SNDIO_LIB_SONAME}\"")
set(HAVE_SNDIO_SHARED TRUE)
endif()
else()
list(APPEND EXTRA_LIBS ${D_SNDIO_LIB})
endif()
set(HAVE_SDL_AUDIO TRUE)
endif()
endif()
endmacro()
=================================================================
The feature is gated by an option called SNDIO_SHARED. It is also fully implemented in SDL_sndioaudio.c
Unfortunately, it seems there is a missing line in CMakeLists.txt, so SNDIO_SHARED is not defined:
======================================================================
set_option(ALSA "Support the ALSA audio API" ${UNIX_SYS})
dep_option(ALSA_SHARED "Dynamically load ALSA audio support" ON "ALSA" OFF)
set_option(JACK "Support the JACK audio API" ${UNIX_SYS})
dep_option(JACK_SHARED "Dynamically load JACK audio support" ON "JACK" OFF)
set_option(ESD "Support the Enlightened Sound Daemon" ${UNIX_SYS})
dep_option(ESD_SHARED "Dynamically load ESD audio support" ON "ESD" OFF)
set_option(PULSEAUDIO "Use PulseAudio" ${UNIX_SYS})
dep_option(PULSEAUDIO_SHARED "Dynamically load PulseAudio support" ON "PULSEAUDIO" OFF)
set_option(ARTS "Support the Analog Real Time Synthesizer" ${UNIX_SYS})
dep_option(ARTS_SHARED "Dynamically load aRts audio support" ON "ARTS" OFF)
set_option(NAS "Support the NAS audio API" ${UNIX_SYS})
set_option(NAS_SHARED "Dynamically load NAS audio API" ${UNIX_SYS})
set_option(SNDIO "Support the sndio audio API" ${UNIX_SYS})
set_option(FUSIONSOUND "Use FusionSound audio driver" OFF)
dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF)
======================================================================
You can see that all frameworks define a "dep_option" NAME_SHARED, and SNDIO is the only one where the option is missing.
This means that runtime loading of sndio is never activated. If sndio is found at configuration time, it is always activated in "linked" mode, so that the final binary will have a load-time dependency with libsdnio. This is unfortunate.
To fix the problem, it is sufficient to add this line:
dep_option(SNDIO_SHARED "Dynamically load the sndio audio API" ${UNIX_SYS} ON "SNDIO" OFF)
I've verified that this fixes the bug, and sndio can now be dynamically loaded as expected.
|
|
5b65e0af
|
2020-05-15T21:12:23
|
|
Fixed bug 5100 - compilation CMake Android armeabi-v7a (Thanks Steve Robinson!)
fatal error: 'cpu-features.h' file not found on CMake Android armeabi-v7a
|
|
eadc8693
|
2020-05-11T14:31:04
|
|
Fixed bug 5103 - Port fcitx support to both fcitx 4 & 5
wengxt
Due to the new major fcitx version is coming close, the existing code need to be ported to use new Fcitx dbus interface.
The new dbus interface is supported by both fcitx 4 and 5, and has a good side effect, which is that it will work with flatpak for free. Also the patch remove the dependency on fcitx header. Instead, it just hardcodes a few enum value in the code so need to handle the different header for fcitx4 or 5.
|
|
fa23e3d0
|
2020-05-04T02:27:29
|
|
locale: Implemented SDL_GetPreferredLocales().
This was something I proposed a long time ago, Sylvain Becker did
additional work on it, then back to me.
Fixes Bugzilla #2131.
|
|
7ac82710
|
2020-04-24T02:06:53
|
|
cmake: various Haiku settings were accidentally under "if(SDL_VIDEO)"
|
|
952bac7c
|
2020-04-13T15:22:09
|
|
cmake: use check_symbol_exists, not check_function_exists (thanks, Manuel!)
This fixes the problem where we think iOS has fseeko64, etc, but doesn't.
Fixes Bugzilla #4885.
|
|
abcc6706
|
2020-04-12T13:24:36
|
|
build: Don't duplicate Libs in Libs.private in pkg-config file
pkg-config already prepends Libs to Libs.private when you specify
--static so there's no need to duplicate them. Most other projects
don't do this.
|
|
99f87a71
|
2020-04-11T23:38:34
|
|
build: Merge pkg-config Libs.private into Libs for static-only builds
A project being built entirely statically will call pkg-config with
--static, which utilises the Libs.private field. Conversely it will
not use --static when not being built entirely statically, even if
there is only a static build of SDL available. This will most likely
cause the build to fail due to underlinking unless we merge the Libs
fields.
This is what the Meson build system does when it generates pkg-config
files. This also also follows the behaviour of sdl2-config.
At the same time, the runtime linker flags are not applicable to
static-only builds so only add them for shared builds.
|
|
d292f6bd
|
2020-04-10T12:17:14
|
|
stdlib: Add SDL_trunc and SDL_truncf
|
|
3180ba81
|
2020-04-08T08:34:27
|
|
First pass at Windows sensor implementation
|
|
2be75c6a
|
2020-03-13T19:08:45
|
|
Fixed bug 5028 - Virtual Joysticks (new joystick backend)
David Ludwig
I have created a new driver for SDL's Joystick and Game-Controller subsystem: a Virtual driver. This driver allows one to create a software-based joystick, which to SDL applications will look and react like a real joystick, but whose state can be set programmatically. A primary use case for this is to help enable developers to add touch-screen joysticks to their apps.
The driver comes with a set of new, public APIs, with functions to attach and detach joysticks, set virtual-joystick state, and to determine if a joystick is a virtual-one.
Use of virtual joysticks goes as such:
1. Attach one or more virtual joysticks by calling SDL_JoystickAttachVirtual. If successful, this returns the virtual-device's joystick-index.
2. Open the virtual joysticks (using indicies returned by SDL_JoystickAttachVirtual).
3. Call any of the SDL_JoystickSetVirtual* functions when joystick-state changes. Please note that virtual-joystick state will only get applied on the next call to SDL_JoystickUpdate, or when pumping or polling for SDL events (via SDL_PumpEvents or SDL_PollEvent).
Here is a listing of the new, public APIs, at present and subject to change:
------------------------------------------------------------
/**
* Attaches a new virtual joystick.
* Returns the joystick's device index, or -1 if an error occurred.
*/
extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nballs, int nbuttons, int nhats);
/**
* Detaches a virtual joystick
* Returns 0 on success, or -1 if an error occurred.
*/
extern DECLSPEC int SDLCALL SDL_JoystickDetachVirtual(int device_index);
/**
* Indicates whether or not a virtual-joystick is at a given device index.
*/
extern DECLSPEC SDL_bool SDLCALL SDL_JoystickIsVirtual(int device_index);
/**
* Set values on an opened, virtual-joystick's controls.
* Returns 0 on success, -1 on error.
*/
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualAxis(SDL_Joystick * joystick, int axis, Sint16 value);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualBall(SDL_Joystick * joystick, int ball, Sint16 xrel, Sint16 yrel);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualButton(SDL_Joystick * joystick, int button, Uint8 value);
extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick * joystick, int hat, Uint8 value);
------------------------------------------------------------
Miscellaneous notes on the initial patch, which are also subject to change:
1. no test code is present in SDL, yet. This should, perhaps, change. Initial development was done with an ImGui-based app, which potentially is too thick for use in SDL-official. If tests are to be added, what kind of tests? Automated? Graphical?
2. virtual game controllers can be created by calling SDL_JoystickAttachVirtual with a joystick-type of SDL_JOYSTICK_TYPE_GAME_CONTROLLER, with naxes (num axes) set to SDL_CONTROLLER_AXIS_MAX, and with nbuttons (num buttons) set to SDL_CONTROLLER_BUTTON_MAX. When updating their state, values of type SDL_GameControllerAxis or SDL_GameControllerButton can be casted to an int and used for the control-index (in calls to SDL_JoystickSetVirtual* functions).
3. virtual joysticks' guids are mostly all-zeros with the exception of the last two bytes, the first of which is a 'v', to indicate that the guid is a virtual one, and the second of which is a SDL_JoystickType that has been converted into a Uint8.
4. virtual joysticks are ONLY turned into virtual game-controllers if and when their joystick-type is set to SDL_JOYSTICK_TYPE_GAMECONTROLLER. This is controlled by having SDL's default list of game-controllers have a single entry for a virtual game controller (of guid, "00000000000000000000000000007601", which is subject to the guid-encoding described above).
5. regarding having to call SDL_JoystickUpdate, either directly or indirectly via SDL_PumpEvents or SDL_PollEvents, before new virtual-joystick state becomes active (as specified via SDL_JoystickSetVirtual* function-calls), this was done to match behavior found in SDL's other joystick drivers, almost all of which will only update SDL-state during SDL_JoystickUpdate.
6. the initial patch is based off of SDL 2.0.12
7. the virtual joystick subsystem is disabled by default. It should be possible to enable it by building with SDL_JOYSTICK_VIRTUAL=1
Questions, comments, suggestions, or bug reports very welcome!
|
|
983bbf9e
|
2020-03-10T18:35:31
|
|
Backed out changeset 51622f74dc85
|
|
93ed3c8b
|
2020-03-10T18:25:47
|
|
Updated SDL to version 2.0.13 for development builds
|
|
4fb06a2a
|
2020-03-10T18:25:47
|
|
Updated SDL to version 2.0.13 for development builds
|