In addition to lots of bug fixes and build improvements, here are the major changes in this release:
General:
The SDL_RW* macros have been turned into functions that are available only in 2.0.10 and onward
Added SDL_SIMDGetAlignment(), SDL_SIMDAlloc(), and SDL_SIMDFree(), to allocate memory aligned for SIMD operations for the current CPU
Added SDL_RenderDrawPointF(), SDL_RenderDrawPointsF(), SDL_RenderDrawLineF(), SDL_RenderDrawLinesF(), SDL_RenderDrawRectF(), SDL_RenderDrawRectsF(), SDL_RenderFillRectF(), SDL_RenderFillRectsF(), SDL_RenderCopyF(), SDL_RenderCopyExF(), to allow floating point precision in the SDL rendering API.
Added SDL_GetTouchDeviceType() to get the type of a touch device, which can be a touch screen or a trackpad in relative or absolute coordinate mode.
The SDL rendering API now uses batched rendering by default, for improved performance
Added SDL_RenderFlush() to force batched render commands to execute, if you’re going to mix SDL rendering with native rendering
Added the hint SDL_HINT_RENDER_BATCHING to control whether batching should be used for the rendering API. This defaults to “1” if you don’t specify what rendering driver to use when creating the renderer.
Added the hint SDL_HINT_EVENT_LOGGING to enable logging of SDL events for debugging purposes
Added the hint SDL_HINT_GAMECONTROLLERCONFIG_FILE to specify a file that will be loaded at joystick initialization with game controller bindings
Added the hint SDL_HINT_MOUSE_TOUCH_EVENTS to control whether SDL will synthesize touch events from mouse events
Improved handling of malformed WAVE and BMP files, fixing potential security exploits
Linux:
Removed the Mir video driver in favor of Wayland
iOS / tvOS:
Added support for Xbox and PS4 wireless controllers in iOS 13 and tvOS 13
Added support for text input using Bluetooth keyboards
Android:
Added low latency audio using OpenSL ES
Removed SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH (replaced by SDL_HINT_MOUSE_TOUCH_EVENTS and SDL_HINT_TOUCH_MOUSE_EVENTS)
SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH=1, should be replaced by setting both previous hints to 0.
SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH=0, should be replaced by setting both previous hints to 1.
Added the hint SDL_HINT_ANDROID_BLOCK_ON_PAUSE to set whether the event loop will block itself when the app is paused.
Nice, thanks. Is OpenSL ES the default now? I did notice some latency in audio on Android in previous versions. Wonder if forcing OpenSL ES (if it’s not default) would be safe if targeting Android 6.0+?
I can’t to compile new downloaded version of SDL-2.0.10-12951via CMake on Android, previous version (2.0.9) compiled fine.
I don’t even know why it compiled hidapi PS4 and Xbox for Android gradle project, seems to it was added in macro(CheckHIDAPI)
C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c:389: error: undefined reference to 'hid_write'
C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c:518: error: undefined reference to 'hid_read_timeout'
C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_ps4.c:241: error: undefined reference to 'hid_get_feature_report'
C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c:235: error: undefined reference to 'hid_write'
C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_switch.c:230: error: undefined reference to 'hid_read_timeout'
C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c:372: error: undefined reference to 'hid_write'
C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c:718: error: undefined reference to 'hid_read_timeout'
C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_xbox360.c:277: error: undefined reference to 'hid_write'
C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapi_xboxone.c:276: error: undefined reference to 'hid_read_timeout'
C:/gdev/SDL2/src/joystick/hidapi/SDL_hidapijoystick.c:872: error: undefined reference to 'hid_enumerate'
Basically I don’t need SDL_JOYSTICK so I would like to disable it but with
set(SDL_JOYSTICK OFF CACHE BOOL “” FORCE)
set(HIDAPI OFF CACHE BOOL “” FORCE)
set(SDL_HAPTIC OFF CACHE BOOL “” FORCE)
I also receive a lot of compiler errors. How can I disable hidapi library without too many modifications in code ?
C:/gdev/SDL2/src/dynapi/SDL_dynapi_procs.h:0: error: undefined reference to ‘SDL_GameControllerClose_REAL’
C:/gdev/SDL2/src/dynapi/SDL_dynapi_procs.h:0: error: undefined reference to ‘SDL_HapticName_REAL’
C:/gdev/SDL2/src/dynapi/SDL_dynapi_procs.h:0: error: undefined reference to ‘SDL_JoystickOpen_REAL’
Finally I found a solution but I had to link all libraries as static:
I’ll try and find what caused it sometime soonish.
EDIT: I’ve fixed most of the problems using some hints and by ignoring remotes with only a few buttons (not opening them.) For Menu to return to the OS from the toplevel of the game, I needed this patch:
For some reason Menu was changed to Escape which makes it impossible to exit to the OS which I believe is part of Apple’s requirements of tvOS apps. For the record, I use this code in my event filter to handle the Menu button properly (I set pass_menu_to_os on the title screen to true.)
case SDL_APP_DIDENTERFOREGROUND:
SDL_SetHint(SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS, "0");
return 0;
case SDL_KEYDOWN:
case SDL_KEYUP:
if (event->key.keysym.sym == SDLK_MENU && pass_menu_to_os) {
SDL_SetHint(SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS, "1");
}
return 1;
I’m surprised this was done in a minor version increase, as it’s an API breaking change. I thought SDL was pretty keen on backwards compatibility? As I read, that’s why SDL_ShowCursor is global instead of per window.
We do occasionally change the API, especially around hints, which are not guaranteed functionality. We don’t ever intentionally break the ABI in minor versions.
Excuse my ignorance, but isn’t this this breaking the ABI? If I would swap out SDL2 for a newer version without recompiling anything it would suddenly start generating mouse events for touch events on android.