Sam Lantinga
46e1377d49
Automatically assign player indexes to game controllers, and allow changing the player index for game controllers and joysticks.
...
Added the functions SDL_JoystickFromPlayerIndex(), SDL_JoystickSetPlayerIndex(), SDL_GameControllerFromPlayerIndex(), and SDL_GameControllerSetPlayerIndex()
2019-12-20 20:12:03 -08:00
Sam Lantinga
b5aff9d7c3
Added SDL_GameControllerTypeForIndex() and SDL_GameControllerGetType() to return the type of controller attached.
2019-11-22 13:12:12 -08:00
Ozkan Sezer
405a3c821b
ran gendynapi.pl after newly added SDL_string.c functions.
2019-11-21 11:50:50 +03:00
Ozkan Sezer
eb8f14bb6a
added SDL_strtokr() as a replacement for POSIX strtok_r (bug #4046.)
2019-11-20 20:40:50 +03:00
Ozkan Sezer
a365c7f6fb
ran gendynapi.pl after SDL_HasARMSIMD() addition
2019-11-04 11:15:24 +03:00
Sylvain Becker
3d100df36f
Readability: remove const-qualifation from function declaration
...
const-qualification of parameters only has an effect in function definitions
2019-10-30 15:43:49 +01:00
Ryan C. Gordon
ec04110d8e
dynapi: Deal with failure cases better, other fixes.
...
Fixes Bugzilla #4803 .
2019-10-14 12:41:06 -04:00
Ryan C. Gordon
b38a5ba062
dynapi: Make gendynapi.pl work on older Perl releases.
2019-10-05 20:19:10 -04:00
Ozkan Sezer
a664e95d65
dynapi: move new SDL_LockTextureToSurface addition to the end of file.
2019-10-01 00:05:50 +03:00
Sylvain Becker
1ae61f1009
Added a helper function SDL_LockTextureToSurface()
...
Similar to SDL_LockTexture(), except the locked area is exposed as a SDL surface.
2019-09-30 20:58:44 +02:00
Sylvain Becker
70dc8d1648
Android: fix corresponding warnings
2019-08-30 08:55:20 +02:00
Alex Szpakowski
aebaa316c7
Add public APIs for creating a Metal view attached to an SDL window. Add SDL_metal.h.
2019-08-05 12:35:32 -03:00
Ozkan Sezer
ceee7def84
minor build fixes.
2019-07-31 00:05:28 +03:00
Sam Lantinga
316ff3847b
Fixed bug 4526 - replace SDL_RW* macros with functions for using in bindings
...
ace
I got this bug in SDL_ttf:
https://bugzilla.libsdl.org/show_bug.cgi?id=4524
Sylvain proposed solution:
SDL_RWseek(RWops, 0, RW_SEEK_SET);
And it works, but i can use it my project, because it written in C# with SDL2-CS wrapper and there not export for macroses:
#define SDL_RWsize(ctx) (ctx)->size(ctx)
#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
#define SDL_RWclose(ctx) (ctx)->close(ctx)
Therefore, I suggest replacing this macros with functions so that they can be exported and used in bindings
2019-06-08 17:43:23 -07:00
Sam Lantinga
8728ce4448
Fixed bug 4557 - SDL_SIMDAlloc and *Free should be in the public interface
...
Martin Gerhardy
These functions are really useful and should get exposed imo.
2019-06-08 14:54:37 -07:00
Sam Lantinga
de82759c84
Added support for building SDL as a dynamic library on iOS
2019-03-19 07:53:33 -07:00
Sam Lantinga
5e13087b0f
Updated copyright for 2019
2019-01-04 22:01:14 -08:00
Alex Szpakowski
5029d50ea8
Add SDL_TouchDeviceType enum and SDL_GetTouchDeviceType(SDL_TouchID id).
...
Touch device types include SDL_TOUCH_DEVICE_DIRECT (a touch screen with window-relative coordinates for touches), SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE (a trackpad-style device with absolute device coordinates), and SDL_TOUCH_DEVICE_INDIRECT_RELATIVE (a trackpad-style device with screen cursor-relative coordinates).
Phone screens are an example of a direct device type. Mac trackpads are the indirect-absolute touch device type. The Apple TV remote is an indirect-relative touch device type.
2018-11-10 16:15:48 -04:00
Ryan C. Gordon
62494a2e27
Merge SDL-ryan-batching-renderer branch to default.
2018-10-31 15:03:41 -04:00
Ryan C. Gordon
8340b0f0e2
render: Add floating point versions of various draw APIs.
2018-10-23 01:34:03 -04:00
Sam Lantinga
14329256cb
Generalized the XInput user index into a player index
2018-10-25 16:53:14 -07:00
Sam Lantinga
9987ca69f3
Added SDL_JoystickGetXInputUserIndex()
2018-10-25 12:54:42 -07:00
Ryan C. Gordon
1ecf4dfc5f
render: Added SDL_RenderFlush().
2018-10-04 16:34:44 -04:00
Ozkan Sezer
cbacb0f1ea
add missing include.
2018-10-14 23:50:50 +03:00
Ryan C. Gordon
acb05f50d8
thread: make SDL_CreateThreadWithStackSize() a public API.
2018-10-11 16:40:01 -04:00
Sam Lantinga
f225af0c1e
Added SDL_GetDisplayOrientation() to get the display orientation, and added a new event SDL_DISPLAYEVENT to notify the application when the orientation changes.
...
Documented the values returned by the accelerometer and gyroscope sensors
2018-08-22 21:48:28 -07:00
Sam Lantinga
6f758ad25f
Moved SDL_IsTablet() to a cross-platform API function
2018-08-21 20:03:54 -07:00
Sam Lantinga
7c3040e08a
First pass on the new SDL sensor API
2018-08-21 12:11:34 -07:00
Sam Lantinga
109544ca04
Add SDL_IsTablet() to Android and iOS SDL.
2018-08-21 11:23:47 -07:00
Sam Lantinga
d2042e1ed4
Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms.
...
Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API
2018-08-09 16:00:17 -07:00
Ethan Lee
b4fe7412f9
SDL_exp
2018-08-04 11:52:46 -04:00
Sam Lantinga
ff8c9538bc
Allow trapping the back button so right mouse click can work on some Android systems (thanks Rachel!)
...
Also, added a function SDL_AndroidBackButton() so applications can respond to the back button directly
2018-07-12 13:28:13 -07:00
Sam Lantinga
ef34704875
Fixed bug 4264 - SDL_CreateTextureFromSurface generates error message but returns ok
...
Anthony @ POW Games
SDL_CreateTextureFromSurface makes an internal call to SDL_GetColorKey which can return an error and spams the error log with "Surface doesn't have a colorkey" even though the original function didn't return an error.
2018-09-24 16:41:55 -07:00
Sam Lantinga
a515853569
Added support for external mouse in Samsung DeX mode
...
relative mode doesn't work, but absolute coordinates are functional
2018-06-18 13:14:02 -07:00
Sam Lantinga
113801b790
Added SDL_IsChromebook() to determine if we're running on a Chromebook.
2018-06-05 12:46:13 -07:00
Ryan C. Gordon
4df859c586
cpuinfo: Added SDL_HasAVX512F().
...
This checks for the "foundation" AVX-512 instructions (that all AVX-512
compatible CPUs support).
2018-05-21 11:35:42 -04:00
Ryan C. Gordon
e2619f1dcf
dynapi: don't let system loader resolve the initializer to the wrong version.
...
Fixes problems launching Firewatch on Linux (which statically links SDL but
also dynamically loads a system-wide copy from a plugin shared library) with
a newer SDL build.
2018-05-17 12:50:46 -04:00
Sam Lantinga
432312561f
Added SDL_LinuxSetThreadPriority() to directly set the priority of a Linux thread (tid)
...
This function tries using RealtimeKit connecting over DBUS as needed.
2018-04-23 19:18:52 -07:00
Sam Lantinga
a8ac588549
Added SDL_GameControllerMappingForDeviceIndex() to get the mapping for a controller before it's opened
2018-03-07 13:30:40 -08:00
sezero
40b27fd51b
revert the recent typecast assignment changes (see bug #4079 )
...
also change the void* typedefs for the two vulkan function
pointers added in vulkan_internal.h into generic function
pointer typedefs.
2018-02-12 17:00:00 +03:00
sezero
4c2a444e3a
add SDL_log10 and SDL_log10f to include and dynapi
2018-02-08 17:07:47 +03:00
Sam Lantinga
6ed184ec69
Added SDL_IsAndroidTV()
2018-02-06 15:03:35 -08:00
Sam Lantinga
90e72bf4e2
Fixed ISO C99 compatibility
...
SDL now builds with gcc 7.2 with the following command line options:
-Wall -pedantic-errors -Wno-deprecated-declarations -Wno-overlength-strings --std=c99
2018-01-30 18:08:34 -08:00
Sam Lantinga
e3cc5b2c6b
Updated copyright for 2018
2018-01-03 10:03:25 -08:00
Sam Lantinga
cf3d450313
Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder()
2017-12-08 14:30:10 -08:00
Sam Lantinga
a6a4e27ae8
Updated SDL's YUV support, many thanks to Adrien Descamps
...
New functions get and set the YUV colorspace conversion mode:
SDL_SetYUVConversionMode()
SDL_GetYUVConversionMode()
SDL_GetYUVConversionModeForResolution()
SDL_ConvertPixels() converts between all supported RGB and YUV formats, with SSE acceleration for converting from planar YUV formats (YV12, NV12, etc) to common RGB/RGBA formats.
Added a new test program, testyuv, to verify correctness and speed of YUV conversion functionality.
2017-11-12 22:51:12 -08:00
Sam Lantinga
bcdf8b916b
Added SDL_fmod() and SDL_fmodf()
2017-11-04 17:35:03 -07:00
Sam Lantinga
34502143d9
Added float versions of SDL's math functions
2017-11-04 15:34:14 -07:00
Ryan C. Gordon
729329068b
audio: Added SDL_AudioStreamFlush().
2017-10-19 18:05:42 -04:00
Sam Lantinga
80f8464d97
Added audio stream conversion functions:
...
SDL_NewAudioStream
SDL_AudioStreamPut
SDL_AudioStreamGet
SDL_AudioStreamAvailable
SDL_AudioStreamClear
SDL_FreeAudioStream
2017-10-18 15:54:05 -07:00
Sam Lantinga
9c580e14c9
Added functions to query and set the SDL memory allocation functions:
...
SDL_GetMemoryFunctions()
SDL_SetMemoryFunctions()
SDL_GetNumAllocations()
2017-10-12 13:44:28 -07:00
Sam Lantinga
d90fce3c9e
Exposed the joystick locking functions for multi-threaded access to the joystick API
2017-10-10 11:10:15 -07:00
Ryan C. Gordon
fb28393200
vulkan: use "unsigned int" instead of "unsigned"
2017-09-06 19:35:36 -04:00
Sam Lantinga
37ce9f2773
Fixed typedef redefinition errors when including both SDL_vulkan.h and vulkan.h
...
You should always include vulkan/vulkan.h first, then include SDL_vulkan.h
2017-08-27 23:13:15 -07:00
Sam Lantinga
eb5392ad61
Added the new Vulkan API functions to exported functions
2017-08-27 20:41:29 -07:00
Sam Lantinga
b7c5d15152
SDL_dynapi.c: add missing SDLCALL to macros.
2017-08-27 18:53:30 -07:00
Sam Lantinga
a38f127e88
Swapped conditional arguments for standard SDL readability
2017-08-27 18:52:43 -07:00
Sam Lantinga
30fe9a6799
SDL_dynapi.h: revert commit ee88fe3e353e in order to enable dynapi
...
[ optional ]
2017-08-27 18:49:36 -07:00
Sam Lantinga
50d3fe21aa
SDL_dynapi_procs.h: adjust SDL_CreateThread for os/2
2017-08-27 18:49:11 -07:00
Ryan C. Gordon
8c39d1d0b5
OS/2: fixed inverted logic bug (thanks, Ozkan!).
2017-08-25 12:27:18 -04:00
Ryan C. Gordon
2213077a95
OS/2: proper fix for dynapi (thanks, Ozkan!).
2017-08-25 11:31:12 -04:00
Ryan C. Gordon
a3890ff6d7
dynapi: fill in OS/2 loading code (thanks, Ozkan!).
...
Partially fixes Bugzilla #3765 .
2017-08-22 15:50:39 -04:00
Sam Lantinga
f6ad070b82
SDL_dynapi.h: disable dynapi for os/2.
2017-08-21 13:00:58 -07:00
Sam Lantinga
f142a7961e
Fixed bug 2441 - SDL_DuplicateSurface
...
Rainer Deyke
I've written a small patch that adds a small SDL_DuplicateSurface function to SDL. I've written the function as part of a larger (as yet unfinished) patch, but I think this function is useful enough that it merits inclusion in SDL on its own.
2017-08-14 13:37:14 -07:00
Sam Lantinga
c59d9923b3
Implemented more flexible blending modes for accelerated renderers
...
This fixes bug 2594 - Propose new blend mode, SDL_BLENDMODE_BLEND_DSTA
blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA,
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
SDL_BLENDOPERATION_ADD,
SDL_BLENDFACTOR_ZERO,
SDL_BLENDFACTOR_ONE,
SDL_BLENDOPERATION_ADD);
This fixes bug 2828 - Subtractive Blending
blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA,
SDL_BLENDFACTOR_ONE,
SDL_BLENDOPERATION_SUBTRACT,
SDL_BLENDFACTOR_ZERO,
SDL_BLENDFACTOR_ONE,
SDL_BLENDOPERATION_SUBTRACT);
This goes partway to fixing bug 3684 - Add support for a pre-multiplied alpha blending mode
blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_ONE,
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
SDL_BLENDOPERATION_ADD,
SDL_BLENDFACTOR_ONE,
SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
SDL_BLENDOPERATION_ADD);
2017-08-14 05:51:44 -07:00
Sam Lantinga
f1829d956f
Added SDL_wcscmp()
2017-08-13 20:37:49 -07:00
Sam Lantinga
dc40018438
Added an API SDL_LoadFile_RW() to load all the data from an SDL data stream, and a convenience macro SDL_LoadFile() to load all the data from a file.
2017-08-09 11:58:38 -07:00
Ryan C. Gordon
22241ed0b0
Support for QNX 7.0 (thanks, Elad!).
...
Fixes Bugzilla #3686 .
2017-07-01 17:50:47 -04:00
Ryan C. Gordon
d4086e4a70
stdlib: added SDL_utf8strlen().
2017-05-29 03:01:05 -04:00
Sam Lantinga
763e138903
Added an API to get the joystick instance ID before opening the device: SDL_JoystickGetDeviceInstanceID()
2017-03-09 16:09:16 -08:00
Sam Lantinga
06ccb71bcd
Make sure the memory barrier functions are always available, and now they are implemented on Android __ARM_ARCH_5TE__
2017-02-10 11:21:15 -08:00
Sam Lantinga
3c90a52aa7
Added an API to get the type of a connected joystick
2017-01-27 05:59:58 -08:00
Sam Lantinga
4938c5054e
Added SDL_JoystickGetAxisInitialState() to get a joystick axis' initial value.
...
This is useful for controller mapping programs to determine an axis' zero state
2017-01-04 10:28:07 -08:00
Sam Lantinga
45b774e3f7
Updated copyright for 2017
2017-01-01 18:33:28 -08:00
Sam Lantinga
85d8a79f65
Fixed updated return value for SDL_GL_SwapWindow()
...
Ozkan Sezer
http://hg.libsdl.org/SDL/rev/464a2676d8ab seems to have
forgotten removing the return from SDL_dynapi_procs.h, and this patch
does that. Without it, MSVC warns:
c:\sdl2\src\dynapi\SDL_dynapi_procs.h(598) : warning C4098:
'SDL_GL_SwapWindow_DEFAULT' : 'void' function returning a value
c:\sdl2\src\dynapi\SDL_dynapi_procs.h(598) : warning C4098:
'SDL_GL_SwapWindow' : 'void' function returning a value
2016-12-12 09:19:48 -08:00
Sam Lantinga
8414c3d4ae
Fixed ABI, don't change the return type of SDL_GL_SwapWindow()
2016-12-11 12:01:44 -08:00
Sam Lantinga
524bf3c282
Fixed bug 3513 - SDL_GL_SwapWindow does not return error status
...
Return an error code from SDL_GL_SwapWindow(), like the other SDL APIs.
2016-12-09 01:47:43 -08:00
Sam Lantinga
dd5d85a4e7
Added an API to iterate over game controller mappings
2016-11-29 06:36:57 -08:00
Sam Lantinga
3615633571
Renaming of guard header names to quiet -Wreserved-id-macro
...
Patch contributed by Sylvain
2016-11-20 21:34:54 -08:00
Ryan C. Gordon
35430a73f2
cpuinfo: first attempt at SDL_HasNEON() implementation.
2016-11-17 01:15:16 -05:00
Sam Lantinga
ac74e16cde
Standardized the format of the SDL joystick GUID and added functions to retrieve the USB VID/PID from a joystick and game controller.
2016-11-10 17:19:34 -08:00
Sam Lantinga
9a8642bd6a
Fixed bug 3478 - Patch Haiku to use dlopen instead of load_add_on
...
Kai Sterker
SDL2 on Haiku so far uses Haiku-specific APIs for loading dynamic objects as add-ons, instead of using dlopen to load them as libraries. This, for example, leads to SDL_mixer not being able to load its audio backends, when compiled with standard settings.
As discussed at https://www.freelists.org/post/haikuports/SDL2-mixer-ogg-music-not-playing-and-other-stuff,2 , the best way to deal with this would be using dlopen instead of load_add_on. The following patch implements this change by dropping the Haiku-specific bits and using dlopen instead.
2016-11-01 10:30:46 -07:00
Sam Lantinga
27d4f09929
Implemented SDL_GetHintBoolean() to make it easier to check boolean hints
2016-10-07 23:40:44 -07:00
Sam Lantinga
d2676c2985
Fixed bug 2924 - SDL_CreateRGBSurface[From] versions that take SDL_PIXELFORMAT enum
...
Daniel Gibson
Currently, SDL_CreateRGBSurface() and SDL_CreateRGBSurfaceFrom() take Uint32 masks for RGBA to "describe" the Pixelformat of the surface.
Internally those value are only used to map to one of the SDL_PIXELFORMAT_* enum values that are used for further processing.
I think it would be both handy and more efficient to be able to specify SDL_PIXELFORMAT_* yourself without using SDL_PixelFormatEnumToMasks() to create masks first, so I implemented functions that do that:
SDL_CreateRGBSurfaceWithFormat() and SDL_CreateRGBSurfaceWithFormatFrom() which are like the versions without "WithFormat" but instead of taking 4 Uint32s for R/G/B/A masks, they take one for a SDL_PIXELFORMAT_* enum value.
Together with https://bugzilla.libsdl.org/show_bug.cgi?id=2923 creating a SDL_Surface* from RGBA data (e.g. from stb_image) is as easy as
surf = SDL_SDL_CreateRGBSurfaceWithFormat(0, w, h, bppToUse*8, SDL_PIXELFORMAT_RGBA32);
2016-10-07 17:04:58 -07:00
Ryan C. Gordon
4f4c4b629f
Added SDL_SetWindowResizable(). (thanks, Ethan!)
2016-09-29 22:52:41 -04:00
Ryan C. Gordon
7315390171
audio: Implemented buffer queueing for capture devices (SDL_DequeueAudio()).
2016-08-06 02:47:27 -04:00
Philipp Wiesemann
de5daaad6a
Fixed compile warnings about evaluating undefined identifiers.
...
Partially fixes Bugzilla #3351 .
2016-07-17 20:32:44 +02:00
Philipp Wiesemann
37a5416784
PSP: Deactivated dynamic API.
...
Thanks to Bugzilla #3240 for pointing this out.
2016-02-13 17:35:38 +01:00
Ryan C. Gordon
5dcf6bcc32
Updated dynamic API table.
2016-01-07 14:51:22 -05:00
Ryan C. Gordon
d4aedf9951
Added SDL_SetWindowModalFor().
...
This is currently only implemented for X11.
This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2015-04-21 09:45:58 -04:00
Ryan C. Gordon
e497e46515
Added SDL_SetWindowInputFocus().
...
This is currently only implemented for X11.
This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2016-01-05 02:28:56 -05:00
Ryan C. Gordon
3bdaf4c611
Added SDL_SetWindowOpacity() and SDL_GetWindowOpacity().
...
This is currently implemented for X11, Cocoa, Windows, and DirectFB.
This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2016-01-05 02:46:10 -05:00
Ryan C. Gordon
5696e88e6b
Added SDL_GetWindowBordersSize().
...
This is currently only implemented for X11.
This patch is based on work in Unreal Engine 4's fork of SDL,
compliments of Epic Games.
2016-01-05 02:29:06 -05:00
Ryan C. Gordon
c3114975db
Added SDL_GetDisplayUsableBounds().
2016-01-04 23:52:40 -05:00
Ryan C. Gordon
fa8c83c1c1
Remove almost all instances of "volatile" keyword.
...
As Tiffany pointed out in Bugzilla, volatile is not useful for thread safety:
https://software.intel.com/en-us/blogs/2007/11/30/volatile-almost-useless-for-multi-threaded-programming/
Some of these volatiles didn't need to be, some were otherwise protected by
spinlocks or mutexes, and some got moved over to SDL_atomic_t data, etc.
Fixes Bugzilla #3220 .
2016-01-03 06:50:50 -05:00
Sam Lantinga
42065e785d
Updated copyright to 2016
2016-01-02 10:10:34 -08:00
Ryan C. Gordon
e6ad29aec8
Added SDL_JoystickFromInstanceID() and SDL_GameControllerFromInstanceID().
2015-11-14 12:35:45 -05:00
Sam Lantinga
e015140af3
SDL - add dynapi entry points for SDL_JoystickCurrentPowerLevel
2015-09-30 15:38:18 -07:00
Alfred Reynolds
b0e145b3e1
Move GetDisplayDPI to the end of the file.
2015-07-29 17:19:06 -07:00
Alfred Reynolds
61c7415071
Add SDL_GetDisplayDPI routine and implement for Windows.
2015-07-29 17:18:56 -07:00