Compare commits

...
545 Commits
Author SHA1 Message Date
alufolie91 6039dae85b point2uint for blua interning string cache 2026-09-21 17:02:14 +02:00
alufolie91 cc9a24e979 move memerrmsg 2026-09-21 17:02:11 +02:00
Roberto Ierusalimschy 9b9bf70ab8 detail (string cache a bit smaller by default) 2026-05-27 20:16:52 +02:00
Roberto Ierusalimschy be2b7ebfcc code for string cache generalized for "associative sets" (compiler
will optimize away or inline the extra loops)
2026-05-27 20:16:48 +02:00
Roberto Ierusalimschy 091c6e37dd 'clearapihash' -> 'luaS_clearcache' and moved to 'lstring.c' (which
keeps all code related to this cache)
2026-05-27 20:16:45 +02:00
Roberto Ierusalimschy 694e82d4f6 new cache for interning strings 2026-05-27 20:16:42 +02:00
Roberto Ierusalimschy 530116cd76 keep memory-error message in the global state, so that its use
does not depend on Lua internalizing strings to avoid a string
creation on memory errors
2026-05-27 20:16:35 +02:00
alufolie91 84b60dadce blua: readd fast track for gettable operations again
this time properly
the set ones are pretty much incompatible with usedindex, so cant use them
2026-05-15 21:07:10 +02:00
alufolie91 f82d138482 cleanup some things 2026-05-15 13:00:30 +02:00
alufolie91 e7332a3efe Revert "Blua: implementation of fast track for gettable operations"
This reverts commit e4e51f0f80.
2026-05-15 11:54:10 +02:00
alufolie91 bd27a62769 Revert "Blua: fast track for 'settable'"
This reverts commit bdae0ef4ae.
2026-05-15 11:53:59 +02:00
alufolie91 2b650e4b61 Revert "Blua: 'Protect' in table operations is not needed in the fast track"
This reverts commit 537a50b9b3.
2026-05-15 11:53:53 +02:00
alufolie91 8e82256827 Revert "Blua: 'luaV_fastget' only treats the real fast case (table with a non-nil value at given key, so that it does not need to check metamethods)"
This reverts commit 019812db08.
2026-05-15 11:53:46 +02:00
alufolie91 4fa937728b Revert "Blua: OP_SELF can use 'luaV_fastget' specialized for strings, as it is applied only to string keys"
This reverts commit 0fb752b745.
2026-05-15 11:53:42 +02:00
alufolie91 9f9e6450f2 Revert "Blua: opcode OP_SELF operate only with string keys, so they can use fast-track table access"
This reverts commit 7684e6aa07.
2026-05-15 11:53:33 +02:00
alufolie91 1c75dd0401 Revert "blua: fix copy paste error for "slow path" in auxgetstr/lua_getfield"
This reverts commit b652d802f5.
2026-05-15 11:53:26 +02:00
alufolie91 e854096ca0 revert back to number based player names fallbacks
well need our player 1-16 not player a-z :chonkbuncle:
2026-05-15 03:11:52 +02:00
toaster 83a60ea857 Some fixes for bad player info on joining servers.
* Don't overwrite the first player's name when joining with multiple local splitscreen players. (resolves #151)
* The defaults for unprovided names are now consistently "Player A/B/C/D" as opposed to some being letter-based and some being number-based.
* Send local player info once per local splitscreen player, rather than n^2 times (where n is the number of local splitscreen players).
* Since the packet *requires* four names to be sent every time you join a server, send dummy names for local splitscreen players who aren't connecting, instead of your actual cvars (no data leakage you didn't ask for!)
2026-05-15 03:11:03 +02:00
toaster 3d9d14b353 EnsurePlayerNameIsGood: Remove trailing whitespace, instead of just failing on it
Interesting error with its recursive duplication resolving exposed by the previous commit!
2026-05-15 03:11:00 +02:00
alufolie91 24c9f88262 make snacpending error print player number
bit more informative :chaosleep:
2026-05-15 01:28:02 +02:00
alufolie91 b652d802f5 blua: fix copy paste error for "slow path" in auxgetstr/lua_getfield
lets hope this fixes the random crashes from gc sometime
stimky from https://github.com/Indev450/SRB2Kart-Saturn/pull/223/changes/e4e51f0f80fb7deb9213c72bb374d0a7e4c3f03b
2026-05-15 01:09:19 +02:00
alufolie91 459beeb000 fix oopsie from https://github.com/Indev450/SRB2Kart-Saturn/commit/093ed023ef36bb2e8608116ef39d7710366ccf84 2026-05-15 00:36:36 +02:00
indev a28d798189 Remove some redundant mo != NULL asserts if they are followed by !P_MobjWasRemoved(mo) asserts 2026-05-15 01:24:14 +03:00
indev e75a696ee5 Remove outdated PARANOIA assert in P_SetMobjState, it uses P_SetPlayerMobjState automatically for players now 2026-05-15 01:06:04 +03:00
alufolie91 e113027ce6 d_netcmd: fix snacpending stuff
also move all of it behind PARANOIA define, since nothing else was using it eitherway
2026-05-14 21:25:53 +02:00
alufolie91 2ce4e866e3 reorder seg_t struct a bit
fixes a 4byte hole so we can fit everything important into cacheline 1
even when compiled without HWRENDER this should be a better layout
checked per pahole
2026-05-14 18:56:43 +02:00
alufolie91 55a57a1036 fix checking for fbo completeness too early
this should come after everything apparently
all this shit really needs to be cleaned up again
2026-05-12 21:02:15 +02:00
alufolie91 6aabdc86c0 P_TryMove: reduce the amount of R_PointInSubsector per call
and also P_PlayerTouchingSectorSpecial
since either are in a loop that often runs multiple times per call
improves perf a bit per usual testing
2026-05-12 15:38:43 +02:00
indev 9aaa7cc5bf Don't break non-string keys in ArchiveTables when printing error message 2026-05-12 03:52:56 +03:00
alufolie91 d6946d4d44 fix HWR_RenderPolyObjectPlane
smol oopsie that was supposed to be float
fixes the rotating skybox thing in Zero Space
2026-05-11 15:08:14 +02:00
alufolie91 a868844bdf remove outdated comment about precipmobj 2026-05-10 20:15:28 +02:00
alufolie91 39fd31c4b9 p_mobj: potentially save a few more floor/ceiling z checks in some cases
+ some other crap
2026-05-10 20:15:24 +02:00
alufolie91 54f3d7b5e0 move lua_tostring out of the loop in mapheaderinfo_get
does not need to be reevaluated constantly
2026-05-10 16:57:45 +02:00
alufolie91 88116368bb fix potential null pointer deref in P_LineOpening
again ive never seen this hit, but the mobj gets checked right below its radius get dereferenced within the floorz/ceilingz functions which kinda annoyed me lol
as a fallback i just the floor/ceiling sectorheights, which were used before the addition of slopes
2026-05-09 20:00:19 +02:00
alufolie91 9328825a7c fix potential null pointer deref in P_MobjFloorZ/CeilingZ
dont think this ever really hit, but boundsec indeed can be null
it also gets checked if its null above anyways, so why not here?
2026-05-09 20:00:07 +02:00
alufolie91 f825ca32cc add "HAVE_IPV6" to passtrough compiler flags
to allow compiling with ipv6 support
to note this is unsupported from our side, as purely ipv6 servers are unreachable from vanilla clients
2026-05-09 15:33:48 +02:00
alufolie91 ce982d170f change "important" hook_state field to be bool type
matches the others
prob no diff in practice at all
2026-05-08 14:38:57 +02:00
alufolie91 1b3050028e save a few mobjfloorz/ceilingz calls in some cases
gave a small speedup on my test setup (+~3fps)
on slopes those are rather expensive
2026-05-08 14:38:47 +02:00
alufolie91 2344552ba8 Opengl: enable stencil testing only when portals are used
maybe a bit of perf on non portal maps, prob neglible but why not
2026-05-07 16:26:42 +02:00
alufolie91 50c1263e7d OpenGL: only enable stencil testing during level render
not 100% sure if this is the most correct thing, but this causes issues with Nvidia Gpu´s under x11
should fix https://github.com/Indev450/SRB2Kart-Saturn/issues/226
2026-05-06 12:28:08 +02:00
alufolie91 f1ded99262 some code style cleanups 2026-05-06 12:28:05 +02:00
alufolie91 b1620a3fce delet I_ShutdownConsole spam
without process forking I_ShutdownSystem will handle it, otherwise the parent process calls it before exiting
2026-05-04 23:02:04 +02:00
alufolie91 d0ea4d20d0 fix parent process being killed before child per interrupt/terminate signals
by ignoring those signals
otherwise the terminal will be left in a weird state, aswell as the parent exit stuff wont be properly run
this was "fine" before https://github.com/Indev450/SRB2Kart-Saturn/commit/f4dc161831a988e725e8639b9674984ebdf5f6bb but now needs to be handled like this
2026-05-04 23:02:01 +02:00
alufolie91 7f4804f98c fix super rare underflow within FixedHypot if input is -2147483648
this has an insanely rare chance of happening in certain cases (train rush map has a few spots where this is somewhat likely)
abs does not really handle -2147483648 and its result is pretty much implementation defined/ub, since we compile with fwrapv flag it would just return -2147483648 which will cause this to try and access tantoangle at a negative index
we can just return INT32_MAX here since treating either as 2147483647 would return 2147483647 eitherways
2026-05-04 14:10:49 +02:00
alufolie91 4fe3495652 fallback to srb2back instead of hoping the map is still loaded for intermission bg
timescale and replay fastforward caused stuff to crash and well this is better than a whitescreen ig
2026-05-04 10:28:32 +02:00
alufolie91 3c409b4a46 detect kill signal when printing signal from signalhandler
bit more informative than "signal number 9"
2026-05-04 10:01:26 +02:00
alufolie91 45067e00a5 fix compiler warnings + "support" gcc16 2026-05-04 08:04:08 +02:00
alufolie91 370ed1583b comment out unused spritescale/offset fields from gl_vissprite_t
yes those are in fact unused
not deleting since they might be useful for something sometime....
2026-05-02 21:02:50 +02:00
alufolie91 535c2073f1 move palshader code out of HWR_DrawScreenFinalTexture
and make the whole handling safer so we have less chance of ending up with blackscreens should the palette render shader fail
2026-05-01 03:51:28 +02:00
alufolie91 6460ae94f1 remove magic number for P_CalculatePrecipFloor stuff 2026-04-29 17:55:16 +02:00
alufolie91 093ed023ef cleanup CL_DrawConnectionStatus a little 2026-04-29 17:55:13 +02:00
minenice55 1bada2810a cap download size to total size in the connection UI 2026-04-29 17:55:10 +02:00
alufolie91 9df7f3cd3f dont let saltyhop overwrite the players spriteyoffset
let it add to it instead
otherwise if we ever use it for smth else in hardcode saltyhop will work with it
2026-04-29 17:55:04 +02:00
alufolie91 010b6c0361 use destructor attribute for W_Shutdown
makes sure this is always called in any case
also just simpler
2026-04-29 17:55:01 +02:00
alufolie91 dbf67a9670 remove some branch hints in some places
should really only use those for things that are basically dead but gotta be kept for compat reasons and such
2026-04-29 17:54:58 +02:00
alufolie91 8868445c3c S_UpdateSounds: init listenmobj
not sure why but ubsan did complain about it sometimes
S_StartSoundAtVolume also just memsets it so why not do the same here anyways
2026-04-29 17:54:55 +02:00
alufolie91 568cb8b8c7 check I_GetNodeAddress is set before use
this might´ve not been init yet at that point
2026-04-27 22:02:43 +02:00
alufolie91 3b00a69615 prevent buffer underflow within holepunching 2026-04-27 22:02:39 +02:00
alufolie91 6949ce82ab k_hud: fix achii speedometer not being properly coloured with colourhud
oopsie smol oversight from me
2026-04-23 10:07:40 +02:00
alufolie91 c343c52477 remove "extra3" hud stuff
decided to finally make smol stickers for the beta hud
this was never a really great solution since it made things look pretty bad at certain resolutions/scales
still keep the loading code for convenience but honestly not needed aswell at this point
2026-04-23 10:07:35 +02:00
alufolie91 7931a82b23 attempt to fix a plethora of buffer overflows when trying to connect to a server that does not exist
ex: if you typo´d the serveraddress
this really aint pretty but idk how to make things not turn into limbo hell otherwise
2026-04-21 20:52:15 +02:00
alufolie91 31ccf9c34a optimize K_CheckOffroadCollide further
also makes this alot more readable
like this most of the time we dont have to ever check the players floorz nor ceilingz at all since we check if the sector the players mobj is in is even offroad at all
nothing super big but i did see an improvement of around 1fps in my usual benchmark
2026-04-18 18:46:58 +02:00
alufolie91 ff3b73c49e fix offroad oopsie causing desynch
ye def not confusing at all to suddenly switch the meaning of floor and ceiling
2026-04-17 20:53:24 +02:00
alufolie91 64bed71509 add toggle to allow controllers to control the game while window is unfocused
can be toggled with "gamepadunfocused" or in the focus options
2026-04-17 18:54:18 +02:00
alufolie91 eed5943b0b optimize K_CheckOffroadCollide a little bit
no need to always check both the mobjs floor and ceiling z coordinates, those are surprisingly complicated checks on slopes
2026-04-17 17:46:17 +02:00
alufolie91 4f9ddffe2a d_cliserv: check for splitscreen nodes first in clientcmd handler
so we dont always have to check a bunch of things that most of the time wont apply anyways
2026-04-17 17:46:17 +02:00
alufolie91 a73f3a073c hw_main: dont need to do sprite billboarding stuff with shearing enabled within HWR_SplitSprite 2026-04-17 17:46:17 +02:00
alufolie91 a59928221b few more cleanups and super tiny optimizations k_hud 2026-04-16 17:39:13 +02:00
Eidolon b46e5cb577 gl: Fix sky dome VBO leak 2026-04-15 23:51:15 +02:00
alufolie91 bb62fbfc12 add "USEJEMALLOC" make flag to link against "jemalloc" allocator
on my linux system and usual benchmark setup this improves performance quite significantly (+~12fps)
this relies on jemalloc to be installed as a separate library for now and is more a convenience thing
2026-04-15 23:51:15 +02:00
GenericHeroGuy 81f46224e1 Fix asan error when pressing shift and arrow key
Also fix addons menu ignoring shift when capslock is on!
Also also fix capslock+rshift still typing uppercase letters!
2026-04-15 18:08:03 +02:00
NepDisk 6c58c0de41 Add support for using custom SDL2 mappings 2026-04-14 20:25:31 +02:00
alufolie91 4edc102d67 hack: fix intermission background becoming white after resolution change 2026-04-12 15:23:53 +02:00
alufolie91 e0bf663157 Hack: fix intermission screen displaying whitescreen in some cases
does not fix whitescreen when switching resolutions while in intermission screen, but oh well
lets hope there will be no issues with calling D_Renderview in intermission state, but it seems to work from quick testing lul
2026-04-12 15:05:51 +02:00
alufolie91 eccc3eb33f print opengl extensions in new lines for ogllog
otherwise this may still get truncated and lots of text editor also complain about a super long single line of text
also fix null ptr dereferencing into strtok should strdup return null
2026-04-12 14:30:49 +02:00
indev 1217089d81 G_UseContinue is unused, delet it 2026-04-11 21:53:15 +03:00
alufolie91 e5c0967a3f BLUA: simplify lua number hash 2026-04-11 16:49:19 +02:00
indev 27f22e4b5b Use case insensitive string hashing and compare functions for cvar hashtable 2026-04-09 19:09:37 +03:00
alufolie91 c039d14efc remove even more unused stuff 2026-04-08 22:42:34 +02:00
alufolie91 71a0b25e32 remove old and unused menu player description stuff
hope ignorelines is the correct thing to well ignore lines lol
2026-04-08 22:42:31 +02:00
alufolie91 8c2132a98c remove a few more unused things 2026-04-08 21:54:32 +02:00
alufolie91 898bcd336d should be
:chonkbuncle:
2026-04-08 18:53:43 +02:00
alufolie91 5461a6dcbe cleanup skinselect menu stuff slightly 2026-04-08 14:56:44 +02:00
alufolie91 d957bddc1f update opengl dithering shader
now works more like i intended too by more or less scaling the pattern to be roughly the same size on each resolution and trying to reduce precision issues by using floor to convert float values to integer range
2026-04-08 14:39:09 +02:00
alufolie91 7177a9f57f raise version to v9.3 2026-04-07 17:53:11 +02:00
alufolie91 4ccf3dfaf9 software: make R_DrawWallColumn being able to render "holey" textures
not the most efficient but idk a better solution to this, and clipping code may cause some other undesired effects, but well were not supposed to be drawing textures with holes on single sided walls eitherways, but here we are
basically this copies columns into a buffer filled with cyan pixels, so the holes become cyan instead of nothing, which we can cut again using the twomultipatch drawers
fixes the "melt" effect on some things like spelunky or music plant (and well reading/writing oob)
2026-04-05 20:37:24 +02:00
indev 489a58f9fd Allocate all colormaps with PU_STATIC 2026-04-05 18:31:55 +02:00
alufolie91 b26effa241 Merge pull request #223 from Indev450/bluaopti2
Some optimizations and fixes for BLUA from LUA
2026-04-05 18:28:50 +02:00
alufolie91 efd8c20d26 enable lto by default on makefile builds
change flag to NOLTO to disable lto
at this point we shouldnt have any issues anymore since the utter crapton of bugfixes
2026-04-05 18:26:16 +02:00
alufolie91 03b85aa00e Merge pull request #225 from Indev450/optifindvar
Speed up CV_Findvar & CV_FindNetVar with hashtable
2026-04-04 17:05:25 +02:00
indev e6434c24ec Fix spelling in server addon info tooltip 2026-04-04 18:01:10 +03:00
indev 52e23e7b08 Merge pull request #224 from Indev450/addon-download-info
Addon download info
2026-04-04 14:49:38 +00:00
indev b84e6d89e2 Add toggle for server addons info hud into settings 2026-04-04 17:24:58 +03:00
indev 42fa435a0b Add toggle for server addon info 2026-04-04 17:17:11 +03:00
indev 873cff4474 Display information about addon types loaded on server when joining (WIP) 2026-04-04 17:17:09 +03:00
indev e543599598 Add option to hide skin name from stat display 2026-04-04 16:54:17 +03:00
alufolie91 9d75bb1405 hw_main: reorder things, mark const, remove pointless check for polyobject planes
like normal planes, polyobject planes will just reallocate their vertex buffer eitherways according to size, so that check does not make much sense, srb2 also did remove it a while ago
2026-04-04 15:47:02 +02:00
indev 7b0e3269b3 Add option to hide finished players from minimap 2026-04-04 16:37:15 +03:00
alufolie91 12169bfb38 controllers:check if controller supports addressable led and rumble 2026-03-29 13:50:13 +02:00
alufolie91 4dd5957f19 cache islocalplayer in P_SpectatorJoinGame 2026-03-29 13:50:10 +02:00
alufolie91 0fadfe0f72 dehacked: fixup lua_enumlib_sprintf_upper
apparently reusing a va list like that is ub, so we should just copy it if we want to reuse it
also fix the resize check, since vsnprintf return does not include 0 terminator which we need to account for

also make this part of dehacked.c a bit more readable lol
2026-03-29 10:58:51 +02:00
alufolie91 621df7e296 v_video: make stringwidth loops safer 2026-03-28 23:39:21 +01:00
alufolie91 17d72e02fe cleanup some redundant/dead code 2026-03-28 23:39:17 +01:00
alufolie91 cd76660314 restore intended behavior for cvar menu categories
for onchange functions
2026-03-28 23:39:01 +01:00
alufolie91 06a9ab785e add misssing break K_SpawnBattlePoints
oopsie, somehow this seems to never caused any issues?
2026-03-28 23:06:10 +01:00
indev 6760546bcd I thought i reverted debug print aaaaaaaa 2026-03-29 00:34:11 +03:00
indev b44e003ab9 This is intended to be empty string, this way it reads the rest of the string including '=' :p 2026-03-29 00:29:38 +03:00
alufolie91 6a1c907aa4 bunch of random fixes
-handle more memory allocation failures
-fix null pointer dereferences
-prevent writing out of bounds while writing filenames for D_ParseFileneeded
-prevent reading out of bounds while checking for new target in director
-fix Update_MS checking against an unitialized value in some cases
-fix assert for AddLumpToCache since strlen on non null terminated strings is UB
-cleanup and rearrange R_DrawColumn
-cleanup musicdef parser a little

all in one commit cause idk would be ugly if those were seperate ig
2026-03-28 00:45:15 +01:00
indev fded8cc562 Crash fix for super tiny resolutions
Not really sure if anyone would actually want to play on something that
is lower than 320x200 but this prevents zero division in V_Recalc at least
2026-03-27 22:05:11 +03:00
alufolie91 43465c0e3f add debug print for fallback flashpals 2026-03-26 18:29:46 +01:00
alufolie91 7fb21c35ba Experiment: speed up CV_FindVar and CV_FindNetVar
oftentimes lua scripts call CV_FindVar a fuckton of times during runtime, with many cvars this can actually tank performance more than one might think
ideally lua scripts should cache the result, but with so much stuff and servers we cant expect everyone to go through all scripts to do that
using a hashtable for CV_FindNetVar might improve join times aswell, but needs further testing to confirm
2026-03-25 19:35:20 +01:00
alufolie91 f6a0430a40 use constructor for W_Startup
never liked having this inside i_system
2026-03-25 19:35:17 +01:00
alufolie91 ab209448d1 Introduce GNU constructor and destructor attributes
The constructor attribute causes the function to be called automatically before execution enters main (). Similarly, the destructor attribute causes the function to be called automatically after main () has completed or exit () has been called. Functions with these attributes are useful for initializing data that will be used implicitly during the execution of the program.

added "used" attribute aswell so compiler does not omit non referenced functions (i hope)
gotta test this a bit but seems cool for stuff like verstable maps
2026-03-25 19:35:14 +01:00
alufolie91 9334b86f6e console print for playing demos from replayhut
might be useful
perhaps this should be put into g_doplaydemo instead?
2026-03-25 19:34:56 +01:00
alufolie91 6022966d69 G_DoPlayDemo: fix demoname becoming garbage when replay restarts/rewinds
only used in the error paths, which we shouldnt reach
but im not a fan of having a chance of putting garbo in the console
2026-03-25 19:34:54 +01:00
indev 6c7db705c7 Strip colors from demo titles for replay search 2026-03-25 21:05:39 +03:00
indev ce3d17de68 Simplify R_DoPlayerFade crash fix a bit and rename playerdist to otherplayerdist 2026-03-25 20:24:37 +03:00
alufolie91 404d88a536 remove some dead code 2026-03-24 01:07:07 +01:00
indev 4f28f574bb Fix rare crash in R_DoPlayerFade when viewplayerdist is too low 2026-03-24 00:20:28 +03:00
alufolie91 654895dcff fix timedemo not accounting for level and addon loading
apparently demos used to send a mapcmd before instead of directly calling G_InitNew, so this function was never called which meant that timedemos always returned a wrong result first time
2026-03-23 19:05:37 +01:00
alufolie91 8af43a55c9 split CONS_Printf
so both CONS_Alert and CONS_Debug dont have to handle and copy the varargs twice
probably makes no actual difference in practice, but i prefer it to not do pointless work
2026-03-22 22:29:21 +01:00
alufolie91 0d20ebb01f delet P_CyclePlayerMobjState
P_SetMobjState already handles player case and forwards it to P_SetPlayerMobjState
so this is just duped code
2026-03-22 22:17:45 +01:00
alufolie91 1c74b37026 unify console shift handling
both the non AZERTY and AZERTY functions basically did the exact same thing so can just get rid of one
also simplify some checks
2026-03-22 22:14:19 +01:00
indev 6721f534cc Fix Got_Saycmd not skipping null terminator when message has maximum length 2026-03-22 22:16:55 +03:00
indev bb3414d603 Fix /pm and emote suggestions overlapping 2026-03-21 23:10:48 +03:00
indev e13cb1ca92 Remove few remaining flashpal things in opengl menu 2026-03-17 19:00:38 +03:00
indev a0dffd0670 Fix listemotes calculating incorrect number of pages 2026-03-16 04:07:48 +03:00
Alug 7684e6aa07 Blua: opcode OP_SELF operate only with string keys, so they can use fast-track table access
https://github.com/lua/lua/commit/cb3d5dce30089512085f78a0bef79e30ef732e30
2026-03-15 18:19:06 +01:00
Alug 0fb752b745 Blua: OP_SELF can use 'luaV_fastget' specialized for strings, as it is applied only to string keys
https://github.com/lua/lua/commit/257961c601fdec1ea1f9640d460e0d31c39333a1
2026-03-15 18:19:03 +01:00
Alug c418fe3ef8 Blua: 'luaV_fastget' only treats the real fast case (table with a non-nil value at given key, so that it does not need to check metamethods)
https://github.com/lua/lua/commit/1a44e822009752513ce895b9eabc51a4ee4a195a
2026-03-15 18:18:59 +01:00
Alug fdccc80260 Blua: 'Protect' in table operations is not needed in the fast track
https://github.com/lua/lua/commit/df8b996bccd3830d6fe9d7ba80e8fccd6ac3cabf
2026-03-15 18:18:57 +01:00
Alug 84be9096b1 Blua: fast track for 'settable'
https://github.com/lua/lua/commit/3b795541c488c7e633567897c9112312007a20a0
https://github.com/lua/lua/commit/b91bc93fd33f2158745b37c9e091c6fa4d1a4fd5

had to adjust some things, hope this doesent explode lmao
2026-03-15 18:18:54 +01:00
Alug e4e51f0f80 Blua: implementation of fast track for gettable operations
https://github.com/lua/lua/commit/e247c3ada3ff47a1352927e797263137f4e02e0e

lets hope i converted this properly lul
2026-03-15 18:18:51 +01:00
Alug 9087fd8377 lua hooklib: use NUMMOBJTYPES to detect mobj hooks
removes the "force_mobj" field, gives a suprising perf boost from my timedemo testing +6-7fps (164 - 169/170fps)
this does however will prevent the generic hook from being called if the mobj being passed ever should be NULL
This shouldnt ever happen, vanilla assumes this aswell and way worse things would happen there, but just wanted to note
2026-03-13 19:09:38 +01:00
Alug 1aa37be676 p_user: cache kartspeed value within P_3dMovement
its result shouldnt change there, so no need to always recompute stuff, even if its not heavy work
2026-03-13 19:09:26 +01:00
Alug 04f63b23ff software: hack for bogus height walls
as per comment, this is merely a shitty workaround for a chain reaction of bad fixed point maths
since im honestly not feeling like rewriting most of the software renderer to either operate on 64bit or float maths, we just skip drawing anything that seems completely unreasonable
2026-03-13 19:09:18 +01:00
Alug d6ed923f83 P_XYMovement: check for kart specific stuff first to determine friction apply
this stuff is much more common than the other stuff being checked, so more likely to return earlier and save a bunch of other checks
2026-03-13 19:09:08 +01:00
Alug c7845118c0 explicitly cast those 2026-03-13 19:08:50 +01:00
alufolie91 ffc6adde4c Merge branch 'servaddonsonly' into Saturn-Next 2026-03-13 19:08:21 +01:00
alufolie91 fed7020da1 hash_sparse: change length checks
dont early return on 0 len, let it be the falltrough case, this seems to help branch prediction
2026-03-13 18:58:49 +01:00
alufolie91 1a4255d9df luaS_newlstr: use hash also for checking strings
taken from raptorjit
we can check the hash first to skip quite a bunch of memcmps which should be faster in most cases (hopefully but quick timedemo tests confirmed that)
2026-03-13 18:58:39 +01:00
alufolie91 f6ead71f0c blua: handle 0 length strings in hash_sparse 2026-03-13 18:58:31 +01:00
Alug 966f60f590 Experiment: replace lua´s string hash with luajits ARX hash
the string hashing was the most hit and most spent in part of the whole game in alot of cases
replacing it with luajits algo absolutely massively improves lua performance (10-15fps in my bench timedemos!)
however idk how all this stuff exactly works so this needs alot of testing to make sure nothing breaks
ive rewritten the unaligned ptr access slightly to use memcpy for safety with some platforms that require stricter alignment
2026-03-13 18:58:21 +01:00
alufolie91 9afc018a45 Avoid computing invalid addresses
luaV_execute should compute 'ra' only when the instruction uses it.
Computing an illegal address is undefined behavior even if the address
is never dereferenced.
2026-03-13 18:58:05 +01:00
Alug 43608810da lua branching hint stuff
rechecked against lua 5.4
2026-03-13 18:56:18 +01:00
Alug 90b5f9050a Blua: small optimization in luaL_addlstring (avoid adding chars one by one)
https://github.com/lua/lua/commit/f292760f12022a83cf01e788482a264aeeb3c276
2026-03-13 18:55:55 +01:00
Alug edc10a35a1 Blua: better names for metamethods in debug information
https://github.com/lua/lua/commit/becf19feeffeb0bf2297e163da4ccc7b4b5e6b5c
2026-03-13 18:55:49 +01:00
Alug 91435fe1b2 Blua: small optimization (reorder of BinOpr enum to unify some cases in switches)
https://github.com/lua/lua/commit/d7872dcf91eb2075312a03973a6cdb489610c796
2026-03-13 18:55:42 +01:00
Alug a7ebc7e745 Blua: micro-optimization: avoid one API call in 'read_chars'
https://github.com/lua/lua/commit/f86f4116c82654d24faa4a32a909d0c27f3d4746
2026-03-13 18:55:37 +01:00
alufolie91 3cf3c1bb99 Merge pull request #219 from Indev450/netstuff
Netcode fixes, cleanups and optimizations
2026-03-13 18:45:18 +01:00
alufolie91 2c170f1956 Merge pull request #217 from Indev450/optimizewadlumps
Optimze Wad Lumps
2026-03-13 18:21:50 +01:00
alufolie91 98da654e02 Fix P_MakeMapMD5 printing incorrect time
:chonkbuncle:
2026-03-10 16:55:54 +01:00
alufolie91 af84105e40 better error for nodeless maps 2026-03-10 16:55:51 +01:00
indev a1666704e5 Hide offroad particles when player is doing saltyhop 2026-03-09 14:53:30 +03:00
alufolie91 7b408a33d7 fix openmpt versions strings leaking
from https://lib.openmpt.org/doc/libopenmpt_c_overview.html "All strings returned from libopenmpt are dynamically allocated and must be freed with openmpt_free_string()."
didnt knew this tbh lol
2026-03-03 02:32:13 +01:00
alufolie91 9ee535066e OpenGL: initialize all FSurfaceInfo´s
seen this a bunch of times now that occasionally something tries to access uninit values from a surface info
since those are really small we just always init them now
2026-03-03 02:31:54 +01:00
alufolie91 6430150b63 fix parts of png info text for screenshots not being null terminated in some cases 2026-03-02 17:53:24 +01:00
alufolie91 16cf4ede89 v_video: generate missing flashpals instead
not sure if this is more sane than the huge ass array from before
but atleast this is more accurate and can basically generate flashpals from any palette while also still working with all the colour and gamma adjustments
prob needs some cleanup idk this is all rather messy lol
2026-03-02 17:23:11 +01:00
alufolie91 efe8732188 fix flashpals throwing random garbage into the renderer in some cases
iirc, if the provided palette currently in use did not provide subpalettes, this will read past the bounds of allocated memory, which aint good lol
i just dumped the white flashpal and threw it into there since idk if -file or autoload gets called before the palette gets initialised, which would carry a risk of copying more garbage, hence this big ass array
2026-03-02 00:44:10 +01:00
alufolie91 07fc0eb03a v_video: fix cv_palettenum bounds check
mhhm yeah
2026-03-02 00:35:19 +01:00
X.organic f2b46fd148 Fix myhashfgets-related buffer overflows in deh_soc.c 2026-03-02 00:35:16 +01:00
alufolie91 8247133966 w_wad: use strnlen to check lump length for map marker
lump name may not be null terminated here, so strlen may read out of bounds garbo
using strnlen ensures we read max 8 characters which is the name buffer size
2026-03-02 00:35:13 +01:00
alufolie91 397fb071e5 fix compiling with valgrind support 2026-03-02 00:35:11 +01:00
alufolie91 1a9fa94cbd Autoload: dont attempt to load directories
lol
2026-03-01 01:04:14 +01:00
alufolie91 e8c7cc6a9b D_AutoloadFile: add overflow safeguard 2026-03-01 01:04:14 +01:00
alufolie91 5ca3ab5966 Autoload: fix incorrectly incrementing wad count
those should only be incremented if we actually add something to the filearray and not instantly execute or error out
2026-03-01 01:04:14 +01:00
indev 1cf04514b3 Fix W_MakeFileMD5 printing incorrect time 2026-03-01 02:31:11 +03:00
alufolie91 5577ba4c7a Autoload: dont add wads that contain maps 2026-03-01 00:03:19 +01:00
alufolie91 6ff1cbf4b0 ok actually just remove keepmusic resume stuff
well now it just broke with dynmusic
this sucks, its probably fixable but the code was abysmal so shrug
2026-02-26 01:11:37 +01:00
alufolie91 db4cd73912 fix keepmusic resuming not resetting with "tunes" command
this code sucks ass wtf was i cooking
if this breaks again i will just wipe it lmao
2026-02-26 01:05:18 +01:00
alufolie91 3c70598aea lumpnumcache: W_LumpExists should return true or false
whoops was oversight by me
prob doesent really matter due to wraparound but its still incorrect
2026-02-25 22:38:46 +01:00
alufolie91 1ec29c1c94 better flags for ASAN and UBSAN
compile with -O1 and -fno-omit-frame-pointer
-fno-common for ASAN
2026-02-25 21:30:23 +01:00
alufolie91 fedccd25b9 hw_cache: use verstable for HWR_PrecacheLevelFlats flatchecks + convert to C
replaces the unordered_set and doesent require c++
2026-02-25 18:04:45 +01:00
alufolie91 1e51365cad add comment about K_KartUpdatePosition 2026-02-25 17:45:07 +01:00
alufolie91 94026e4331 makefile: comment out all the "Wno" flags
we effectively fixed all of them, so this does not throw any warnings for me atleast
in case we may screw up id rather have those warnings appear
2026-02-25 17:45:05 +01:00
alufolie91 2084cdc6d5 hw_md2: remove pointless float casts
durs and tics are int32.
and so is var2, anim_duration is uint16 but that still makes no sense lul
2026-02-25 17:10:24 +01:00
alufolie91 1b22c3af19 those should be boolean
just for correctness!
2026-02-25 16:52:47 +01:00
alufolie91 3e327263c9 fix faulty papersprite flipping in opengl
lol
2026-02-25 16:46:58 +01:00
alufolie91 7c24d92613 delet V_GetSkincolorChar
this was unused and broken anyways
think this came from snowy kart or smth
2026-02-25 16:46:55 +01:00
alufolie91 ba808307e9 FORCEINLINE is apparently used by windows already lmao 2026-02-24 16:10:54 +01:00
alufolie91 014a22e933 w_wad: replace unordered_map with verstable hashmap for lumpnumcache + convert back to C from C++
been rethinking this and been doing some digging online
the unordered_map was just a quick and simple fix for performance issues in blan, but came with caveats:
- unordered_map is simple to use but not particulary great in terms of performance during lookups especially
- we needed to convert w_wad to c++ just for the lumpnumcache
- due to needing to preserve the key since they gotta outlive the scope of the function that inserts things into the map, we effectively did a string copy on each map insert and lookup
after some research came across verstable, which is basically almost the exact same as unordered map but in C while being extremely fast (even more with its builtin string hash and comparisor)
only caveat with verstable is we need to rely on a new lib, though its just a single header file, and we gotta manage ensuring the input keys outlive functionscope ourselves, which we do with strdup in this case
good thing, verstable allows to call a "destructor" specified by us whenever it removes or replaces keys in the map
this also means we only need to copy strings on insert and not on lookup anymore
all in all this is much faster while giving us the simple usage of c++ unordered_map while staying in C

due to the strdup quirk i had to slightly modify verstable to allow to take const as inputs for the getter functions even if the keys themselves are not const marked with "KEY_GET_CONST"

Verstable can be found here: https://github.com/JacksonAllan/Verstable
and is licensed under MIT which is perfect!
2026-02-24 16:06:27 +01:00
alufolie91 3f3ba9e993 Merge branch 'Saturn-Next' into optimizewadlumps 2026-02-24 15:54:47 +01:00
alufolie91 2f684bba95 ensure SIGINT/SIGTERM can quit out from wipes and serverconnection ticker 2026-02-24 12:34:21 +01:00
indev a287a6419f Use strncpy for zip entry filename because it might not be null-terminated inside zip 2026-02-23 22:53:23 +03:00
alufolie91 6f2aba7ee3 Windows is such a cool Operating System
idk why we just dont use int32 there aswell and rely on whatever tf windows supplies which i dont trust ffs
2026-02-23 18:17:40 +01:00
alufolie91 a9a0d4bed8 fix compiler warnings for glibc 2.43 and newer
this version changed so that many standard functions now propagate the constness of its input pointers
to not cause warnings for everyone on older versions this is now a really dumb macro lol
2026-02-23 17:58:53 +01:00
alufolie91 355c78e075 check for _GNU_SOURCE for nongnu_strcasestr
idk we dont need it and it throws warnings on new glibc so i dont want it tbh
2026-02-23 17:58:50 +01:00
alufolie91 4623f8aff2 explicitly set "std=gnu17"
we *rely* on a bunch of gnu extensions so its better to explicitly set this
yes in theory we fully comply with c23/gnu23 and saturn compiles fine under that, but since its still fairly new theres alot of maschines that still dont support it :chaosleep:
2026-02-23 17:58:36 +01:00
indev 1265bbba2e Rename I_LockMutex back into I_lock_mutex for now 2026-02-23 19:14:14 +03:00
alufolie91 fdccf868cc disable player fade if viewplayer is spectator
fixes some wonky stuff like players disappearing when they were close to the invisible spectator player and you werent watching someone else
2026-02-23 17:09:32 +01:00
alufolie91 3204b5c3b4 Merge branch 'Saturn-Next' into netstuff 2026-02-23 17:02:32 +01:00
alufolie91 cd02242a01 fix splitscreen clients being unable to join saturn servers
lmao oops idk dumb copy paste sry
2026-02-23 17:02:13 +01:00
alufolie91 e35dc9e097 fix g_in_exiting_signal_handler
every "flag" set by signal handlers must be of type "volatile sig_atomic_t"
everything else may fail to be correctly set, read or get optimized away which rendered this basically useless
2026-02-23 16:20:48 +01:00
alufolie91 f4dc161831 dont let SIGINT/SIGTERM do work in signal handler take 2
the earlier approach still raised the default signal within this, which basically just skipped everything and ended up NOT calling I_Quit at all
Basically this is to ensure we dont call I_Quit at all from a signal handler as it is NOT async safe and can cause serious issues like deadlocks and such, instead SIGINT and SIGTERM will just signal the main loop/thread to safely call I_Quit instead
2026-02-23 16:01:14 +01:00
alufolie91 1d6c27baca lua_pushlstring: prefer luaS_newlstr over luaS_new
the latter calls strlen which is not needed as the empty string has no length
2026-02-22 14:01:27 +01:00
alufolie91 009df228d6 fix memory leak when fetching masterserver rules
strdup returns a malloc´d string!
2026-02-22 13:33:57 +01:00
alufolie91 7746e494cf fix memory leak within http masterserver handling
errbuf gets malloc´d!
2026-02-22 13:33:54 +01:00
alufolie91 90a88983f1 k_hud: make the hud offset vars static 2026-02-22 13:33:49 +01:00
alufolie91 22a4fe63db Fix minimap angle display colour for skins that use non default startcolor
i.e. they use a different colour than "green" to remap their skincolor on
2026-02-22 13:33:46 +01:00
Alug d77508f481 init superactions global
was missed before
2026-02-16 19:27:56 +01:00
Alug 53321d33d5 mark some nightsmode stuff with likely/unlikely i missed
and in some cases move around the conditionals
i love backwards compat Zzz....
2026-02-16 19:27:52 +01:00
Alug 5c28f6afd8 Revert "fix new compiler warnings from new gcc version"
This reverts commit d49001143f.
2026-02-16 19:04:51 +01:00
Alug d49001143f fix new compiler warnings from new gcc version
just throw const at everything :blobthumbsup:
2026-02-11 17:48:16 +01:00
Alug 513e5a7e3f remove even more dead code lol 2026-02-10 16:38:37 +01:00
Alug 6f75fab7ff move gamepad led ticker after render logic
this does not really matter but save a tiny little amount of time before rendering a frame
2026-02-09 19:41:45 +01:00
Alug 38fc6d6ba1 remove screen texture toggle from accessability menu + new tooltip 2026-02-09 16:09:26 +01:00
Alug 02f2464a00 HWR_CreateBlendedTexture: init a bunch of stuff 2026-02-08 23:13:16 +01:00
Alug c84724da37 make lumpnumcache case sensitive + optimize + replace quickncase hash with FNV1a
lumpnumcache can be case sensitive W_CheckNumForName should also look for uppercase stuff and W_LumpExists is case sensitive anyways
this avoids having to always account for case (toupper/tolower) during hash and string comparisons and even allows us to even directly compare our strings instead of using fastcmp (std::strings allow this!)
from some benchmarking externally this makes this faster quite a bit
2026-02-08 20:35:08 +01:00
Alug 86b286fb0b fix few more cases of using potentially uninitialized garbage 2026-02-06 20:06:56 +01:00
Alug ecef8913b1 remove some more dead code
as reported by clang-tidy
2026-02-06 17:06:33 +01:00
Alug 277b202020 hooklib: init all the hook states
idk i aint trusting any of this lul
2026-02-06 17:06:04 +01:00
Alug 6ba97bc43c only do the anim texture maths if we need it
idk why but this showed up during profiling
best would be just to redo the whole system since it sucks lol
2026-02-05 23:31:19 +01:00
Alug 0fbde146a9 remove some unused fields from precipmobj_t
we do not have animating precip nor do we cast it to mobj_t anymore, so we can just get rid of this stuff
reducing the struct size by 16bytes wowie
2026-02-05 20:07:44 +01:00
Alug 16e0c6f0f6 dont constantly fetch lookback joyaxis in p_ticker if replay recording is enabled
minuscule optimization lul
2026-02-05 20:07:41 +01:00
Alug 8cab07a4b2 add missing "ifdef LOGMESSAGES" 2026-02-03 15:59:53 +01:00
Alug 55c8546d68 do not use Zone Memory for masterserver rules
this gets called from within non main threads!
zone memory is not thread safe!
2026-02-02 17:27:23 +01:00
Alug 1762f18116 delet all the Z_Free checks
Z_Free already checks its input internally!
2026-02-02 16:12:38 +01:00
Alug e4dbf1ce11 plug a potential memory leak in M_SaveConfig 2026-02-02 16:11:57 +01:00
Alug 10b9d96259 hw_clip: replace "RoundToInt" with lrint
prefer to use standard lib functions if possible
lrint does the same thing (well ofc as long as no one touches the rounding direction löl) and is even quite a lot faster (though this is negligible in this case)
2026-02-02 16:11:54 +01:00
indev b23154fd93 Prevent replays menu scoll bar from disappearing 2026-02-02 02:28:33 +03:00
Alug b0ee972178 r_plane: fix visplane hashing overflowing
shift into "int" to prevent super large values during multiply
2026-02-01 20:52:48 +01:00
Alug 544e1d3b21 "fix" overflow in R_InitViewMapping with high resolutions 2026-02-01 17:07:18 +01:00
Alug 0ca6947f99 fix a few type issues 2026-02-01 16:27:25 +01:00
indev 3122c08039 Add focus options for gamepad led and rumble 2026-02-01 02:49:03 +03:00
indev 7a279a6fd9 Prefix autoaccel cvars with 'kart' to avoid conflict with hostmod 2026-01-28 19:19:02 +03:00
Alug 00bc8bc149 limit addon only stuff to server info screen
quite honestly everything else is awful and i dont want to bother with it
2026-01-27 18:23:51 +01:00
Alug f12b55f63b rename addonsonly variable to cl_addonsonly
very generic name so add the prefix for whatever cl means
2026-01-27 18:08:12 +01:00
Alug 3e476d7658 implement allowing to load addons and gamestate only instead of joining server
really messy, needs some cleanup, not sure if this is good at all
2026-01-27 18:06:22 +01:00
Alug c4581bd9a6 Only save and keep track of controller ids on SDL versions 2.32.4 and up
Older versions break and have unstable ids on Windows, cant check for linux but ill just add a version check at this point
This was part of updating sdl with v9, which got reverted due to other issues but this was not reverted oopsie
2026-01-24 18:20:54 +01:00
Alug bb47b976a7 software: fix drawseg xrange item coord type being too small
both sprite and drawseg coords are int32
might fix some clipping issues
2026-01-23 18:33:11 +01:00
Alug 6c419ff22e fix few more implicit double/float conversions 2026-01-23 18:33:08 +01:00
Alug 522904527f add missing HAVE_CURL 2026-01-23 10:08:35 +01:00
Alug 30539371c2 more cmake stuffs
-add LTO option, enabled by default
-set optimization level to O3 and O0 for debug builds
-add ASAN and UBSAN options
-always compile with gnu debug symbols
2026-01-22 14:46:12 +01:00
Alug e2ecc315b4 cmake: attempt to fix dedicated build uhh building 2026-01-22 14:44:47 +01:00
Alug eb2f186205 Merge pull request #221 from P-AS/morecmakefixes
CMake fixes cherry-picked from srb2-legacy
2026-01-22 14:43:38 +01:00
Alug bbf06b3376 add "vid.udup" same as vid.dup but not scaled with "highreshudscale" 2026-01-22 14:26:24 +01:00
Alug a1f70b0b31 opengl: attempt to scale vhs effect "fuzzyness"
this makes it appear more or less the same in all resolutions, similar to software, while also improving performance quite a bit on higher resolutions
2026-01-22 14:26:23 +01:00
Alug 2e0f5c02a4 opengl: make vhs effect bars be affected by "fuzzines"
makes stuff slightly slower, but matches the software effect
2026-01-22 14:25:57 +01:00
Alug 0f7001ef5c opengl: tiny optimiazation for vhs effect
dont call rand within the loop, use xorshift instead
while not massive, we dont need to call rand thousands of times, the xorshift is visually indistinguishable
this is still rather slow due to the crapton of draw calls and should best be replaced by a shader or something
2026-01-22 14:25:54 +01:00
PAS 4600da5782 restore SRB2_SDL2_EXE_NAME 2026-01-21 15:54:32 -05:00
indev a3557fadef P_PlayRinglossSound from lua might desynch so print warning about that 2026-01-21 23:38:41 +03:00
Alug d9a67faf47 fix windoze compile 2026-01-21 21:11:52 +01:00
PAS 96eaf8850e Add path suffix for libgme cmake module 2026-01-21 15:01:51 -05:00
PAS e7efd46419 Fix FindGME pkg-config command, update LibFindMacros.cmake 2026-01-21 15:01:33 -05:00
PAS 346b1456cd CMake: Fix FindOPENMPT 2026-01-21 14:59:01 -05:00
PAS 9f5a5a735b Allow changing Cpak generator (from upstream) 2026-01-21 14:58:32 -05:00
PAS 8e4b304bed CMake: don't configure before CPACK_PACKAGE_DESCRIPTION_SUMMARY is set 2026-01-21 14:51:17 -05:00
Alug 6cbb8a36cf Merge branch 'Saturn-Next' into netstuff 2026-01-21 20:48:47 +01:00
Alug 7dbb08315c fix cmake 2026-01-21 20:48:04 +01:00
Alug b1ff1bb531 Merge branch 'Saturn-Next' into optimizewadlumps 2026-01-21 20:47:44 +01:00
Alug 8eaf4a73f4 Merge branch 'Saturn-Next' into optimizewadlumps 2026-01-21 20:46:55 +01:00
Alug 607fbc54fc Merge pull request #220 from Indev450/fixcmake2
Fixup CMake, but simpler
2026-01-21 20:45:24 +01:00
Alug 276cf0a8cb fix string.c include
whoops, not sure why that was even done like that
string.c will include strcasestr.c and SRB2_HAVE_STRLCPY will ensure eitherways we dont use the included strlcpy stuff
2026-01-21 20:04:19 +01:00
Alug 59c9af97c2 joy_open: make debug prints actually print the player number 2026-01-21 19:54:03 +01:00
Alug 4e75d99026 simplify LUA_Alloc
Z_Realloc already handles everything internally, no need to manually free anything
2026-01-21 19:49:55 +01:00
Alug 8e91c16e97 cmake: enable gnu extensions
we rely on some of them like the cleanup macro
dont want those breaking or smth
2026-01-21 19:34:44 +01:00
Alug 186421fe85 cmake: link with peethread 2026-01-21 19:23:36 +01:00
Alug af952870c3 fix fbo oopsie 2026-01-21 19:22:40 +01:00
Alug 4eeb0b4b20 update readme to reflect this 2026-01-21 19:16:05 +01:00
Alug cb2c65e9d9 more cmake fixups
- skip asset install for linux
- pass fwrapv flag
- fix asset hash stuff
- pass rdynamic flag
- add saturn specific stuff, saturnpak, saturnjoin, libbacktrace and fix screen fbo stuff
2026-01-21 19:09:50 +01:00
cobalt2727 f7bbde3982 fix ARM builds being completely broken
If merged, this is the quickest approach to resolve https://github.com/STJr/SRB2/issues/513

...alternatively, we could just remove the option altogether but I don't have the time right now to test whether it's needed or not

To the best of my knowledge, this covers all possible amd64 `CMAKE_SYSTEM_PROCESSOR` values based on what I'm seeing at https://stackoverflow.com/questions/70475665/what-are-the-possible-values-of-cmake-system-processor
2026-01-21 18:24:53 +01:00
Alug c9fc3b4820 fixup cmake for macos
mostly based on the patch from https://github.com/Bijman/srb2bld
with some changes from https://github.com/Indev450/SRB2Kart-Saturn/pull/216
but doesent completely replace the build system with what blan has
compiles fine on nix, but needs testing on mac
2026-01-21 18:23:21 +01:00
Alug f5195dd137 Merge branch 'crashissuereports' into Saturn-Next 2026-01-20 17:32:30 +01:00
Alug 5289f13891 Show report issue button also on I_Error
also make wrapper functions for everything, to reduce code dupe
2026-01-20 17:32:22 +01:00
Alug 073b35690b dont attempt to show sdl message box on non dedicated builds running as dedicated 2026-01-20 17:32:19 +01:00
Alug 43d3ac102d HWR_RenderPlane: cleanup code that does nothing 2026-01-20 15:42:37 +01:00
Alug aa96f9ceb3 V_DrawVhsEffect: fix scaling with highreshudscale, fix downwards bar going out of screen bounds
this shouldnt account for highreshudscale at all
on very high resolutions the bars are still only half size, but atleast they dont become minuscule or just dont draw at all
also ensures both bars are clamped, on some resolutions sometimes they just go out of visible screen range
2026-01-20 14:57:18 +01:00
Alug 104b8260fb add reducevfx to accesability menu
If there are things that should be handled by that toggle def feel free to suggest them!
2026-01-19 14:35:10 +01:00
Alug edebc728ef remove unused stuff from joyinfo 2026-01-18 19:00:05 +01:00
Alug 08e7ce3b5b m_menu: clean up the skin display stuff a little 2026-01-16 13:27:20 +01:00
Alug 29f187b751 fix some windoze specific "-Wzero-as-null-pointer-constant" warnings 2026-01-16 12:53:34 +01:00
indev ac3a1ad5eb Add gcc 13.3 into list of supported versions 2026-01-16 12:02:21 +03:00
indev 1b8d7b1541 I_Error when dedi tries to go to main error
This will not fix the issue entirely but will at least prevent server
getting stuck and backtrace will show where did it try to go into menu from
2026-01-16 11:11:36 +03:00
Alug b812d61da2 Merge branch 'crashissuereports' into Saturn-Next 2026-01-14 12:58:44 +01:00
indev 6fd64383d3 This isn't ceepeepee rn :SmolBuncle: 2026-01-12 22:33:30 +03:00
Alug e984e7a6c8 Merge branch 'menumodels' into Saturn-Next 2026-01-12 19:13:21 +01:00
Alug 96f90ff9c4 push back models even further
bigger models still had parts being culled, hope this is generous enough idk
2026-01-12 19:13:17 +01:00
Alug 51aec0e012 Merge branch 'menumodels' into Saturn-Next 2026-01-12 18:40:38 +01:00
Alug faadd3e89f support the uhhh localskin setup with 3d models 2026-01-12 18:40:00 +01:00
Alug 0c091256f4 tiny cleanup + warning fix 2026-01-12 18:30:11 +01:00
indev 7a0fb01626 Make glOrtho remap coordinates to vid.width and vid.height, this makes calculating coordinates in HWR_Draw2DModel easier 2026-01-12 18:30:08 +01:00
Alug c01818e2e3 simplify skinnum bounds check
lul
2026-01-12 18:30:06 +01:00
Alug e17a8a505c fix the culling issues
i hope this is right.......
2026-01-12 18:30:03 +01:00
indev ab654deba7 Make HWR_Draw2DModel not depend on resolution, make 3d skin select use skinselectspin cvar 2026-01-12 18:29:58 +01:00
Alug b145d7fd0e WIP: show 3d models in player setup
this is incredibly ugly and hacked together
theres some weird culling issues and shit doesent really "scale" with different resolutions which needs to be fixed
but it kinda works
2026-01-12 18:29:55 +01:00
Alug 264c9e38ad d_netfil: dont use zone memory in CURLGetFile 2026-01-11 19:46:46 +01:00
indev e88773da4e How did i miss the = 2026-01-11 13:08:23 +03:00
indev 310f67a06c Fix smol mistake in strcasestr 2026-01-11 03:49:07 +03:00
indev 0914d5b8e2 -Wzero-as-null-pointer-constant is valid for c only since GCC 15.2 (from what i see) 2026-01-11 00:49:48 +03:00
Gustaf Alhäll bf1aa47854 Simplify textcmd handling 2026-01-09 20:53:15 +01:00
Alug 291a4dbb25 disable midnight channel border flicker with "reducevfx" 2026-01-09 13:01:30 +01:00
Alug 8fe3d13935 fix InitColorLUT 2026-01-09 11:08:22 +01:00
Alug bdc326b14e leveltime be tic_t
:chaosleep:
2026-01-08 00:43:43 +01:00
Alug d938e38ad3 Acessability: add basic "reducevfx" toggle to disable/reduce certain effects
toggles certain effects, which may be troublesome to some players

-disabled hyudoro flashing, instead makes player translucent
- Makes rainbow colour effects, such as invul, change colours very slowly
- Disables underwater and heatwave screen effects
- Disables palette flashing
- Disables vhs effect

not the most pretty implementation, but im lazy and this works

feel free to suggest more things
2026-01-08 00:40:24 +01:00
Alug 3d4772455b K_SpawnSparkleTrail: check for blend effect apply outside the loop
tiny optimization
2026-01-08 00:40:24 +01:00
Alug e1f0089627 enable "Wzero-as-null-pointer-constant", fix cases of it
prevent ambiguity
shoutout blankart for making me aware this exists
2026-01-08 00:40:24 +01:00
Alug be423b2910 Merge branch 'Saturn-Next' into netstuff 2026-01-08 00:34:19 +01:00
Alug 3bf3bdf641 enable "Wzero-as-null-pointer-constant", fix cases of it
prevent ambiguity and bad practices, i like expressive and "correct" code
shoutout blankart for making me aware this exists
2026-01-08 00:34:15 +01:00
Alug e923777eb6 Acessability: add basic "reducevfx" toggle to disable/reduce certain effects
toggles certain effects, which may be troublesome to some players

-disabled hyudoro flashing, instead makes player translucent
- Makes rainbow colour effects, such as invul, change colours very slowly
- Disables underwater and heatwave screen effects
- Disables palette flashing
- Disables vhs effect

not the most pretty implementation, but im lazy and this works

feel free to suggest more things
2026-01-08 00:33:53 +01:00
Alug cf6eb0010e K_SpawnSparkleTrail: check for blend effect apply outside the loop
tiny optimization
2026-01-08 00:33:50 +01:00
Alug 5184115216 enable "Wzero-as-null-pointer-constant", fix cases of it
prevent ambiguity and bad practices, i like expressive and "correct" code
shoutout blankart for making me aware this exists
2026-01-08 00:33:43 +01:00
Alug edbebbf082 fix wrong type for K_DriftSparkColor
all the colour stuff is still a bit of a mess, but generally its handled as an uint8
2026-01-02 18:34:13 +01:00
Alug 242dee499d initialize more globals that have been missed 2026-01-02 18:34:10 +01:00
Alug 39a46e8f79 Revert "Remove tic provision (vanilla compat edition)"
This reverts commit 4a3c9ccfbb.
2025-12-30 01:09:14 +01:00
Alug a2de1e24c5 d_cliserv: fix casts from nan to int type
in few cases the files totalsize might be 0, which results in a nan, casting that to int type is undefined behavior
2025-12-28 17:46:44 +01:00
Alug c0cce90e60 properly handle getcwd error in IdentifyVersion
if getcwd fails, the buffer contents will be undefined
so we shall just overwrite it again with "."
2025-12-27 15:34:26 +01:00
Alug d9712cf85e Merge branch 'Saturn-Next' into netstuff 2025-12-27 15:13:50 +01:00
Alug 9ccd62b5cb Merge branch 'Saturn-Next' into optimizewadlumps 2025-12-27 15:13:42 +01:00
Alug 67e74b5874 fix w_wad oopsie 2025-12-27 15:13:20 +01:00
Alug 9639ace28a fix dedicated server build warnings 2025-12-27 15:07:13 +01:00
Alug a2616778cc fix another -Wnull-dereference warning 2025-12-27 15:06:50 +01:00
Alug 0691e2d9e2 Merge branch 'Saturn-Next' into netstuff 2025-12-27 13:40:19 +01:00
Alug 495c34dd40 fix gcc version detection fallback stuff
latest_gcc_version should always just be X.x not X.x.x
this broke some warning flags for me
2025-12-27 13:02:30 +01:00
Alug f38ca9aa28 Signal Handler: Add button to report issues to github
mostly based on what srb2 does with some stuff from srb2-legacy
the button will attempt to open the issue page on the saturn git when a crash occurs
2025-12-27 12:41:41 +01:00
Alug 8e67e0bace Merge branch 'Saturn-Next' into optimizewadlumps 2025-12-27 10:53:10 +01:00
Alug b0bf588c27 fix some null pointer dereferences
and enable -Wnull-dereference by default
2025-12-27 10:52:21 +01:00
Alug 35e4f35f6e fix some shadowed variables, enable -Wshadow by default 2025-12-27 10:32:16 +01:00
LJ Sonic 7866b769cc Do not archive table values for nil keys 2025-12-27 00:00:39 +01:00
Alug 1af1e42dab FBO: remove nvidia xwayland hack
this has been a non issue since a while now, so can remove this (we shouldnt work around driver bugs anyways)
2025-12-26 23:20:42 +01:00
Alug 40bd3e5e19 simplify opengl vsync set 2025-12-26 23:20:39 +01:00
Alug 25dd3b4976 Revert "Fix static memory being re-tagged as purgable"
This reverts commit c544cf9a7c.
2025-12-26 21:44:58 +01:00
PAS 08864e27b2 Fix double byte-swap in SV_MakeTic 2025-12-26 21:44:39 +01:00
Alug 4a3c9ccfbb Remove tic provision (vanilla compat edition)
based on https://codeberg.org/srb2classic/srb2classic/commit/7cf14fbe740998c3246dd190904f49a236b2ccec

seems to get rid of some jitter in localhost
2025-12-26 21:44:37 +01:00
Alug cedd789a27 Merge branch 'Saturn-Next' into netstuff 2025-12-26 21:44:34 +01:00
Alug 0fe3086a5a Fixup the doomednum lookup
properly match the old linear lookup by returning the FIRST match for doomednum
also shrinks the array, doomednum max is 4095, no need for such massive array, also fixed a off by
should fix some join desynchs and desynchs on certain maps
2025-12-26 18:58:41 +01:00
Alug c9afd4a2cd G_GetDemoDate: make safer and use static memory
bunch of smaller issues before, no real checks for strltol and potential free on a null pointer lul
also skips replays with shorter than 10 char names and handles errors better
2025-12-24 00:06:17 +01:00
indev 7518a6f181 Revert "Sort directories too in replay list"
This reverts commit 7c848f4be5.
2025-12-24 01:36:02 +03:00
indev 2bf4c44259 Revert "Actually add filepath to directories to sort them"
This reverts commit 1c95e5f40e.
2025-12-24 01:36:00 +03:00
indev 1c95e5f40e Actually add filepath to directories to sort them 2025-12-24 01:23:20 +03:00
indev 7c848f4be5 Sort directories too in replay list 2025-12-24 00:54:39 +03:00
Alug a4af254643 Revert "dont call I_Quit from within "quit_handler", let it signal main loop to quit"
This reverts commit a2feaa7fde.
2025-12-22 20:16:04 +01:00
Alug 860dc37fe4 Optimize: move a few strlen calls out of loops
when applicable and the input does not get modified within the loop
needs some testing incase i oversaw something
2025-12-18 19:13:47 +01:00
Alug 8b3d55fbc8 HWR_ProcessSeg: port softwares code to skip rendering inner sides that are "joined" to other fofs
This seems to improve performance on maps with moderate to lots of fofs quite a bit.
On maps with only a few fofs, this makes no difference or has very very little regression
Need to test and check if there are any visual errors, but so far everything seems good
2025-12-18 19:11:37 +01:00
Alug 0540b5656a OpenGL: keep around our drawnodes memory
no need to constantly reallocate new memory
we dont have renderer switch, and the next level will render drawnodes anyways
those wont grow super big also, so theres no big worry about wasting tons of memory
yes i like ceepeepee vectors, how can you tell
2025-12-18 19:11:26 +01:00
Alug 6c98440f27 Remove pure attribute from fasticmp
While i assume this to be fine currently, i quite frankly dont trust the srb2 codebase enough aswell as preventing any future issues if there should ever be need to switch locales, since toupper WILL change behaviour in such cases which does not qualify as pure
2025-12-16 17:52:13 +01:00
indev 3828a9f8e0 Add flipcammode toggle for using local flipcam settings instead of player flags 2025-12-11 22:58:45 +03:00
Alug 2c7c9ec32a fastcmp.h: mark fastcmp functions as pure
this might let the compiler optimize aways subsequent calls in some cases
strcmp etc from glibc also does it
prayin nothin changes the locale at runtime lmao
2025-12-11 20:28:31 +01:00
indev 1ccd3e37bc Init playerinfo[i].node to 255 so if playerinfo packet gets lost, server join screen doesn't display empty player names 2025-12-11 21:37:31 +03:00
Alug 6ad344f65d findfile: let files added with "-file" look in addon/downloads folders first
due to https://github.com/Indev450/SRB2Kart-Saturn/commit/956fc099adcd7f33993c43c8ee3aea64df3fe9b4
IWADS shouldnt use findfile anymore
If there should be such case we can always expose the startupiwad count to check if were currently searching for iwads iirc
2025-12-11 18:19:21 +01:00
indev 1c289d73ca Oopsie 2025-12-11 17:54:03 +03:00
indev 44ba69cf53 Move lite steer and turn smoothing cvars into individual player controls menu 2025-12-11 17:35:35 +03:00
indev 4cea0c1414 Add autoaccel into accessibility menu 2025-12-11 16:43:59 +03:00
Alug 4ee468f5c6 Accessability: Add "Auto Acceleration" feature
ported from hostmod
2025-12-11 14:27:09 +01:00
Alug 9a58eb3010 G_BuildLocalTiccmd: remove "moveinput" variable
checking both cmd->buttons aswell as cmd->driftturn already handles those cases
2025-12-11 14:27:06 +01:00
Alug 59ff5e61bf Revert "Fix use-after-free when mobj is removed while still playing sounds"
This reverts commit 3bdc745bd1.
2025-12-10 19:13:07 +01:00
Alug 821c061f82 Optimize: Use doomednum lookup also when (re)spawning mapthings
not just for loading savegame thinkers
Actually even provides slight runtime performance improvement, but mostly makes levelload faster
2025-12-10 18:22:34 +01:00
Alug fd2c208612 Merge branch 'Saturn-Next' into optimizewadlumps 2025-12-09 18:07:15 +01:00
Alug 8f91707164 Merge branch 'Saturn-Next' into netstuff 2025-12-09 18:07:06 +01:00
Alug 37eba186f5 netcode: replace some stuff with memsets + add a little bounds safety in some places 2025-12-09 18:07:02 +01:00
Gustaf Alhäll eb4d9bbdd5 Fix decompression warning when starting a server 2025-12-09 17:57:02 +01:00
Alug c19c80d797 command.c: fix "alias" command crashing when no aliases were registered
if we dont have aliases list how do we check the next alias in the list aswell?
2025-12-07 21:08:38 +01:00
Alug a2feaa7fde dont call I_Quit from within "quit_handler", let it signal main loop to quit
fixes an issue for me which led to having the game threads getting stuck when sending an interrupt signal to the game due to some thread issues with the sdl subsystems

shoutout to dsda doom for this
2025-12-07 20:27:57 +01:00
Alug 3cb4e86b48 i_system: "fix" recursive i_quit
well this still aint working all to great, but atleast this allows me to quit the game if it gets stuck without having to always send a kill signal to it

copy pasted from what the dedicated build does
2025-12-07 20:24:18 +01:00
Alug ed758fc921 g_demo: check for maplump existance directly
cant really rely on mapheaderinfo to tell us if some map exists or not
2025-12-07 20:23:57 +01:00
Alug 8f3b7158e3 w_wad: kill longname support
we dont use it for anything, we also cannot use it for anything.
Due to massive amounts of unterminated string being passed to everything
So we dont need to waste memory and resources
2025-12-07 19:04:36 +01:00
Alug a191c8b71e g_demo: screw you LF2_EXISTSHACK 2025-12-07 19:04:21 +01:00
Gustaf Alhäll 3f2e0bd349 Fix memory leak in AATree string trees 2025-12-06 19:40:54 +01:00
Gustaf Alhäll 3bdc745bd1 Fix use-after-free when mobj is removed while still playing sounds 2025-12-06 19:40:49 +01:00
Alug f578781418 put "string.c" earliest in sourcefile
otherwise Windows is unable to find nongnu_strcasestr
2025-12-06 15:45:45 +01:00
indev 0bb63ee0af Use size_t there 2025-12-06 17:34:05 +03:00
Alug 2ae9563ab3 Menu: fix camera options from within accessability options returning to the main menu
really wonky setup, but some other menus do similar things...
2025-12-05 19:13:01 +01:00
indev 6b429e4388 Add locatelump command 2025-12-05 20:35:48 +03:00
Alug 0321b0d94a m_menu: do some cleanup - replay drawers 2025-12-05 17:29:49 +01:00
Alug ac57b7fd2d Menu: show stats for current skin in Time Attack menu
+ some cleanup
2025-12-05 17:29:46 +01:00
Alug 7013e63142 Menus: dont advertise encore toggle if its not unlocked yet!
this wont do anything anyways besides telling you you havent unlocked it yet
so can just hide it
2025-12-05 17:29:43 +01:00
Alug b76ce836a0 w_wad: optimize W_LumpExists
in two parts:
- Use our lumpcache lookup first (our unordered map), BUT since it is case insensitive we extract our lump out of it to do another case sensitive name compare
- In the manual lump seach falltthrough case, we can also check against the string lenghts and hash (its case insensitive but will still reject differing names, same with stringlenght)

this improves the performance of the leaderboard map browser quite a bit and everything else using v.patchExists
2025-12-05 16:06:13 +01:00
Alug 4e1ef7c0cd Revert "remove the wonky double tap input for controllers"
This reverts commit 9e2fd091a8.

causes some wonky issues still, will need to look into it more, but for now revert
2025-12-05 15:11:51 +01:00
Alug fd1e415731 w_wad: use unordered map to cache wad start and end folders 2025-12-05 14:59:55 +01:00
Alug 41c887f2bf w_wad: comment out fullname lump hash for now
its unused and not particulary useful eitherway, save us a few hash generates and a struct field lul
2025-12-05 14:59:51 +01:00
Alug 8091d825d5 w_wad: use our lump fullnamelenght in W_CheckNumForFolderStartPK3 2025-12-05 14:59:47 +01:00
Alug 699113fb25 w_wad: replace lumpnumcache with unordered_map hash lookup
needs testing if actually better
but the old lumpnumcache was basically useless due to being incredibly small
even just booting up the game we have around 1000 entries already
this hopefully should still be faster than potentially going through ALL lumps in ALL wads we have loaded to find the lumpnums
not sure if longnames should get any special handling like before, but i dont think it really matters if theyre long honestly

thanks ceepeepeereference for the basis of this
2025-12-05 14:59:39 +01:00
Alug 3996abef36 convert w_wad to ceepeepee
prep for smth i might try
2025-12-05 14:59:36 +01:00
Alug 892f2253ea p_spec: remove hardcoded animdefs table
srb2.srb includes an ANIMDEFS file which WILL override this anyways and includes any of these.
so no need to complicate the code with this
2025-12-05 14:58:19 +01:00
Alug bebe62346f fix Flat loading code passing non null terminated strings to W_CheckNumForName 2025-12-05 14:58:15 +01:00
indev 834a94e429 Ok i guess we still need old_z2 :ChonkBunckle: 2025-12-05 03:10:41 +03:00
indev fcf833ff48 Move ghost mobj old_x2 hack into P_SpawnGhostMobj to cover all cases where it would matter
ty lug <3
2025-12-05 03:10:41 +03:00
indev f2a27539d3 Experimental: remove mobj->old_x2, old_y2, etc fields 2025-12-05 03:10:41 +03:00
Alug 05d26654df p_user: do some tiny cleanups 2025-12-05 01:07:18 +01:00
Alug cee6a27340 mark debugfile with UNLIKELY
this is for debug, and esp network debug which barely anyone ever needs, so can tell compiler better branch hint
2025-12-05 01:07:14 +01:00
Alug 66e35a9d67 k_kart: slightly cleanup driftrelease code 2025-12-05 00:29:31 +01:00
indev ad096ccd42 Update LUASTUFF.md 2025-12-04 19:21:30 +03:00
Alug 7a9e81828a forgot to remove this oops 2025-12-04 15:41:20 +01:00
Alug 71e7dacb56 r_opengl: dont set directional light model shader uniforms if we dont use them 2025-12-04 01:26:43 +01:00
Alug f9c0ee865f make those ternaries a little prettier lul 2025-12-04 01:23:42 +01:00
Alug 154eaaf027 hw_main: cleanup and simplify HWR_RenderPolyObjectPlane 2025-12-04 01:23:39 +01:00
Alug 66f5f9b2a2 hw_main: handle implicit float conversion cases explicitly 2025-12-04 01:23:36 +01:00
Alug b27275b887 hw_batching: fix typo in non shader polygon comparitor
checked poly1 against poly1 sky
2025-12-03 18:15:30 +01:00
indev c81c2c1d8d Add option to show current song credits in pause menu 2025-12-03 15:47:38 +03:00
Alug 7eb2ad1e35 slightly cleanup SV_AddWaitingPlayers 2025-12-02 23:23:41 +01:00
Alug f49e57a38c d_cliserv: Cleanup PT_ClientJoin
move refuse message handling into its own function
2025-12-02 23:23:38 +01:00
Alug 265f4a50ef readd check for node before SV_SendSaveGame
Apparently in some cases the server will connect to itself, in this case the server tries to send itself the savegame, leading to a crash in some cases. oops
2025-12-02 23:23:36 +01:00
Alug e83e2659a7 reorder packets again 2025-12-02 23:23:29 +01:00
Alug c680dd3222 fix some packet types not being correctly handled 2025-12-02 23:23:15 +01:00
Alug 96aaaf5261 merge SendNameAndColor & SendWeaponPref
TODO: make a bunch of player specific cvars arrays for splitscreen handling

- also cleanup some strlen usage
2025-12-02 23:23:07 +01:00
Alug efb29e6be5 d_cliserv: do some cleanups
- expose SAVEGAMESIZE
- pass node number to SV_AddWaitingPlayers (saves iterating through all 128 net nodes everytime a player joins) lifted from RR
- move all packet handling to the packet handlers
- Reorder packethandling switches a little, so common/important packets get checked first
- fix wrong clamp for realfirsttic that was too early
- add nowtime division by NEWTICRATERATIO (no change unless ticrate changes)
2025-12-02 23:23:02 +01:00
indev ccfab57a8c Add 'time per frame' argument for hud.setVoteBackground 2025-12-02 23:59:02 +03:00
Alug 56d1343f1b dont call CON_Drawer during frameskip, just call CON_MoveConsole instead
fixes the issue at hand, without making the console flicker in gifs
sigh....
2025-12-02 20:49:56 +01:00
indev b273bc3ca8 Hide localskins menus immediately when option is changed
@Alug :blobhug:
2025-12-02 22:12:49 +03:00
Alug d4f58a885b add toggle to let console prints show in main menus
if you want this for some reason
2025-12-02 20:07:56 +01:00
Alug 04458f18f8 m_menu: fix splitscreen players being unable to change the names from player setup
smol oversight :blobcatpats:
2025-12-02 19:43:05 +01:00
indev 64152eea0d Fix few possible multithreading bugs related to ReplayNamesLoadThread 2025-12-02 20:59:27 +03:00
indev 0e0a690e3c Print a warning when luaL_resourcetryagain force triggers garbage collector 2025-12-02 20:39:38 +03:00
Alug f283d3ca43 suppress wrong "-Warray-bounds" warning in G_DeviceLEDTick
newer gcc does this for whatever reason, its fine
splitscreen will never call this out of its bounds
2025-12-02 18:40:30 +01:00
Alug 982fff959f blua: attempt emergency garbo collection on file io operations if they fail
ports of
https://github.com/lua/lua/commit/e885dee5ab4dbee2457ee2023340e848fdabdef9

and

https://github.com/lua/lua/commit/3d838f635cc81ec3332f9a904992db1c6d8a46ad

prevents massive memory leaks and other issues due to faulty lua scripts
2025-12-02 18:31:32 +01:00
Alug b0e968e3c3 raise version number to 9.2 2025-12-02 15:54:53 +01:00
Alug e5bbb14ce0 replayhut: fix race condition in M_ResetDemoList freeing the demolist vars
in rare cases this could free the data the thread is currently using
so we gotta wait for it to finish first
2025-12-02 14:59:12 +01:00
Alug 327cca2e8e change freecam condition for awayview
shouldnt change the behavior much as we wont see anything without a camera, but this is explicit about what exactly is wanted (i.e. thiscam may be null, we only check due to null deref, we only care about if freecam is active)
2025-12-02 12:48:47 +01:00
Alug e02e9a12d7 ticcmd: replace magic numbers with constants
names lifted from RR
2025-12-02 12:48:43 +01:00
Alug 9e2fd091a8 remove the wonky double tap input for controllers
finally figured out what occasionally messed up my bound controls lol
why in the world is this even a thing for controllers??
2025-12-02 00:58:18 +01:00
Alug 0a04fca634 remove mlooky, rename mousesens to mousexsens, make mouse y sensitivity not be affected by x sensitivity
mlooky basically just took the place of mousey, which did nothing before, but is a better name
2025-12-02 00:55:59 +01:00
Alug 8a3f793324 g_input: init some globals that were missed 2025-12-02 00:43:27 +01:00
Alug e91892849c dont let splitplayers 3 and 4 input gamecontrols in the menu
oversight lul
2025-12-02 00:43:22 +01:00
Alug 6b4e3c9d13 update saturn credits
phew so every line now has two names
otherwise we cannot fit everything and anyone into this anymore
this even allowed to put back the tooltip at the bottom
i still want to redo the credits completely at some point with some cool stuff though
2025-12-01 23:41:27 +01:00
indev 5f55b81fbf Fix M_ClearMenus being called too early in map command func 2025-12-02 00:51:40 +03:00
Alug ca68bab002 fix more cases of dangerous PU_PATCH_LOWPRIORITY 2025-12-01 22:31:20 +01:00
Alug 339eb1879e fix the credits freeing our HUD item patches
goddamit i hate PU_PATCH_LOWPRIORITY
2025-12-01 22:24:42 +01:00
indev 1adb49c65c Fix emotes being slightly offset in chat log 2025-12-02 00:02:55 +03:00
Alug 1d33a05a85 Fix some Serverbrowser issues
- Fix serverlist results not being properly reset, which lead to reopening/refreshing the serverlist to show the old state, selecting one of those "old" servers then lead to just connecting to nothing
- Fix the resfresh button making servers disappear if hit too often too fast (from srb2)

https://codeberg.org/srb2classic/srb2classic/commit/3acc312923da0fe5e07c0517d9bff9e8b657b1eb
2025-12-01 21:57:57 +01:00
Alug cfcd20d44a G_AdjustViewEx and macro for G_AdjustView
neppy likes it more which is fair so we do this too
2025-12-01 21:08:30 +01:00
Alug 204607e272 replays: always check if map is loaded not just in old 1.0 replays
cause like, otherwise it will just I_Error which is worse lol
like this we just get thrown back to titlescreen
2025-12-01 21:03:57 +01:00
Alug b89a8ca6f9 replays: properly throw player back to titlescreen from replay error
fixes the game becoming stuck in limbo state if replay fails to start
2025-12-01 21:03:57 +01:00
indev d4aa352d59 Don't try to open replay if no replays are found 2025-12-01 22:49:36 +03:00
Alug c489841732 Fix record attack ghosts sometimes crashing
due to ghosts occasionally ending to early and game interpreting them as still valid uhhhhh
lets pray this wont explode or cause any weird issues......

credits to RR

REVERT THIS ONCE I GO AND FIXUP THE REPLAY MESS
2025-12-01 20:19:11 +01:00
Alug a6a97b4c4f add gdb_history to gitignore 2025-12-01 20:19:03 +01:00
indev fba070f82e Expose cameras to lua outside of hud hooks 2025-12-01 21:08:24 +03:00
Alug 10c117f95f dont reset freecam if the player you are "supposed to be watching" specs in replays
this aint pretty, but im too lazy to make it pretty sincerly
2025-12-01 18:23:51 +01:00
Alug bceda5beb4 dont force awayview when in freecam 2025-12-01 18:23:48 +01:00
Alug c50c936b1f remove hwr_shutdown call
honestly this didnt help with the issue i had, game should already release all the memory on quit anyways.
this just makes it take longer to quit
2025-11-30 20:28:46 +01:00
Alug 22a6be76b5 OpenGL: fix frustum culling not accounting for spritescales
also rename "this_scale" to "thing_scale" to be more descriptive

Fixes the comically large tree disappearing when it shouldnt on "Ethereal Crystal"
2025-11-30 14:47:02 +01:00
Alug d3d25df3c5 hw_main: cleanup HWR_RenderX stuff a bit 2025-11-30 14:46:30 +01:00
Alug 2a3f9e9ee6 hw_cache:rename some stuff
more in line with the rest of the code
2025-11-30 14:45:37 +01:00
Alug 31f01fd5da Revert "Provide our own SDL2 dll files"
This reverts commit 91530c61ad.

i hate windows, i hate sdl breaking with every single update
2025-11-30 14:37:00 +01:00
indev bb9a4a0da0 Add listemotes command, also fix few emote warnings not printing newlines 2025-11-30 00:36:36 +03:00
Alug 3bac722562 m_menu: cleanup gamepad menu stuff a little 2025-11-29 19:13:12 +01:00
Alug 3769ab74ac m_menu: move onchages back to m_menu, get rid of nextmap onchange hack 2025-11-29 19:07:01 +01:00
Alug c3d6cdd272 ensure modelMatrix is initialized 2025-11-29 14:26:08 +01:00
Alug 093602fd6b comment out unused dynslope member from levelinterpolator_t struct
this wont ever work with our thinkerless dynslopes
2025-11-29 14:26:05 +01:00
James R a80d119c58 Rename strcasestr to nongnu_strcasestr, macro strcasestr ifndef _GNU_SOURCE
Fix for GCC C++ compiler, which always defines _GNU_SOURCE.
2025-11-28 18:23:25 +01:00
Alug 1cdc92a62b HWR_Precache: lookup for flats that already have been precached
yes i used c++ unordered_set here, yes i suck with linked lists, lol
maybe speeds this process up a little
2025-11-28 18:07:21 +01:00
Alug 6b8de308b7 HWR_Precache: check against gl_numtextures not numtextures
in practice those should mostly be the same but the variable is for gl so
2025-11-28 16:53:12 +01:00
Alug 310e64d8be OpenGL: add a little more checks during texture free
prob not necessary but feels better
2025-11-28 16:53:10 +01:00
Alug d2d3afc7f4 software: clip sprites that are out of view
similar to what the frustum cull does in opengl, clips sprites that are out of view in vertical direction
2025-11-27 22:53:12 +01:00
Alug c26d2faee9 OpenGL: fixup spherefrustum culling and use it for sprites
clips sprites that are out of our view, especially with precip this may lead to significant speedup in certain cases
huge thanks to indev for helping with this <3
huge thanks to dsda-doom for the maths needed!
2025-11-27 22:53:12 +01:00
Alug 1c82c338a5 sprite gzt is float in opengl render........ 2025-11-27 18:57:21 +01:00
Alug c81cd48552 R_ProjectSprite: move fakeflat clipping before light maths
so if applicable we have slightly less work
2025-11-27 17:43:40 +01:00
Alug 306f7d455e tiny optimizations k_kart 2025-11-27 17:43:36 +01:00
indev dc40befa88 Use I_GetTime for animated emotes, so anim argument in M_DrawEmote is not needed 2025-11-27 18:49:43 +03:00
Alug 2222272d6f remove more unused/uneeded things
- delet hw_dll
- remove sector_t ceilspeed and floorspeed
- remove a bunch of stuff from viewvars_s
2025-11-27 16:49:50 +01:00
Alug 1849d5aade R_ProjectSprite: make sprite clipping work with sloped fake floors/ceilings
from eternity engine
2025-11-27 16:49:47 +01:00
Alug 3878c2f72a DoAddLine: add fast check for lines with same front and back sectors without middle tex
taken from dsda-doom
2025-11-27 16:49:44 +01:00
Alug 7cf3bceaff HWR_Subsector: avoid calling HWR_AddSprites on already processed sectors 2025-11-27 16:49:41 +01:00
Alug 1e394b0530 pass frontsector ceiling z to R_Prep3DFloors
in both cases "R_Subsector" already got the frontsectors ceiling z, so no need to get it again within R_Prep3DFloors
should save some P_GetSectorCeilingZAt per frame
2025-11-27 16:49:38 +01:00
Alug b09660204a r_bsp: move polyobj renderside check into R_AddPolyObjects
uneeded within R_AddLine as outside R_AddPolyObjects this will never be called if currecnt seg is a polyseg
2025-11-27 16:49:35 +01:00
indev 7b4592377e Make emote search case insensetive (emotes themself still are case sensetive) 2025-11-27 18:40:52 +03:00
indev 45ba69a45a Discordify emotes a bit more :chonkbunckle:
- When autocompleting emote with enter, don't send it immediately
- Don't autocomplete after typing 1 character after : (allows text emotes like ":c")
2025-11-26 22:56:04 +03:00
indev 4d9c345202 Add support for emotes in console chat mode (and support for emotes in console in general) 2025-11-26 22:45:03 +03:00
Alug 0437952027 mark checkcoord as const 2025-11-26 10:09:55 +01:00
Alug d188839d0b move R_QuickCamDist to r_main
also mark it with PUREFUNC and R_QuickDist with FUNCMATH, so compiler may optimze it more agressively
2025-11-26 10:09:52 +01:00
Alug 86ac11f877 replace localangle assignments with P_ForceLocalAngle
just a little neater, there also was a function to force the player angle, but this most likely wouldve changed behavior
2025-11-25 22:53:30 +01:00
Alug 0f59e0e270 some mobj interp fixes
copy pasted from RR thx
2025-11-25 22:53:27 +01:00
Alug cd32270ec0 . W
:mompie:
2025-11-25 20:25:29 +01:00
Alug f2a7f9ccaa fix compile with HAVE_DISCORDRPC 2025-11-25 20:21:23 +01:00
Alug 2c2ffe36d7 init a few more globals that were missed
i love globals that are in the middle of files.....
2025-11-25 20:15:27 +01:00
Alug 951b880acb d_netcmd: use cleanup macro for map and localskin command
did Command_Map_f really leak memory all the time? lul
2025-11-25 19:19:19 +01:00
Alug ecfa973e6b move M_ResetDemoList hack to G_InitNew 2025-11-25 19:19:17 +01:00
Alug 749b87b4ca bring back addon name scroll that was lost
oopsie
2025-11-25 17:46:58 +01:00
Alug 7f671e4e30 clean and fixup addon menu
Hopefully should finally fix addons not showing as loaded sometimes and other issues with warning windows being unclosable, etc

lets pray this doesent cause any issues....

add a tickroutine for menus aswell, which will be called in M_Ticker

courtesy of Ring Racers
https://gitlab.com/kart-krew-dev/ring-racers/-/commit/bc9f9d740a0262c249917a37e250ef0209185b12
https://gitlab.com/kart-krew-dev/ring-racers/-/commit/8312f12d6cae934ae8de7e46da231c311f4b4fde
https://gitlab.com/kart-krew-dev/ring-racers/-/commit/6e671d4894e56cd3af09d6e9af2635f030817361
2025-11-25 17:42:01 +01:00
indev ee0e4836f5 Fix race condition in server list search 2025-11-25 19:06:02 +03:00
Alug a01cd628ab do some more cleanup when shutting down graphics system
make sure we free all our opengl allocated stuff by calling HWR_Shutdown
make sure we also destroy our sdl texture, renderer and window if the exist
2025-11-25 16:38:19 +01:00
Alug 4a4e668d21 delet more unused/empty sdl stuff
I_WaitVBL, I_BeginRead and I_EndReada
2025-11-25 16:38:16 +01:00
Alug 03c579769c delet some duped declarations 2025-11-25 13:15:53 +01:00
Alug 2e88b6a1dd fix portal contents being culled erroneously also in software
also dont rember commenting those out in gl lul
2025-11-25 02:18:23 +01:00
Alug 5265b147f5 HWR_BlendMidtextureSurface: add extra guard to check linedef alpha 2025-11-24 22:42:53 +01:00
Alug b4a37a2fa4 fix performance regression in certain cases due to changed polygon order
wonky, needs testing as this may slow down other parts
2025-11-24 22:42:50 +01:00
Alug 93eb2b336d Dedicated: dont create or destroy ANY lua hud drawlist
not needed at all in dedi
2025-11-24 21:32:26 +01:00
Alug 30acdca9d3 cache SRB2BACK patch on startup
this is used in a bunch of places while being pretty small, so just cache it on start
2025-11-24 21:26:07 +01:00
Alug 677b34c174 dont free PU_PATCH_LOWPRIORITY patches in render_none
also dont cache them either!
simply not needed at all
so save us a little work
2025-11-24 21:16:17 +01:00
Alug b3be7bcedc Player Infoscreen: if availible, display player names in their skincolor
we hijack the playerinfo data field for this, and pray to the kart gods this is unused on the ms
2025-11-24 18:20:00 +01:00
Alug 19c10be76b R_QuickCamDist & R_QuickDist: turn into function and make it fixed point
since we mostly use it in fixed point maths, this just makes alot more sense
moving it into inline functions ensures that in C code this wont evaluate its arguments multiple times
2025-11-24 17:44:20 +01:00
Alug 60222f2f00 R_AllocateTextures: remove "reallocuser"
this just does... what Z_Realloc does anyways...
Z_Realloc already zeroes out the new memory it allocates
2025-11-24 17:44:16 +01:00
Alug 34edd0a2e3 some misc cleanups
also account for a few more double evluations from min/max macros
and save a few angle to fixed conversions in spb handling
2025-11-24 17:44:13 +01:00
Alug 46b485df14 Server Infoscreen: Show server kart speed instead of "Cheats"
effectively almost all servers will get flagges as having cheats enabled, so instead show the game speed
2025-11-24 16:57:50 +01:00
Alug 8d3632caca ensure all our savebuffers are initialized
just some safety
2025-11-24 03:16:50 +01:00
Alug b5ae9ba733 remove erronous P_RunDynamicSlopes call in P_PreTicker
we dont run preticker when we netjoin so.....
2025-11-24 01:03:44 +01:00
Alug 2a823ecd60 move K_KartPlayerHUDUpdate to k_hud
how tf did i miss that lul
2025-11-24 00:35:25 +01:00
Alug 940327210f p_setup: move interpolator reset into P_FreeLevelState 2025-11-24 00:35:23 +01:00
Alug 20a08df1e1 K_PlayerEffectsShouldBlend: also apply when player has invulnerability 2025-11-24 00:30:28 +01:00
Alug 4cf27d40e9 apply additive blending to ghosts aswell when using "playerblendeffects"
same conditions as the others
either be in sneakerboost, or go fast enough
2025-11-24 00:28:31 +01:00
Alug d18c9a257a remove erronous ";" 2025-11-24 00:15:59 +01:00
Alug 65dc5bb1fd dont free our titlescreen patches
ever...
Fixes a crash when you take ages on server join and timeout due to it.
2025-11-23 22:31:29 +01:00
Alug e18be33c91 F_IntroDrawer: remove "highres" variable
this was ALWAYS true anyways
2025-11-23 22:02:01 +01:00
Alug 9ad6751719 make Controller Rumble strength user changable
range from 0.25 to 4
to account for all types of controllers and such
base 1 was set around what felt good on my dualsense, not entirely sure if this is the best baseline to go with
otherwise it could still be adjusted
2025-11-23 18:49:40 +01:00
Alug 86ab994408 G_DeviceRumbleTick: get rid of magic numbers
use named constants instead
2025-11-23 18:01:30 +01:00
Alug 21f0d603c3 move gamepad led and rumble tickers into g_input
not entirely sure why i placed them in d_main and p_tick respectively
but they should be here
thx neppy for making me question this lul
2025-11-23 17:59:51 +01:00
Alug 971513e7d3 HWR_BlendMidtextureSurface: fix major performance regression
big oopsie from my side
this caused textures that werent translucent to be marked with translucent in a bunch of cases, which led to them being rendered in a slower path
2025-11-23 15:47:03 +01:00
indev 03929e551f emotes: change autocompletion behavior to work like console 2025-11-23 01:31:38 +03:00
Alug db5ae247b6 LoadMobjThinker: revert faulty local player check 2025-11-22 21:54:54 +01:00
Alug d46beab34e fix signed integer overflow in polygon hash calculation
also gives a speedup on some maps lul
2025-11-22 21:47:45 +01:00
Alug 9a794232d7 HWR_ProcessSeg: fix cliphigh overflow 2025-11-21 19:51:00 +01:00
Alug db635e5c5b K_GetScreenCoords: fix signed overflow
why even cast that to signed......
2025-11-21 19:41:46 +01:00
indev 8a105a9679 If there is only 1 emote suggestion and user presses enter, autocomplete emote 2025-11-21 20:39:33 +03:00
indev 46b968a351 Fix autocomplete messing up emote in few cases 2025-11-21 20:34:34 +03:00
indev a9836307b2 Allow suggesting emotes if currently typed part matches inside emote, not only at beginning 2025-11-21 20:16:19 +03:00
Alug b6515bb0ae fix Wimplicit-const-int-float-conversion warning 2025-11-21 15:16:39 +01:00
Alug b8257e9037 fix memoryleak when searching for iwads
I_LocateWad returns mallocd memory that needs to be freed
and our home search does not need a tmp ptr
just do as we did before and sprintf it into returnwadpath
also check home directory before the hardcoded lists like before (might speed up startup a little on nix)
also cleanup iwad search in dedi builds and apply everything there aswell
2025-11-21 14:47:13 +01:00
Alug 416a2565f9 hw_batching: use polygon hash signbit to detect skywalls/horizonlines
in comparepolygons
gives a nice little performance bump of around 10-15fps in heavy cases
2025-11-20 17:52:14 +01:00
Alug fa75ad4cdd r_opengl: smol micro optimizations
not much, mostly just avoiding redoing things
2025-11-20 17:52:10 +01:00
Alug cedddaadfc r_opengl: delet byte2float lookup
just do direct division
no performance difference at all, but gets rid of that huge ass table
2025-11-20 17:52:07 +01:00
Alug 43ec517cdd small fixes for gamepad indicator led stuff
- skincolors are uint8 type not uint16
- ensure desired colour is within skincolor range
- rename G_GetSkinColor to G_GetSkinColorForGamepad
- replace pointless array with single variable for current color in D_DeviceLEDTick
- remove pointless call to G_GetSkinColorForGamepad when hotplugging gamepads (G_SetPlayerGamepadIndicatorColor will call it itself when 0/skincolor_none is passed)
2025-11-19 23:38:29 +01:00
Alug 495ad5ce06 move this back oop 2025-11-19 22:44:38 +01:00
indev 31ce643311 Check if mobj was actually spawned before setting islocal 2025-11-19 22:07:55 +03:00
Alug b5c1f21ac1 mark all batching variables with static
they are only used within this file, no need to advertise them as global
2025-11-19 18:13:32 +01:00
Alug 86c1b2cbef simplify the vector buffer stuff
honestly doesent make that much sense in most cases to grow capacity * 2 (slightly misunderstood some stuff on implementation)
and in other cases dont need to manually check for resize
2025-11-19 18:12:20 +01:00
Alug ad828b8f4b reduce scope of some fps counter vars 2025-11-19 00:26:07 +01:00
Alug 5dda681c8a clean up some more render float maths
- dont use M_PIl in double or float maths
- dont use M_PI in float maths (use M_PIf)
- use tanf instead of tan
2025-11-19 00:26:03 +01:00
Alug 92df8ffe01 remove thread.h include, use "thread_local" for everything
we enforce c++ 17, thread_local is a c++11 extension, so this should work everywhere
2025-11-18 22:38:37 +01:00
Alug 2ee8dc09d1 fix opengl portals (and its contents) being culled in some cases they shouldnt be
we do culling per our viewmatrix since a while, which wasnt properly set up for portals beforehand and used whatever was last which was then incorrectly applied to portal culling :chaobaba:
2025-11-18 22:38:32 +01:00
Alug b8f9392efd delet I_UpdateNoBlit
this didnt do anything anymore
2025-11-18 22:38:30 +01:00
Alug 99f1166eb1 p_mobj: check for common mobjs first
players first, then kart items, shadows and then some srb2 things that are commonly used
makes more sense to check for all of those first everywhere, so we may skip a crapton of pointless checks in many cases
2025-11-18 16:23:27 +01:00
indev 7ab8bf1bbf Emotes: only print 'too many frames' warning if we actually get non-empty frame 2025-11-18 12:20:33 +03:00
Alug a994d7c050 G_DoPlayDemo: fix maybe unitialized warning
in this case this wouldve been fine, tho variables using the cleanup macro should always be initzialized for safety
2025-11-17 21:59:21 +01:00
Alug e46d548080 testing test 2025-11-17 20:23:58 +01:00
Alug 3a7108ecfa Merge branch 'Saturn' into Saturn-Next 2025-11-17 20:23:23 +01:00
Alug bcf876a4c4 Merge branch 'Saturn-Next' into Saturn 2025-11-17 17:52:31 +01:00
Alug 8ab15b73a9 raise version to 9.1 2025-11-17 17:05:19 +01:00
Alug 301d73a30e Merge pull request #213 from Indev450/revertsdl
Revert SDL2 to 2.28.5 and revert SDL_Mixer to 2.0.4
2025-11-17 17:26:20 +01:00
Alug 2ef4e7fcba Merge branch 'Saturn-Next' into revertsdl 2025-11-17 16:00:16 +01:00
Alug 7eb118920f SOCK_Get: recvfrom returning 0 still means its not a valid packet
0 lenght packets means, nothing
0 is still failure, just graceful, ignore that shit, those are not "valid" packets
2025-11-17 15:57:06 +01:00
Alug 2f0588355e remove old xcode stuff
apparently this does not work at all, and instead cmake can be used on macos
2025-11-17 04:56:58 +01:00
Alug 3e6830fc70 remove sdlsound, provide dummy sound instead
sdl sound was completely broken, so just provide a blank dummy interface instead, when compiling without sdl or mixer
2025-11-17 04:56:55 +01:00
Alug 2faf859e32 add mapicon packets to packettypename
so they properly show in the net debugfile
2025-11-17 04:56:15 +01:00
indev 8c31fd8a34 Allow searching for files inside luafiles 2025-11-17 03:15:23 +03:00
indev 4dd6d52550 Revert "Only skip exclude_paths if we're looking for addons (allows commands like exec find configs in luafiles)"
This reverts commit 8524465767.
Right, -file exists
2025-11-17 03:14:20 +03:00
indev 8524465767 Only skip exclude_paths if we're looking for addons (allows commands like exec find configs in luafiles) 2025-11-17 03:12:00 +03:00
Alug 91530c61ad Provide our own SDL2 dll files
this is plain 2.28.5 like before, but with a fix for the right ALT-GR key backported, so non US layouts can work properly
2025-11-16 22:22:14 +01:00
Alug 89f450db27 Revert "Simplify intermission timer code"
This reverts commit ed16c4fd9f.
2025-11-16 21:56:15 +01:00
Alug 3e212ebaad Revert "Simplify intermission timer code"
This reverts commit ed16c4fd9f.
2025-11-16 21:47:21 +01:00
Alug 14af9eb82a Revert "Merge pull request #204 from Indev450/updatesdl2again"
This reverts commit 38bfb58f78, reversing
changes made to 1fa50e12a8.
2025-11-16 21:20:31 +01:00
Alug ed5dbf74f4 Revert "Merge pull request #206 from Indev450/updatemixer"
This reverts commit ca3f40ddf1, reversing
changes made to 38bfb58f78.
2025-11-16 21:20:26 +01:00
Alug 2bf0a24ab6 Revert "comment out directsound thing"
This reverts commit 37cd720dd6.
2025-11-16 21:20:14 +01:00
Alug 88a9d6c29e Fix dedicated server build
forgor about I_HandleControllerHatRepeat
fixes https://github.com/Indev450/SRB2Kart-Saturn/issues/212
2025-11-16 20:50:15 +01:00
Alug 335b7ba737 Fix dedicated server build
forgor about I_HandleControllerHatRepeat
fixes https://github.com/Indev450/SRB2Kart-Saturn/issues/212
2025-11-16 20:50:09 +01:00
Alug 37cd720dd6 comment out directsound thing
somehow this still applied on 32 bit build
2025-11-16 19:58:17 +01:00
Alug a085abe538 remove "stun.c" from sourcefile
fixes linking on windoze
will need to handle this in cmake seperately!
2025-11-16 19:58:15 +01:00
Alug 57dc099641 Update README 2025-11-16 19:51:44 +01:00
578 changed files with 26770 additions and 44446 deletions

No files matched your search

+38 -29
View File
@@ -1,14 +1,46 @@
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
# Version change is fine.
project(SRB2
VERSION 1.6
LANGUAGES C)
if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR}) if(${PROJECT_SOURCE_DIR} MATCHES ${PROJECT_BINARY_DIR})
message(FATAL_ERROR "In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from.") message(FATAL_ERROR "In-source builds will bring you a world of pain. Please make a separate directory to invoke CMake from.")
endif() endif()
# DO NOT CHANGE THIS SRB2 STRING! Some variable names depend on this string.
# Version change is fine.
project(SRB2
VERSION 1.6
LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#set(CMAKE_CXX_EXTENSIONS OFF) # optional but recommended: disables GNU extensions, forces pure ISO C++
set(CMAKE_CXX_EXTENSIONS ON)
set(CMAKE_C_EXTENSIONS ON)
##### PACKAGE CONFIGURATION #####
set(SRB2_CPACK_GENERATOR "" CACHE STRING "Generator to use for making a package. E.g., ZIP, TGZ, DragNDrop (OSX only). Leave blank for default generator.")
if("${SRB2_CPACK_GENERATOR}" STREQUAL "")
if("${CMAKE_SYSTEM_NAME}" MATCHES "Windows")
set(SRB2_CPACK_GENERATOR "ZIP")
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(SRB2_CPACK_GENERATOR "TGZ")
elseif("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
set(SRB2_CPACK_GENERATOR "TGZ")
endif()
endif()
set(CPACK_GENERATOR ${SRB2_CPACK_GENERATOR})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2 Kart" CACHE STRING "Program name for display purposes")
set(CPACK_PACKAGE_VENDOR "Kart Krew" CACHE STRING "Vendor name for display purposes")
#set(CPACK_PACKAGE_DESCRIPTION_FILE )
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
include(CPack)
# Set up CMAKE path # Set up CMAKE path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
@@ -73,6 +105,7 @@ endif()
# OS macros # OS macros
if (UNIX) if (UNIX)
add_definitions(-DUNIXCOMMON) add_definitions(-DUNIXCOMMON)
add_link_options(-rdynamic) # Use -rdynamic so a backtrace log shows function names
endif() endif()
if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCC)
@@ -95,14 +128,12 @@ set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
# Set EXE names so the assets CMakeLists can refer to its target # Set EXE names so the assets CMakeLists can refer to its target
set(SRB2_SDL2_EXE_NAME srb2kart CACHE STRING "Executable binary output name") set(SRB2_SDL2_EXE_NAME srb2kart CACHE STRING "Executable binary output name")
set(SRB2_WIN_EXE_NAME srb2kartdd CACHE STRING "Executable binary output name for DirectDraw build")
include_directories(${CMAKE_CURRENT_BINARY_DIR}/src) include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(assets) add_subdirectory(assets)
## config.h generation ## config.h generation
set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary") set(GIT_EXECUTABLE "git" CACHE FILEPATH "Path to git binary")
include(GitUtilities) include(GitUtilities)
@@ -111,25 +142,3 @@ git_current_branch(SRB2_GIT_BRANCH "${CMAKE_SOURCE_DIR}")
set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}") set(SRB2_COMP_BRANCH "${SRB2_GIT_BRANCH}")
set(SRB2_COMP_REVISION "${SRB2_COMP_COMMIT}") set(SRB2_COMP_REVISION "${SRB2_COMP_COMMIT}")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.h)
##### PACKAGE CONFIGURATION #####
if(${CMAKE_SYSTEM} MATCHES "Windows")
set(CPACK_GENERATOR "ZIP")
endif()
if(${CMAKE_SYSTEM} MATCHES "Linux")
set(CPACK_GENERATOR "TGZ")
endif()
if(${CMAKE_SYSTEM} MATCHES "Darwin")
set(CPACK_GENERATOR "DragNDrop")
endif()
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Sonic Robo Blast 2 Kart" CACHE STRING "Program name for display purposes")
set(CPACK_PACKAGE_VENDOR "Kart Krew" CACHE STRING "Vendor name for display purposes")
#set(CPACK_PACKAGE_DESCRIPTION_FILE )
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR ${SRB2_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${SRB2_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${SRB2_VERSION_PATCH})
set(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMAKE_VERSION_MAJOR}.${CMAKE_VERSION_MINOR}")
include(CPack)
+8 -1
View File
@@ -13,10 +13,12 @@ Mainly for use in visual-only addons like secondcolor.
**Not netsafe**. Returns player's current sliptide roll angle, taking sliptideroll cvar value into account. **Not netsafe**. Returns player's current sliptide roll angle, taking sliptideroll cvar value into account.
## hud.setVoteBackground(name) ## hud.setVoteBackground(name[, time\_per\_frame])
Changes vote background texture prefix (game looks for PREFIX + "W" or "C" (depends on resolution) + FRAME\_NUMBER). Changes vote background texture prefix (game looks for PREFIX + "W" or "C" (depends on resolution) + FRAME\_NUMBER).
If time\_per\_frame is set, each frame will last this amount of tics, default value is 2
## hud.add(fn, "vote") and hud.add(fn, "intermission") ## hud.add(fn, "vote") and hud.add(fn, "intermission")
Hud hooks for vote screen and intermission screen. They only get drawer (`v`) as argument. Hud hooks for vote screen and intermission screen. They only get drawer (`v`) as argument.
@@ -120,6 +122,11 @@ v.interpLatch(false)
``` ```
When using a custom string drawer, enable this mode to avoid interpolation artifacting when the string changes. When using a custom string drawer, enable this mode to avoid interpolation artifacting when the string changes.
## cameras[] global array
Local player cameras that can be accessed outside of hud hooks.
`#cameras` will return amount of available cameras. (0 on dedicated server, 1 with 1 player, 4 with 4p splitscreen, etc)
## mobj.spritexscale, mobj.spriteyscale, mobj.spritexoffset, mobj.spriteyoffset, mobj.rollangle, mobj.sloperoll, mobj.rollmodel fields ## mobj.spritexscale, mobj.spriteyscale, mobj.spritexoffset, mobj.spriteyoffset, mobj.rollangle, mobj.sloperoll, mobj.rollmodel fields
Same fields as in SRB2 2.2 Same fields as in SRB2 2.2
+3 -2
View File
@@ -22,13 +22,14 @@ We also have a Flatpak available on [Flathub](https://flathub.org/en/apps/org.sr
See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling). The compiling process for SRB2Kart is largely identical to SRB2. See [SRB2 Wiki/Source code compiling](http://wiki.srb2.org/wiki/Source_code_compiling). The compiling process for SRB2Kart is largely identical to SRB2.
Currently only the Makefile build system with GCC or Clang compiler is supported. For Windows only the Makefile build system with GCC or Clang compiler is supported.
Visual C++ (MSVC) is unsupported. Visual C++ (MSVC) is unsupported.
64-bit Windows builds are supported and recommended over 32-bit builds, they will build automatically when using the MSYS2 MinGW 64-bit executable (requires the mingw-w64-x86_64-gcc package), no extra flags needed! 64-bit Windows builds are supported and recommended over 32-bit builds, they will build automatically when using the MSYS2 MinGW 64-bit executable (requires the mingw-w64-x86_64-gcc package), no extra flags needed!
The specific DLLs can be found under /libs/dll-binaries/(i686 for 32bit/x86_64 for 64-bit)/ or in the Release packages The specific DLLs can be found under /libs/dll-binaries/(i686 for 32bit/x86_64 for 64-bit)/ or in the Release packages
MacOS and Linux can be build with CMake, but it is recommended to use the Makefile for Linux over CMake
Alternatively the [srb2bld](https://github.com/Bijman/srb2bld) script by Bijman can be used aswell! Alternatively the [srb2bld](https://github.com/Bijman/srb2bld) script by Bijman can be used aswell!
## Disclaimer ## Disclaimer
+5
View File
@@ -1,5 +1,10 @@
## Assets Target Configuration ## ## Assets Target Configuration ##
if(${CMAKE_SYSTEM} MATCHES Linux)
# Asset installation isn't part of the Linux target
return()
endif()
# For prepending the current source path, later # For prepending the current source path, later
FUNCTION(PREPEND var prefix) FUNCTION(PREPEND var prefix)
SET(listVar "") SET(listVar "")
+2 -1
View File
@@ -1,6 +1,6 @@
include(LibFindMacros) include(LibFindMacros)
libfind_pkg_check_modules(GME_PKGCONF GME) libfind_pkg_check_modules(GME_PKGCONF LIBGME)
find_path(GME_INCLUDE_DIR find_path(GME_INCLUDE_DIR
NAMES gme.h NAMES gme.h
@@ -8,6 +8,7 @@ find_path(GME_INCLUDE_DIR
${GME_PKGCONF_INCLUDE_DIRS} ${GME_PKGCONF_INCLUDE_DIRS}
"/usr/include/gme" "/usr/include/gme"
"/usr/local/include/gme" "/usr/local/include/gme"
PATH_SUFFIXES gme
) )
find_library(GME_LIBRARY find_library(GME_LIBRARY
+2 -1
View File
@@ -1,6 +1,6 @@
include(LibFindMacros) include(LibFindMacros)
libfind_pkg_check_modules(OPENMPT_PKGCONF OPENMPT) libfind_pkg_check_modules(OPENMPT_PKGCONF LIBOPENMPT)
find_path(OPENMPT_INCLUDE_DIR find_path(OPENMPT_INCLUDE_DIR
NAMES libopenmpt.h NAMES libopenmpt.h
@@ -8,6 +8,7 @@ find_path(OPENMPT_INCLUDE_DIR
${OPENMPT_PKGCONF_INCLUDE_DIRS} ${OPENMPT_PKGCONF_INCLUDE_DIRS}
"/usr/include/libopenmpt" "/usr/include/libopenmpt"
"/usr/local/include/libopenmpt" "/usr/local/include/libopenmpt"
PATH_SUFFIXES libopenmpt
) )
find_library(OPENMPT_LIBRARY find_library(OPENMPT_LIBRARY
+33
View File
@@ -0,0 +1,33 @@
include(LibFindMacros)
libfind_pkg_check_modules(LIBBACKTRACE_PKGCONF LIBBACKTRACE)
find_path(LIBBACKTRACE_INCLUDE_DIR
NAMES backtrace.h
PATHS
${LIBBACKTRACE_PKGCONF_INCLUDE_DIRS}
"/usr/include"
"/usr/local/include"
)
find_library(LIBBACKTRACE_LIBRARY
NAMES backtrace
PATHS
${LIBBACKTRACE_PKGCONF_LIBRARY_DIRS}
"/usr/lib"
"/usr/local/lib"
)
set(LIBBACKTRACE_PROCESS_INCLUDES LIBBACKTRACE_INCLUDE_DIR)
set(LIBBACKTRACE_PROCESS_LIBS LIBBACKTRACE_LIBRARY)
libfind_process(LIBBACKTRACE)
if(LIBBACKTRACE_FOUND AND NOT TARGET libbacktrace)
add_library(libbacktrace UNKNOWN IMPORTED)
set_target_properties(
libbacktrace
PROPERTIES
IMPORTED_LOCATION "${LIBBACKTRACE_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBBACKTRACE_INCLUDE_DIR}"
)
endif()
+37 -18
View File
@@ -1,4 +1,4 @@
# Version 2.2 # Version 2.4
# Public Domain, originally written by Lasse Kärkkäinen <tronic> # Public Domain, originally written by Lasse Kärkkäinen <tronic>
# Maintained at https://github.com/Tronic/cmake-modules # Maintained at https://github.com/Tronic/cmake-modules
# Please send your improvements as pull requests on Github. # Please send your improvements as pull requests on Github.
@@ -52,6 +52,10 @@ function (libfind_pkg_detect PREFIX)
if (libraryargs) if (libraryargs)
find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS}) find_library(${PREFIX}_LIBRARY NAMES ${libraryargs} HINTS ${${PREFIX}_PKGCONF_LIBRARY_DIRS})
endif() endif()
# Read pkg-config version
if (${PREFIX}_PKGCONF_VERSION)
set(${PREFIX}_VERSION ${${PREFIX}_PKGCONF_VERSION} PARENT_SCOPE)
endif()
endfunction() endfunction()
# Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION. # Extracts a version #define from a version.h file, output stored to <PREFIX>_VERSION.
@@ -125,24 +129,39 @@ function (libfind_process PREFIX)
# Process deps to add to # Process deps to add to
foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES}) foreach (i ${PREFIX} ${${PREFIX}_DEPENDENCIES})
if (DEFINED ${i}_INCLUDE_OPTS OR DEFINED ${i}_LIBRARY_OPTS) if (DEFINED ${i}_INCLUDE_OPTS)
# The package seems to export option lists that we can use, woohoo! # The package seems to export option lists that we can use, woohoo!
list(APPEND includeopts ${${i}_INCLUDE_OPTS}) list(APPEND includeopts ${${i}_INCLUDE_OPTS})
else()
if (DEFINED ${i}_INCLUDE_DIR)
# Singular forms can be used
list(APPEND includeopts ${i}_INCLUDE_DIR)
else()
if (DEFINED ${i}_INCLUDE_DIRS)
# Plural forms can be used
list(APPEND includeopts ${i}_INCLUDE_DIRS)
else()
# Oh no, we don't know the option names
message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes. Aieeh!")
endif()
endif()
endif()
if (DEFINED ${i}_LIBRARY_OPTS)
# The package seems to export option lists that we can use, woohoo!
list(APPEND libraryopts ${${i}_LIBRARY_OPTS}) list(APPEND libraryopts ${${i}_LIBRARY_OPTS})
else() else()
# If plural forms don't exist or they equal singular forms if (DEFINED ${i}_LIBRARY)
if ((NOT DEFINED ${i}_INCLUDE_DIRS AND NOT DEFINED ${i}_LIBRARIES) OR
({i}_INCLUDE_DIR STREQUAL ${i}_INCLUDE_DIRS AND ${i}_LIBRARY STREQUAL ${i}_LIBRARIES))
# Singular forms can be used # Singular forms can be used
if (DEFINED ${i}_INCLUDE_DIR) list(APPEND libraryopts ${i}_LIBRARY)
list(APPEND includeopts ${i}_INCLUDE_DIR)
endif()
if (DEFINED ${i}_LIBRARY)
list(APPEND libraryopts ${i}_LIBRARY)
endif()
else() else()
# Oh no, we don't know the option names if (DEFINED ${i}_LIBRARIES)
message(FATAL_ERROR "We couldn't determine config variable names for ${i} includes and libs. Aieeh!") # Plural forms can be used
list(APPEND libraryopts ${i}_LIBRARIES)
else()
# Oh no, we don't know the option names
message(FATAL_ERROR "We couldn't determine config variable names for ${i} libraries. Aieeh!")
endif()
endif() endif()
endif() endif()
endforeach() endforeach()
@@ -209,12 +228,12 @@ function (libfind_process PREFIX)
message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}") message(STATUS " ${PREFIX}_LIBRARY_OPTS=${libraryopts}")
message(STATUS " ${PREFIX}_LIBRARIES=${libs}") message(STATUS " ${PREFIX}_LIBRARIES=${libs}")
endif() endif()
set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
endif() endif()
set (${PREFIX}_INCLUDE_OPTS ${includeopts} PARENT_SCOPE)
set (${PREFIX}_LIBRARY_OPTS ${libraryopts} PARENT_SCOPE)
set (${PREFIX}_INCLUDE_DIRS ${includes} PARENT_SCOPE)
set (${PREFIX}_LIBRARIES ${libs} PARENT_SCOPE)
set (${PREFIX}_FOUND TRUE PARENT_SCOPE)
return() return()
endif() endif()
-18
View File
@@ -1,18 +0,0 @@
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
-19
View File
@@ -1,28 +1,9 @@
This is a list of major changes in SDL's version history. This is a list of major changes in SDL's version history.
---------------------------------------------------------------------------
2.30.0:
---------------------------------------------------------------------------
General:
* Added support for 2 bits-per-pixel indexed surface formats
* Added the function SDL_GameControllerGetSteamHandle() to get the Steam API handle for a controller, if available
* Added the event SDL_CONTROLLERSTEAMHANDLEUPDATED which is sent when the Steam API handle for a controller changes. This could also change the name, VID, and PID of the controller.
* Added the environment variable SDL_LOGGING to control default log output
macOS:
* Added the hint SDL_HINT_JOYSTICK_IOKIT to control whether the IOKit controller driver should be used
* Added the hint SDL_HINT_JOYSTICK_MFI to control whether the GCController controller driver should be used
* Added the hint SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE to choose whether high or low power GPU should be used for rendering, in the case where there are multiple GPUs available
Xbox:
* Added the function SDL_GDKGetDefaultUser()
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
2.28.2: 2.28.2:
--------------------------------------------------------------------------- ---------------------------------------------------------------------------
General: General:
* Added the hint SDL_HINT_JOYSTICK_WGI to control whether to use Windows.Gaming.Input for controllers * Added the hint SDL_HINT_JOYSTICK_WGI to control whether to use Windows.Gaming.Input for controllers
+2 -2
View File
@@ -35,7 +35,7 @@ SDL now has, internally, a table of function pointers. So, this is what SDL_Init
now looks like: now looks like:
```c ```c
Uint32 SDL_Init(Uint32 flags) UInt32 SDL_Init(Uint32 flags)
{ {
return jump_table.SDL_Init(flags); return jump_table.SDL_Init(flags);
} }
@@ -100,7 +100,7 @@ a shared library of its own). If so, it loads that library and looks for and
calls a single function: calls a single function:
```c ```c
Sint32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize); SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize);
``` ```
That function takes a version number (more on that in a moment), the address of That function takes a version number (more on that in a moment), the address of
+35 -333
View File
@@ -1,187 +1,27 @@
# Emscripten # Emscripten
## The state of things (This documentation is not very robust; we will update and expand this later.)
(As of September 2023, but things move quickly and we don't update this ## A quick note about audio
document often.)
In modern times, all the browsers you probably care about (Chrome, Firefox,
Edge, and Safari, on Windows, macOS, Linux, iOS and Android), support some
reasonable base configurations:
- WebAssembly (don't bother with asm.js any more)
- WebGL (which will look like OpenGL ES 2 or 3 to your app).
- Threads (see caveats, though!)
- Game controllers
- Autoupdating (so you can assume they have a recent version of the browser)
All this to say we're at the point where you don't have to make a lot of
concessions to get even a fairly complex SDL-based game up and running.
## RTFM
This document is a quick rundown of some high-level details. The
documentation at [emscripten.org](https://emscripten.org/) is vast
and extremely detailed for a wide variety of topics, and you should at
least skim through it at some point.
## Porting your app to Emscripten
Many many things just need some simple adjustments and they'll compile
like any other C/C++ code, as long as SDL was handling the platform-specific
work for your program.
First, you probably need this in at least one of your source files:
```c
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
```
Second: assembly language code has to go. Replace it with C. You can even use
[x86 SIMD intrinsic functions in Emscripten](https://emscripten.org/docs/porting/simd.html)!
Third: Middleware has to go. If you have a third-party library you link
against, you either need an Emscripten port of it, or the source code to it
to compile yourself, or you need to remove it.
Fourth: You still start in a function called main(), but you need to get out of
it and into a function that gets called repeatedly, and returns quickly,
called a mainloop.
Somewhere in your program, you probably have something that looks like a more
complicated version of this:
```c
void main(void)
{
initialize_the_game();
while (game_is_still_running) {
check_for_new_input();
think_about_stuff();
draw_the_next_frame();
}
deinitialize_the_game();
}
```
This will not work on Emscripten, because the main thread needs to be free
to do stuff and can't sit in this loop forever. So Emscripten lets you set up
a [mainloop](https://emscripten.org/docs/porting/emscripten-runtime-environment.html#browser-main-loop).
```c
static void mainloop(void) /* this will run often, possibly at the monitor's refresh rate */
{
if (!game_is_still_running) {
deinitialize_the_game();
#ifdef __EMSCRIPTEN__
emscripten_cancel_main_loop(); /* this should "kill" the app. */
#else
exit(0);
#endif
}
check_for_new_input();
think_about_stuff();
draw_the_next_frame();
}
void main(void)
{
initialize_the_game();
#ifdef __EMSCRIPTEN__
emscripten_set_main_loop(mainloop, 0, 1);
#else
while (1) { mainloop(); }
#endif
}
```
Basically, `emscripten_set_main_loop(mainloop, 0, 1);` says "run
`mainloop` over and over until I end the program." The function will
run, and return, freeing the main thread for other tasks, and then
run again when it's time. The `1` parameter does some magic to make
your main() function end immediately; this is useful because you
don't want any shutdown code that might be sitting below this code
to actually run if main() were to continue on, since we're just
getting started.
There's a lot of little details that are beyond the scope of this
document, but that's the biggest intial set of hurdles to porting
your app to the web.
## Do you need threads?
If you plan to use threads, they work on all major browsers now. HOWEVER,
they bring with them a lot of careful considerations. Rendering _must_
be done on the main thread. This is a general guideline for many
platforms, but a hard requirement on the web.
Many other things also must happen on the main thread; often times SDL
and Emscripten make efforts to "proxy" work to the main thread that
must be there, but you have to be careful (and read more detailed
documentation than this for the finer points).
Even when using threads, your main thread needs to set an Emscripten
mainloop that runs quickly and returns, or things will fail to work
correctly.
You should definitely read [Emscripten's pthreads docs](https://emscripten.org/docs/porting/pthreads.html)
for all the finer points. Mostly SDL's thread API will work as expected,
but is built on pthreads, so it shares the same little incompatibilities
that are documented there, such as where you can use a mutex, and when
a thread will start running, etc.
IMPORTANT: You have to decide to either build something that uses
threads or something that doesn't; you can't have one build
that works everywhere. This is an Emscripten (or maybe WebAssembly?
Or just web browsers in general?) limitation. If you aren't using
threads, it's easier to not enable them at all, at build time.
If you use threads, you _have to_ run from a web server that has
[COOP/COEP headers set correctly](https://web.dev/why-coop-coep/)
or your program will fail to start at all.
If building with threads, `__EMSCRIPTEN_PTHREADS__` will be defined
for checking with the C preprocessor, so you can build something
different depending on what sort of build you're compiling.
## Audio
Audio works as expected at the API level, but not exactly like other
platforms.
You'll only see a single default audio device. Audio capture also works;
if the browser pops up a prompt to ask for permission to access the
microphone, the SDL_OpenAudioDevice call will succeed and start producing
silence at a regular interval. Once the user approves the request, real
audio data will flow. If the user denies it, the app is not informed and
will just continue to receive silence.
Modern web browsers will not permit web pages to produce sound before the Modern web browsers will not permit web pages to produce sound before the
user has interacted with them (clicked or tapped on them, usually); this is user has interacted with them; this is for several reasons, not the least
for several reasons, not the least of which being that no one likes when a of which being that no one likes when a random browser tab suddenly starts
random browser tab suddenly starts making noise and the user has to scramble making noise and the user has to scramble to figure out which and silence
to figure out which and silence it. it.
SDL will allow you to open the audio device for playback in this To solve this, most browsers will refuse to let a web app use the audio
circumstance, and your audio callback will fire, but SDL will throw the audio subsystem at all before the user has interacted with (clicked on) the page
data away until the user interacts with the page. This helps apps that depend in a meaningful way. SDL-based apps also have to deal with this problem; if
on the audio callback to make progress, and also keeps audio playback in sync the user hasn't interacted with the page, SDL_OpenAudioDevice will fail.
once the app is finally allowed to make noise.
There are two reasonable ways to deal with the silence at the app level: There are two reasonable ways to deal with this: if you are writing some
if you are writing some sort of media player thing, where the user expects sort of media player thing, where the user expects there to be a volume
there to be a volume control when you mouseover the canvas, just default control when you mouseover the canvas, just default that control to a muted
that control to a muted state; if the user clicks on the control to unmute state; if the user clicks on the control to unmute it, on this first click,
it, on this first click, open the audio device. This allows the media to open the audio device. This allows the media to play at start, the user can
play at start, and the user can reasonably opt-in to listening. reasonably opt-in to listening, and you never get access denied to the audio
device.
Many games do not have this sort of UI, and are more rigid about starting Many games do not have this sort of UI, and are more rigid about starting
audio along with everything else at the start of the process. For these, your audio along with everything else at the start of the process. For these, your
@@ -196,179 +36,41 @@ Please see the discussion at https://github.com/libsdl-org/SDL/issues/6385
for some Javascript code to steal for this approach. for some Javascript code to steal for this approach.
## Rendering
If you use SDL's 2D render API, it will use GLES2 internally, which
Emscripten will turn into WebGL calls. You can also use OpenGL ES 2
directly by creating a GL context and drawing into it.
Calling SDL_RenderPresent (or SDL_GL_SwapWindow) will not actually
present anything on the screen until your return from your mainloop
function.
## Building SDL/emscripten ## Building SDL/emscripten
First: do you _really_ need to build SDL from source?
If you aren't developing SDL itself, have a desire to mess with its source
code, or need something on the bleeding edge, don't build SDL. Just use
Emscripten's packaged version!
Compile and link your app with `-sUSE_SDL=2` and it'll use a build of
SDL packaged with Emscripten. This comes from the same source code and
fixes the Emscripten project makes to SDL are generally merged into SDL's
revision control, so often this is much easier for app developers.
`-sUSE_SDL=1` will select Emscripten's JavaScript reimplementation of SDL
1.2 instead; if you need SDL 1.2, this might be fine, but we generally
recommend you don't use SDL 1.2 in modern times.
If you want to build SDL, though...
SDL currently requires at least Emscripten 3.1.35 to build. Newer versions SDL currently requires at least Emscripten 3.1.35 to build. Newer versions
are likely to work, as well. are likely to work, as well.
Build: Build:
This works on Linux/Unix and macOS. Please send comments about Windows. $ mkdir build
$ cd build
Make sure you've [installed emsdk](https://emscripten.org/docs/getting_started/downloads.html) $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2"
first, and run `source emsdk_env.sh` at the command line so it finds the $ emmake make
tools.
(These configure options might be overkill, but this has worked for me.)
```bash
cd SDL
mkdir build
cd build
emconfigure ../configure --host=wasm32-unknown-emscripten --disable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3"
emmake make -j4
```
If you want to build with thread support, something like this works:
```bash
emconfigure ../configure --host=wasm32-unknown-emscripten --enable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3 -pthread" LDFLAGS="-pthread"
```
Or with cmake: Or with cmake:
```bash $ mkdir build
mkdir build $ cd build
cd build $ emcmake cmake ..
emcmake cmake .. $ emmake make
emmake make -j4
```
To build one of the tests: To build one of the tests:
```bash $ cd test/
cd test/ $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
```
## Building your app Uses GLES2 renderer or software
You need to compile with `emcc` instead of `gcc` or `clang` or whatever, but Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere):
mostly it uses the same command line arguments as Clang.
Link against the SDL/build/.libs/libSDL2.a file you generated by building SDL, SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/):
link with `-sUSE_SDL=2` to use Emscripten's prepackaged SDL2 build.
Usually you would produce a binary like this:
```bash
gcc -o mygame mygame.c # or whatever
```
But for Emscripten, you want to output something else:
```bash
emcc -o index.html mygame.c
```
This will produce several files...support Javascript and WebAssembly (.wasm)
files. The `-o index.html` will produce a simple HTML page that loads and
runs your app. You will (probably) eventually want to replace or customize
that file and do `-o index.js` instead to just build the code pieces.
If you're working on a program of any serious size, you'll likely need to
link with `-sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=1gb` to get access
to more memory. If using pthreads, you'll need the `-sMAXIMUM_MEMORY=1gb`
or the app will fail to start on iOS browsers, but this might be a bug that
goes away in the future.
## Data files
Your game probably has data files. Here's how to access them.
Filesystem access works like a Unix filesystem; you have a single directory
tree, possibly interpolated from several mounted locations, no drive letters,
'/' for a path separator. You can access them with standard file APIs like
open() or fopen() or SDL_RWops. You can read or write from the filesystem.
By default, you probably have a "MEMFS" filesystem (all files are stored in
memory, but access to them is immediate and doesn't need to block). There are
other options, like "IDBFS" (files are stored in a local database, so they
don't need to be in RAM all the time and they can persist between runs of the
program, but access is not synchronous). You can mix and match these file
systems, mounting a MEMFS filesystem at one place and idbfs elsewhere, etc,
but that's beyond the scope of this document. Please refer to Emscripten's
[page on the topic](https://emscripten.org/docs/porting/files/file_systems_overview.html)
for more info.
The _easiest_ (but not the best) way to get at your data files is to embed
them in the app itself. Emscripten's linker has support for automating this.
```bash
emcc -o index.html loopwave.c --embed-file=../test/sample.wav@/sounds/sample.wav
```
This will pack ../test/sample.wav in your app, and make it available at
"/sounds/sample.wav" at runtime. Emscripten makes sure this data is available
before your main() function runs, and since it's in MEMFS, you can just
read it like you do on other platforms. `--embed-file` can also accept a
directory to pack an entire tree, and you can specify the argument multiple
times to pack unrelated things into the final installation.
Note that this is absolutely the best approach if you have a few small
files to include and shouldn't worry about the issue further. However, if you
have hundreds of megabytes and/or thousands of files, this is not so great,
since the user will download it all every time they load your page, and it
all has to live in memory at runtime.
[Emscripten's documentation on the matter](https://emscripten.org/docs/porting/files/packaging_files.html)
gives other options and details, and is worth a read.
## Debugging
Debugging web apps is a mixed bag. You should compile and link with
`-gsource-map`, which embeds a ton of source-level debugging information into
the build, and make sure _the app source code is available on the web server_,
which is often a scary proposition for various reasons.
When you debug from the browser's tools and hit a breakpoint, you can step
through the actual C/C++ source code, though, which can be nice.
If you try debugging in Firefox and it doesn't work well for no apparent
reason, try Chrome, and vice-versa. These tools are still relatively new,
and improving all the time.
SDL_Log() (or even plain old printf) will write to the Javascript console,
and honestly I find printf-style debugging to be easier than setting up a build
for proper debugging, so use whatever tools work best for you.
## Questions?
Please give us feedback on this document at [the SDL bug tracker](https://github.com/libsdl-org/SDL/issues).
If something is wrong or unclear, we want to know!
$ EMCONFIGURE_JS=1 emconfigure ../configure
build as usual...
SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx):
$ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx
build as usual...
+1 -22
View File
@@ -3,7 +3,7 @@ GDK
This port allows SDL applications to run via Microsoft's Game Development Kit (GDK). This port allows SDL applications to run via Microsoft's Game Development Kit (GDK).
Windows (GDK) and Xbox One/Xbox Series (GDKX) are both supported and all the required code is included in this public SDL release. However, only licensed Xbox developers have access to the GDKX libraries which will allow you to build the Xbox targets. Windows (GDK) and Xbox One/Xbox Series (GDKX) are supported. Although most of the Xbox code is included in the public SDL source code, NDA access is required for a small number of source files. If you have access to GDKX, these required Xbox files are posted on the GDK forums [here](https://forums.xboxlive.com/questions/130003/).
Requirements Requirements
@@ -11,7 +11,6 @@ Requirements
* Microsoft Visual Studio 2022 (in theory, it should also work in 2017 or 2019, but this has not been tested) * Microsoft Visual Studio 2022 (in theory, it should also work in 2017 or 2019, but this has not been tested)
* Microsoft GDK June 2022 or newer (public release [here](https://github.com/microsoft/GDK/releases/tag/June_2022)) * Microsoft GDK June 2022 or newer (public release [here](https://github.com/microsoft/GDK/releases/tag/June_2022))
* For Xbox, you will need the corresponding GDKX version (licensed developers only)
* To publish a package or successfully authenticate a user, you will need to create an app id/configure services in Partner Center. However, for local testing purposes (without authenticating on Xbox Live), the identifiers used by the GDK test programs in the included solution will work. * To publish a package or successfully authenticate a user, you will need to create an app id/configure services in Partner Center. However, for local testing purposes (without authenticating on Xbox Live), the identifiers used by the GDK test programs in the included solution will work.
@@ -30,12 +29,6 @@ The Windows GDK port supports the full set of Win32 APIs, renderers, controllers
* Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`). * Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`).
* You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak). * You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak).
* Single-player games have some additional features available:
* Call `SDL_GDKGetDefaultUser` to get the default XUserHandle pointer.
* `SDL_GetPrefPath` still works, but only for single-player titles.
These functions mostly wrap around async APIs, and thus should be treated as synchronous alternatives. Also note that the single-player functions return on any OS errors, so be sure to validate the return values!
* What doesn't work: * What doesn't work:
* Compilation with anything other than through the included Visual C++ solution file * Compilation with anything other than through the included Visual C++ solution file
@@ -146,20 +139,6 @@ To create the package:
6. Once the package is installed, you can run it from the start menu. 6. Once the package is installed, you can run it from the start menu.
7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox. 7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox.
Xbox GDKX Setup
---------------------
In general, the same process in the Windows GDK instructions work. There are just a few additional notes:
* For Xbox One consoles, use the Gaming.Xbox.XboxOne.x64 target
* For Xbox Series consoles, use the Gaming.Xbox.Scarlett.x64 target
* The Xbox One target sets the `__XBOXONE__` define and the Xbox Series target sets the `__XBOXSERIES__` define
* You don't need to link against the Xbox.Services Thunks lib nor include that dll in your package (it doesn't exist for Xbox)
* The shader blobs for Xbox are created in a pre-build step for the Xbox targets, rather than included in the source (due to NDA and version compatability reasons)
* To create a package, use:
`makepkg pack /f PackageLayout.xml /lt /d . /pd Package`
* To install the package, use:
`xbapp install [PACKAGE].xvc`
* For some reason, if you make changes that require SDL2.dll to build, and you are running through the debugger (instead of a package), you have to rebuild your .exe target for the debugger to recognize the dll has changed and needs to be transferred to the console again
* While there are successful releases of Xbox titles using this port, it is not as extensively tested as other targets
Troubleshooting Troubleshooting
--------------- ---------------
+2 -2
View File
@@ -257,7 +257,7 @@ Game Center
Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using: Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using:
int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam); int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam);
This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run. This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run.
@@ -273,7 +273,7 @@ e.g.
{ {
... initialize game ... ... initialize game ...
#ifdef __IPHONEOS__ #if __IPHONEOS__
// Initialize the Game Center for scoring and matchmaking // Initialize the Game Center for scoring and matchmaking
InitGameCenter(); InitGameCenter();
+4 -4
View File
@@ -261,10 +261,10 @@ Some things that may be of interest about how it all works...
## Working directory ## Working directory
In SDL 1.2, the working directory of your SDL app is by default set to its In SDL 1.2, the working directory of your SDL app is by default set to its
parent, but this is no longer the case in SDL 2.0 and later. SDL2 does not parent, but this is no longer the case in SDL 2.0. SDL2 does change the
change the working directory, which means it'll be whatever the command line working directory, which means it'll be whatever the command line prompt
prompt that launched the program was using, or if launched by double-clicking that launched the program was using, or if launched by double-clicking in
in the Finder, it will be "/", the _root of the filesystem_. Plan accordingly! the finger, it will be "/", the _root of the filesystem_. Plan accordingly!
You can use SDL_GetBasePath() to find where the program is running from and You can use SDL_GetBasePath() to find where the program is running from and
chdir() there directly. chdir() there directly.
Binary file not shown.
+7 -7
View File
@@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
# Get the canonical path of the folder containing this script # Get the canonical path of the folder containing this script
bindir=`cd -P -- "\`dirname -- "$0"\`" && printf '%s\n' "\`pwd -P\`"` bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
# Calculate the canonical path of the prefix, relative to the folder of this script # Calculate the canonical path of the prefix, relative to the folder of this script
prefix=`cd -P -- "$bindir/.." && printf '%s\n' "\`pwd -P\`"` prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
exec_prefix=${prefix}/bin exec_prefix=${prefix}
exec_prefix_set=no exec_prefix_set=no
libdir=${prefix}/lib libdir=${exec_prefix}/lib
#usage="\ #usage="\
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]" #Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
@@ -43,18 +43,18 @@ while test $# -gt 0; do
echo $exec_prefix echo $exec_prefix
;; ;;
--version) --version)
echo 2.32.10 echo 2.28.5
;; ;;
--cflags) --cflags)
echo -I${prefix}/include/SDL2 -Dmain=SDL_main echo -I${prefix}/include/SDL2 -Dmain=SDL_main
;; ;;
--libs) --libs)
echo -L${prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
;; ;;
--static-libs) --static-libs)
# --libs|--static-libs) # --libs|--static-libs)
sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g") sdl_static_libs=$(echo "-lmingw32 -lSDL2main -lSDL2 -mwindows -Wl,--dynamicbase -Wl,--nxcompat -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid" | sed -E "s#-lSDL2[ $]#$libdir/libSDL2.a #g")
echo -L${prefix}/lib $sdl_static_libs echo -L${exec_prefix}/lib $sdl_static_libs
;; ;;
*) *)
echo "${usage}" 1>&2 echo "${usage}" 1>&2
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -25,6 +25,7 @@
* Main include header for the SDL library * Main include header for the SDL library
*/ */
#ifndef SDL_h_ #ifndef SDL_h_
#define SDL_h_ #define SDL_h_
@@ -69,8 +70,6 @@
extern "C" { extern "C" {
#endif #endif
/* WIKI CATEGORY: Init */
/* As of version 0.5, SDL is loaded dynamically into the application */ /* As of version 0.5, SDL is loaded dynamically into the application */
/** /**
@@ -131,7 +130,7 @@ extern "C" {
* call SDL_Quit() to force shutdown). If a subsystem is already loaded then * call SDL_Quit() to force shutdown). If a subsystem is already loaded then
* this call will increase the ref-count and return. * this call will increase the ref-count and return.
* *
* \param flags subsystem initialization flags. * \param flags subsystem initialization flags
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -61,8 +61,6 @@ assert can have unique static variables associated with it.
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #22\n\t" )
#elif defined(__APPLE__) && defined(__arm__) #elif defined(__APPLE__) && defined(__arm__)
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "bkpt #22\n\t" )
#elif defined(_WIN32) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__arm64__) || defined(__aarch64__)) )
#define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "brk #0xF000\n\t" )
#elif defined(__386__) && defined(__WATCOMC__) #elif defined(__386__) && defined(__WATCOMC__)
#define SDL_TriggerBreakpoint() { _asm { int 0x03 } } #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__) #elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
@@ -153,7 +151,7 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
#define SDL_enabled_assert(condition) \ #define SDL_enabled_assert(condition) \
do { \ do { \
while ( !(condition) ) { \ while ( !(condition) ) { \
static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, NULL, 0, NULL, NULL }; \ static struct SDL_AssertData sdl_assert_data = { 0, 0, #condition, 0, 0, 0, 0 }; \
const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \ const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
if (sdl_assert_state == SDL_ASSERTION_RETRY) { \ if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
continue; /* go again. */ \ continue; /* go again. */ \
@@ -193,8 +191,8 @@ extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
* A callback that fires when an SDL assertion fails. * A callback that fires when an SDL assertion fails.
* *
* \param data a pointer to the SDL_AssertData structure corresponding to the * \param data a pointer to the SDL_AssertData structure corresponding to the
* current assertion. * current assertion
* \param userdata what was passed as `userdata` to SDL_SetAssertionHandler(). * \param userdata what was passed as `userdata` to SDL_SetAssertionHandler()
* \returns an SDL_AssertState value indicating how to handle the failure. * \returns an SDL_AssertState value indicating how to handle the failure.
*/ */
typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
@@ -214,8 +212,8 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
* This callback is NOT reset to SDL's internal handler upon SDL_Quit()! * This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
* *
* \param handler the SDL_AssertionHandler function to call when an assertion * \param handler the SDL_AssertionHandler function to call when an assertion
* fails or NULL for the default handler. * fails or NULL for the default handler
* \param userdata a pointer that is passed to `handler`. * \param userdata a pointer that is passed to `handler`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -256,7 +254,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetDefaultAssertionHandler(void
* data, it is safe to pass a NULL pointer to this function to ignore it. * data, it is safe to pass a NULL pointer to this function to ignore it.
* *
* \param puserdata pointer which is filled with the "userdata" pointer that * \param puserdata pointer which is filled with the "userdata" pointer that
* was passed to SDL_SetAssertionHandler(). * was passed to SDL_SetAssertionHandler()
* \returns the SDL_AssertionHandler that is called when an assert triggers. * \returns the SDL_AssertionHandler that is called when an assert triggers.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,29 +20,38 @@
*/ */
/** /**
* # CategoryAtomic * \file SDL_atomic.h
* *
* Atomic operations. * Atomic operations.
* *
* IMPORTANT: If you are not an expert in concurrent lockless programming, you * IMPORTANT:
* should not be using any functions in this file. You should be protecting * If you are not an expert in concurrent lockless programming, you should
* your data structures with full mutexes instead. * only be using the atomic lock and reference counting functions in this
* file. In all other cases you should be protecting your data structures
* with full mutexes.
* *
* ***Seriously, here be dragons!*** * The list of "safe" functions to use are:
* SDL_AtomicLock()
* SDL_AtomicUnlock()
* SDL_AtomicIncRef()
* SDL_AtomicDecRef()
* *
* You can find out a little more about lockless programming and the subtle * Seriously, here be dragons!
* issues that can arise here: * ^^^^^^^^^^^^^^^^^^^^^^^^^^^
* https://learn.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming *
* You can find out a little more about lockless programming and the
* subtle issues that can arise here:
* http://msdn.microsoft.com/en-us/library/ee418650%28v=vs.85%29.aspx
* *
* There's also lots of good information here: * There's also lots of good information here:
* http://www.1024cores.net/home/lock-free-algorithms
* http://preshing.com/
* *
* - https://www.1024cores.net/home/lock-free-algorithms * These operations may or may not actually be implemented using
* - https://preshing.com/ * processor specific atomic operations. When possible they are
* * implemented as true processor specific atomic operations. When that
* These operations may or may not actually be implemented using processor * is not possible the are implemented using locks that *do* use the
* specific atomic operations. When possible they are implemented as true * available atomic operations.
* processor specific atomic operations. When that is not possible the are
* implemented using locks that *do* use the available atomic operations.
* *
* All of the atomic operations that modify memory are full memory barriers. * All of the atomic operations that modify memory are full memory barriers.
*/ */
@@ -85,7 +94,7 @@ typedef int SDL_SpinLock;
* ***Please note that spinlocks are dangerous if you don't know what you're * ***Please note that spinlocks are dangerous if you don't know what you're
* doing. Please be careful using any sort of spinlock!*** * doing. Please be careful using any sort of spinlock!***
* *
* \param lock a pointer to a lock variable. * \param lock a pointer to a lock variable
* \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already * \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already
* held. * held.
* *
@@ -102,7 +111,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTryLock(SDL_SpinLock *lock);
* ***Please note that spinlocks are dangerous if you don't know what you're * ***Please note that spinlocks are dangerous if you don't know what you're
* doing. Please be careful using any sort of spinlock!*** * doing. Please be careful using any sort of spinlock!***
* *
* \param lock a pointer to a lock variable. * \param lock a pointer to a lock variable
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -119,7 +128,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicLock(SDL_SpinLock *lock);
* ***Please note that spinlocks are dangerous if you don't know what you're * ***Please note that spinlocks are dangerous if you don't know what you're
* doing. Please be careful using any sort of spinlock!*** * doing. Please be careful using any sort of spinlock!***
* *
* \param lock a pointer to a lock variable. * \param lock a pointer to a lock variable
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -200,7 +209,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__) #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__)
#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory")
#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory")
#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) #elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__)
#ifdef __thumb__ #ifdef __thumb__
/* The mcr instruction isn't available in thumb mode, use real functions */ /* The mcr instruction isn't available in thumb mode, use real functions */
#define SDL_MEMORY_BARRIER_USES_FUNCTION #define SDL_MEMORY_BARRIER_USES_FUNCTION
@@ -248,13 +257,10 @@ typedef void (*SDL_KernelMemoryBarrierFunc)();
/** /**
* A type representing an atomic integer value. * \brief A type representing an atomic integer value. It is a struct
* * so people don't accidentally use numeric operations on it.
* It is a struct so people don't accidentally use numeric operations on it.
*/ */
typedef struct SDL_atomic_t { typedef struct { int value; } SDL_atomic_t;
int value;
} SDL_atomic_t;
/** /**
* Set an atomic variable to a new value if it is currently an old value. * Set an atomic variable to a new value if it is currently an old value.
@@ -262,9 +268,9 @@ typedef struct SDL_atomic_t {
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to an SDL_atomic_t variable to be modified. * \param a a pointer to an SDL_atomic_t variable to be modified
* \param oldval the old value. * \param oldval the old value
* \param newval the new value. * \param newval the new value
* \returns SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise. * \returns SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -283,8 +289,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to an SDL_atomic_t variable to be modified. * \param a a pointer to an SDL_atomic_t variable to be modified
* \param v the desired value. * \param v the desired value
* \returns the previous value of the atomic variable. * \returns the previous value of the atomic variable.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.
@@ -299,7 +305,7 @@ extern DECLSPEC int SDLCALL SDL_AtomicSet(SDL_atomic_t *a, int v);
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to an SDL_atomic_t variable. * \param a a pointer to an SDL_atomic_t variable
* \returns the current value of an atomic variable. * \returns the current value of an atomic variable.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.
@@ -316,8 +322,8 @@ extern DECLSPEC int SDLCALL SDL_AtomicGet(SDL_atomic_t *a);
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to an SDL_atomic_t variable to be modified. * \param a a pointer to an SDL_atomic_t variable to be modified
* \param v the desired value to add. * \param v the desired value to add
* \returns the previous value of the atomic variable. * \returns the previous value of the atomic variable.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.
@@ -350,9 +356,9 @@ extern DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_atomic_t *a, int v);
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to a pointer. * \param a a pointer to a pointer
* \param oldval the old pointer value. * \param oldval the old pointer value
* \param newval the new pointer value. * \param newval the new pointer value
* \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise. * \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -369,8 +375,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCASPtr(void **a, void *oldval, void *
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to a pointer. * \param a a pointer to a pointer
* \param v the desired pointer value. * \param v the desired pointer value
* \returns the previous value of the pointer. * \returns the previous value of the pointer.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.
@@ -386,7 +392,7 @@ extern DECLSPEC void* SDLCALL SDL_AtomicSetPtr(void **a, void* v);
* ***Note: If you don't know what this function is for, you shouldn't use * ***Note: If you don't know what this function is for, you shouldn't use
* it!*** * it!***
* *
* \param a a pointer to a pointer. * \param a a pointer to a pointer
* \returns the current value of a pointer. * \returns the current value of a pointer.
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -22,9 +22,9 @@
/* !!! FIXME: several functions in here need Doxygen comments. */ /* !!! FIXME: several functions in here need Doxygen comments. */
/** /**
* # CategoryAudio * \file SDL_audio.h
* *
* Access to the raw audio mixing buffer for the SDL library. * Access to the raw audio mixing buffer for the SDL library.
*/ */
#ifndef SDL_audio_h_ #ifndef SDL_audio_h_
@@ -44,24 +44,24 @@ extern "C" {
#endif #endif
/** /**
* Audio format flags. * \brief Audio format flags.
* *
* These are what the 16 bits in SDL_AudioFormat currently mean... * These are what the 16 bits in SDL_AudioFormat currently mean...
* (Unspecified bits are always zero). * (Unspecified bits are always zero).
* *
* ``` * \verbatim
* ++-----------------------sample is signed if set ++-----------------------sample is signed if set
* || ||
* || ++-----------sample is bigendian if set || ++-----------sample is bigendian if set
* || || || ||
* || || ++---sample is float if set || || ++---sample is float if set
* || || || || || ||
* || || || +---sample bit size---+ || || || +---sample bit size---+
* || || || | | || || || | |
* 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
* ``` \endverbatim
* *
* There are macros in SDL 2.0 and later to query these bits. * There are macros in SDL 2.0 and later to query these bits.
*/ */
typedef Uint16 SDL_AudioFormat; typedef Uint16 SDL_AudioFormat;
@@ -149,30 +149,33 @@ typedef Uint16 SDL_AudioFormat;
/* @} *//* Audio flags */ /* @} *//* Audio flags */
/** /**
* This function is called when the audio device needs more data. * This function is called when the audio device needs more data.
* *
* \param userdata An application-specific parameter saved in the * \param userdata An application-specific parameter saved in
* SDL_AudioSpec structure. * the SDL_AudioSpec structure
* \param stream A pointer to the audio data buffer. * \param stream A pointer to the audio data buffer.
* \param len Length of **stream** in bytes. * \param len The length of that buffer in bytes.
*
* Once the callback returns, the buffer will no longer be valid.
* Stereo samples are stored in a LRLRLR ordering.
*
* You can choose to avoid callbacks and use SDL_QueueAudio() instead, if
* you like. Just open your audio device with a NULL callback.
*/ */
typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream,
int len); int len);
/** /**
* The calculated values in this structure are calculated by SDL_OpenAudio(). * The calculated values in this structure are calculated by SDL_OpenAudio().
* *
* For multi-channel audio, the default SDL channel mapping is: * For multi-channel audio, the default SDL channel mapping is:
* * 2: FL FR (stereo)
* ``` * 3: FL FR LFE (2.1 surround)
* 2: FL FR (stereo) * 4: FL FR BL BR (quad)
* 3: FL FR LFE (2.1 surround) * 5: FL FR LFE BL BR (4.1 surround)
* 4: FL FR BL BR (quad) * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR)
* 5: FL FR LFE BL BR (4.1 surround) * 7: FL FR FC LFE BC SL SR (6.1 surround)
* 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) * 8: FL FR FC LFE BL BR SL SR (7.1 surround)
* 7: FL FR FC LFE BC SL SR (6.1 surround)
* 8: FL FR FC LFE BL BR SL SR (7.1 surround)
* ```
*/ */
typedef struct SDL_AudioSpec typedef struct SDL_AudioSpec
{ {
@@ -193,11 +196,11 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt,
SDL_AudioFormat format); SDL_AudioFormat format);
/** /**
* Upper limit of filters in SDL_AudioCVT * \brief Upper limit of filters in SDL_AudioCVT
* *
* The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is
* currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, one * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers,
* of which is the terminating NULL pointer. * one of which is the terminating NULL pointer.
*/ */
#define SDL_AUDIOCVT_MAX_FILTERS 9 #define SDL_AUDIOCVT_MAX_FILTERS 9
@@ -284,7 +287,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDrivers(void);
* meant to be proper names. * meant to be proper names.
* *
* \param index the index of the audio driver; the value ranges from 0 to * \param index the index of the audio driver; the value ranges from 0 to
* SDL_GetNumAudioDrivers() - 1. * SDL_GetNumAudioDrivers() - 1
* \returns the name of the audio driver at the requested index, or NULL if an * \returns the name of the audio driver at the requested index, or NULL if an
* invalid index was specified. * invalid index was specified.
* *
@@ -311,7 +314,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDriver(int index);
* specific need to designate the audio driver you want to use. You should * specific need to designate the audio driver you want to use. You should
* normally use SDL_Init() or SDL_InitSubSystem(). * normally use SDL_Init() or SDL_InitSubSystem().
* *
* \param driver_name the name of the desired audio driver. * \param driver_name the name of the desired audio driver
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -405,13 +408,13 @@ extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec * desired,
SDL_AudioSpec * obtained); SDL_AudioSpec * obtained);
/** /**
* SDL Audio Device IDs. * SDL Audio Device IDs.
* *
* A successful call to SDL_OpenAudio() is always device id 1, and legacy SDL * A successful call to SDL_OpenAudio() is always device id 1, and legacy
* audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls * SDL audio APIs assume you want this device ID. SDL_OpenAudioDevice() calls
* always returns devices >= 2 on success. The legacy calls are good both for * always returns devices >= 2 on success. The legacy calls are good both
* backwards compatibility and when you don't care about multiple, specific, * for backwards compatibility and when you don't care about multiple,
* or capture devices. * specific, or capture devices.
*/ */
typedef Uint32 SDL_AudioDeviceID; typedef Uint32 SDL_AudioDeviceID;
@@ -449,7 +452,7 @@ typedef Uint32 SDL_AudioDeviceID;
* ``` * ```
* *
* \param iscapture zero to request playback devices, non-zero to request * \param iscapture zero to request playback devices, non-zero to request
* recording devices. * recording devices
* \returns the number of available devices exposed by the current driver or * \returns the number of available devices exposed by the current driver or
* -1 if an explicit list of devices can't be determined. A return * -1 if an explicit list of devices can't be determined. A return
* value of -1 does not necessarily mean an error condition. * value of -1 does not necessarily mean an error condition.
@@ -475,7 +478,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumAudioDevices(int iscapture);
* invalid next time any of several other SDL functions are called. * invalid next time any of several other SDL functions are called.
* *
* \param index the index of the audio device; valid values range from 0 to * \param index the index of the audio device; valid values range from 0 to
* SDL_GetNumAudioDevices() - 1. * SDL_GetNumAudioDevices() - 1
* \param iscapture non-zero to query the list of recording devices, zero to * \param iscapture non-zero to query the list of recording devices, zero to
* query the list of output devices. * query the list of output devices.
* \returns the name of the audio device at the requested index, or NULL on * \returns the name of the audio device at the requested index, or NULL on
@@ -501,11 +504,11 @@ extern DECLSPEC const char *SDLCALL SDL_GetAudioDeviceName(int index,
* count. * count.
* *
* \param index the index of the audio device; valid values range from 0 to * \param index the index of the audio device; valid values range from 0 to
* SDL_GetNumAudioDevices() - 1. * SDL_GetNumAudioDevices() - 1
* \param iscapture non-zero to query the list of recording devices, zero to * \param iscapture non-zero to query the list of recording devices, zero to
* query the list of output devices. * query the list of output devices.
* \param spec The SDL_AudioSpec to be initialized by this function. * \param spec The SDL_AudioSpec to be initialized by this function.
* \returns 0 on success, nonzero on error. * \returns 0 on success, nonzero on error
* *
* \since This function is available since SDL 2.0.16. * \since This function is available since SDL 2.0.16.
* *
@@ -539,7 +542,7 @@ extern DECLSPEC int SDLCALL SDL_GetAudioDeviceSpec(int index,
* \param spec The SDL_AudioSpec to be initialized by this function. * \param spec The SDL_AudioSpec to be initialized by this function.
* \param iscapture non-zero to query the default recording device, zero to * \param iscapture non-zero to query the default recording device, zero to
* query the default output device. * query the default output device.
* \returns 0 on success, nonzero on error. * \returns 0 on success, nonzero on error
* *
* \since This function is available since SDL 2.24.0. * \since This function is available since SDL 2.24.0.
* *
@@ -591,7 +594,7 @@ extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name,
* frames_ (with stereo output, two samples--left and right--would make a * frames_ (with stereo output, two samples--left and right--would make a
* single sample frame). This number should be a power of two, and may be * single sample frame). This number should be a power of two, and may be
* adjusted by the audio driver to a value more suitable for the hardware. * adjusted by the audio driver to a value more suitable for the hardware.
* Good values seem to range between 512 and 4096 inclusive, depending on * Good values seem to range between 512 and 8096 inclusive, depending on
* the application and CPU speed. Smaller values reduce latency, but can * the application and CPU speed. Smaller values reduce latency, but can
* lead to underflow if the application is doing heavy processing and cannot * lead to underflow if the application is doing heavy processing and cannot
* fill the audio buffer in time. Note that the number of sample frames is * fill the audio buffer in time. Note that the number of sample frames is
@@ -642,12 +645,12 @@ extern DECLSPEC int SDLCALL SDL_GetDefaultAudioInfo(char **name,
* driver-specific name as appropriate. NULL requests the most * driver-specific name as appropriate. NULL requests the most
* reasonable default device. * reasonable default device.
* \param iscapture non-zero to specify a device should be opened for * \param iscapture non-zero to specify a device should be opened for
* recording, not playback. * recording, not playback
* \param desired an SDL_AudioSpec structure representing the desired output * \param desired an SDL_AudioSpec structure representing the desired output
* format; see SDL_OpenAudio() for more information. * format; see SDL_OpenAudio() for more information
* \param obtained an SDL_AudioSpec structure filled in with the actual output * \param obtained an SDL_AudioSpec structure filled in with the actual output
* format; see SDL_OpenAudio() for more information. * format; see SDL_OpenAudio() for more information
* \param allowed_changes 0, or one or more flags OR'd together. * \param allowed_changes 0, or one or more flags OR'd together
* \returns a valid device ID that is > 0 on success or 0 on failure; call * \returns a valid device ID that is > 0 on success or 0 on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -709,7 +712,7 @@ extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioStatus(void);
* Use this function to get the current audio state of an audio device. * Use this function to get the current audio state of an audio device.
* *
* \param dev the ID of an audio device previously opened with * \param dev the ID of an audio device previously opened with
* SDL_OpenAudioDevice(). * SDL_OpenAudioDevice()
* \returns the SDL_AudioStatus of the specified audio device. * \returns the SDL_AudioStatus of the specified audio device.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -742,7 +745,7 @@ extern DECLSPEC SDL_AudioStatus SDLCALL SDL_GetAudioDeviceStatus(SDL_AudioDevice
* *
* ...and is only useful if you used the legacy SDL_OpenAudio() function. * ...and is only useful if you used the legacy SDL_OpenAudio() function.
* *
* \param pause_on non-zero to pause, 0 to unpause. * \param pause_on non-zero to pause, 0 to unpause
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -772,8 +775,8 @@ extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
* callback, you shouldn't pause the audio device, as it will lead to dropouts * callback, you shouldn't pause the audio device, as it will lead to dropouts
* in the audio playback. Instead, you should use SDL_LockAudioDevice(). * in the audio playback. Instead, you should use SDL_LockAudioDevice().
* *
* \param dev a device opened by SDL_OpenAudioDevice(). * \param dev a device opened by SDL_OpenAudioDevice()
* \param pause_on non-zero to pause, 0 to unpause. * \param pause_on non-zero to pause, 0 to unpause
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -838,14 +841,14 @@ extern DECLSPEC void SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev,
* SDL_LoadWAV("sample.wav", &spec, &buf, &len); * SDL_LoadWAV("sample.wav", &spec, &buf, &len);
* ``` * ```
* *
* \param src The data source for the WAVE data. * \param src The data source for the WAVE data
* \param freesrc If non-zero, SDL will _always_ free the data source. * \param freesrc If non-zero, SDL will _always_ free the data source
* \param spec An SDL_AudioSpec that will be filled in with the wave file's * \param spec An SDL_AudioSpec that will be filled in with the wave file's
* format details. * format details
* \param audio_buf A pointer filled with the audio data, allocated by the * \param audio_buf A pointer filled with the audio data, allocated by the
* function. * function.
* \param audio_len A pointer filled with the length of the audio data buffer * \param audio_len A pointer filled with the length of the audio data buffer
* in bytes. * in bytes
* \returns This function, if successfully called, returns `spec`, which will * \returns This function, if successfully called, returns `spec`, which will
* be filled with the audio data format of the wave source data. * be filled with the audio data format of the wave source data.
* `audio_buf` will be filled with a pointer to an allocated buffer * `audio_buf` will be filled with a pointer to an allocated buffer
@@ -871,9 +874,8 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
Uint32 * audio_len); Uint32 * audio_len);
/** /**
* Loads a WAV from a file. * Loads a WAV from a file.
* * Compatibility convenience function.
* Compatibility convenience function.
*/ */
#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ #define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
@@ -886,7 +888,7 @@ extern DECLSPEC SDL_AudioSpec *SDLCALL SDL_LoadWAV_RW(SDL_RWops * src,
* this function with a NULL pointer. * this function with a NULL pointer.
* *
* \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or * \param audio_buf a pointer to the buffer created by SDL_LoadWAV() or
* SDL_LoadWAV_RW(). * SDL_LoadWAV_RW()
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -910,16 +912,15 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf);
* and then can call SDL_ConvertAudio() to complete the conversion. * and then can call SDL_ConvertAudio() to complete the conversion.
* *
* \param cvt an SDL_AudioCVT structure filled in with audio conversion * \param cvt an SDL_AudioCVT structure filled in with audio conversion
* information. * information
* \param src_format the source format of the audio data; for more info see * \param src_format the source format of the audio data; for more info see
* SDL_AudioFormat. * SDL_AudioFormat
* \param src_channels the number of channels in the source. * \param src_channels the number of channels in the source
* \param src_rate the frequency (sample-frames-per-second) of the source. * \param src_rate the frequency (sample-frames-per-second) of the source
* \param dst_format the destination format of the audio data; for more info * \param dst_format the destination format of the audio data; for more info
* see SDL_AudioFormat. * see SDL_AudioFormat
* \param dst_channels the number of channels in the destination. * \param dst_channels the number of channels in the destination
* \param dst_rate the frequency (sample-frames-per-second) of the * \param dst_rate the frequency (sample-frames-per-second) of the destination
* destination.
* \returns 1 if the audio filter is prepared, 0 if no conversion is needed, * \returns 1 if the audio filter is prepared, 0 if no conversion is needed,
* or a negative error code on failure; call SDL_GetError() for more * or a negative error code on failure; call SDL_GetError() for more
* information. * information.
@@ -990,12 +991,12 @@ typedef struct _SDL_AudioStream SDL_AudioStream;
/** /**
* Create a new audio stream. * Create a new audio stream.
* *
* \param src_format The format of the source audio. * \param src_format The format of the source audio
* \param src_channels The number of channels of the source audio. * \param src_channels The number of channels of the source audio
* \param src_rate The sampling rate of the source audio. * \param src_rate The sampling rate of the source audio
* \param dst_format The format of the desired audio output. * \param dst_format The format of the desired audio output
* \param dst_channels The number of channels of the desired audio output. * \param dst_channels The number of channels of the desired audio output
* \param dst_rate The sampling rate of the desired audio output. * \param dst_rate The sampling rate of the desired audio output
* \returns 0 on success, or -1 on error. * \returns 0 on success, or -1 on error.
* *
* \since This function is available since SDL 2.0.7. * \since This function is available since SDL 2.0.7.
@@ -1017,9 +1018,9 @@ extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioForm
/** /**
* Add data to be converted/resampled to the stream. * Add data to be converted/resampled to the stream.
* *
* \param stream The stream the audio data is being added to. * \param stream The stream the audio data is being added to
* \param buf A pointer to the audio data to add. * \param buf A pointer to the audio data to add
* \param len The number of bytes to write to the stream. * \param len The number of bytes to write to the stream
* \returns 0 on success, or -1 on error. * \returns 0 on success, or -1 on error.
* *
* \since This function is available since SDL 2.0.7. * \since This function is available since SDL 2.0.7.
@@ -1036,10 +1037,10 @@ extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const vo
/** /**
* Get converted/resampled data from the stream * Get converted/resampled data from the stream
* *
* \param stream The stream the audio is being requested from. * \param stream The stream the audio is being requested from
* \param buf A buffer to fill with audio data. * \param buf A buffer to fill with audio data
* \param len The maximum number of bytes to fill. * \param len The maximum number of bytes to fill
* \returns the number of bytes read from the stream, or -1 on error. * \returns the number of bytes read from the stream, or -1 on error
* *
* \since This function is available since SDL 2.0.7. * \since This function is available since SDL 2.0.7.
* *
@@ -1117,9 +1118,6 @@ extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream);
*/ */
extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream); extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
/**
* Maximum volume allowed in calls to SDL_MixAudio and SDL_MixAudioFormat.
*/
#define SDL_MIX_MAXVOLUME 128 #define SDL_MIX_MAXVOLUME 128
/** /**
@@ -1134,11 +1132,11 @@ extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream);
* ...where `format` is the obtained format of the audio device from the * ...where `format` is the obtained format of the audio device from the
* legacy SDL_OpenAudio() function. * legacy SDL_OpenAudio() function.
* *
* \param dst the destination for the mixed audio. * \param dst the destination for the mixed audio
* \param src the source audio buffer to be mixed. * \param src the source audio buffer to be mixed
* \param len the length of the audio buffer in bytes. * \param len the length of the audio buffer in bytes
* \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
* for full audio volume. * for full audio volume
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1167,13 +1165,13 @@ extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 * dst, const Uint8 * src,
* SDL_MixAudioFormat() is really only needed when you're mixing a single * SDL_MixAudioFormat() is really only needed when you're mixing a single
* audio stream with a volume adjustment. * audio stream with a volume adjustment.
* *
* \param dst the destination for the mixed audio. * \param dst the destination for the mixed audio
* \param src the source audio buffer to be mixed. * \param src the source audio buffer to be mixed
* \param format the SDL_AudioFormat structure representing the desired audio * \param format the SDL_AudioFormat structure representing the desired audio
* format. * format
* \param len the length of the audio buffer in bytes. * \param len the length of the audio buffer in bytes
* \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME * \param volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
* for full audio volume. * for full audio volume
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
@@ -1217,9 +1215,9 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst,
* from planar audio formats into a non-planar one (see SDL_AudioFormat) * from planar audio formats into a non-planar one (see SDL_AudioFormat)
* before queuing audio. * before queuing audio.
* *
* \param dev the device ID to which we will queue audio. * \param dev the device ID to which we will queue audio
* \param data the data to queue to the device for later playback. * \param data the data to queue to the device for later playback
* \param len the number of bytes (not samples!) to which `data` points. * \param len the number of bytes (not samples!) to which `data` points
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1265,9 +1263,9 @@ extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *da
* You should not call SDL_LockAudio() on the device before dequeueing; SDL * You should not call SDL_LockAudio() on the device before dequeueing; SDL
* handles locking internally for this function. * handles locking internally for this function.
* *
* \param dev the device ID from which we will dequeue audio. * \param dev the device ID from which we will dequeue audio
* \param data a pointer into where audio data should be copied. * \param data a pointer into where audio data should be copied
* \param len the number of bytes (not samples!) to which (data) points. * \param len the number of bytes (not samples!) to which (data) points
* \returns the number of bytes dequeued, which could be less than requested; * \returns the number of bytes dequeued, which could be less than requested;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -1301,7 +1299,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *dat
* You should not call SDL_LockAudio() on the device before querying; SDL * You should not call SDL_LockAudio() on the device before querying; SDL
* handles locking internally for this function. * handles locking internally for this function.
* *
* \param dev the device ID of which we will query queued audio size. * \param dev the device ID of which we will query queued audio size
* \returns the number of bytes (not samples!) of queued audio. * \returns the number of bytes (not samples!) of queued audio.
* *
* \since This function is available since SDL 2.0.4. * \since This function is available since SDL 2.0.4.
@@ -1336,7 +1334,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev);
* *
* This function always succeeds and thus returns void. * This function always succeeds and thus returns void.
* *
* \param dev the device ID of which to clear the audio queue. * \param dev the device ID of which to clear the audio queue
* *
* \since This function is available since SDL 2.0.4. * \since This function is available since SDL 2.0.4.
* *
@@ -1408,7 +1406,7 @@ extern DECLSPEC void SDLCALL SDL_LockAudio(void);
* at once, not only will you block the audio callback, you'll block the other * at once, not only will you block the audio callback, you'll block the other
* thread. * thread.
* *
* \param dev the ID of the device to be locked. * \param dev the ID of the device to be locked
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1441,7 +1439,7 @@ extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
* *
* This function should be paired with a previous SDL_LockAudioDevice() call. * This function should be paired with a previous SDL_LockAudioDevice() call.
* *
* \param dev the ID of the device to be unlocked. * \param dev the ID of the device to be unlocked
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1483,7 +1481,7 @@ extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
* The device ID is invalid as soon as the device is closed, and is eligible * The device ID is invalid as soon as the device is closed, and is eligible
* for reuse in a new SDL_OpenAudioDevice() call immediately. * for reuse in a new SDL_OpenAudioDevice() call immediately.
* *
* \param dev an audio device previously opened with SDL_OpenAudioDevice(). * \param dev an audio device previously opened with SDL_OpenAudioDevice()
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryBits * \file SDL_bits.h
* *
* Functions for fiddling with bits and bitmasks. * Functions for fiddling with bits and bitmasks.
*/ */
#ifndef SDL_bits_h_ #ifndef SDL_bits_h_
@@ -56,12 +56,6 @@ extern __inline int _SDL_bsr_watcom(Uint32);
modify exact [eax] nomemory; modify exact [eax] nomemory;
#endif #endif
/**
* Use this function to get the index of the most significant (set) bit in a
*
* \param x the number to find the MSB of.
* \returns the index of the most significant bit of x, or -1 if x is 0.
*/
SDL_FORCE_INLINE int SDL_FORCE_INLINE int
SDL_MostSignificantBitIndex32(Uint32 x) SDL_MostSignificantBitIndex32(Uint32 x)
{ {
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryBlendmode * \file SDL_blendmode.h
* *
* Header file declaring the SDL_BlendMode enumeration * Header file declaring the SDL_BlendMode enumeration
*/ */
#ifndef SDL_blendmode_h_ #ifndef SDL_blendmode_h_
@@ -35,9 +35,9 @@ extern "C" {
#endif #endif
/** /**
* The blend mode used in SDL_RenderCopy() and drawing operations. * \brief The blend mode used in SDL_RenderCopy() and drawing operations.
*/ */
typedef enum SDL_BlendMode typedef enum
{ {
SDL_BLENDMODE_NONE = 0x00000000, /**< no blending SDL_BLENDMODE_NONE = 0x00000000, /**< no blending
dstRGBA = srcRGBA */ dstRGBA = srcRGBA */
@@ -60,22 +60,21 @@ typedef enum SDL_BlendMode
} SDL_BlendMode; } SDL_BlendMode;
/** /**
* The blend operation used when combining source and destination pixel * \brief The blend operation used when combining source and destination pixel components
* components
*/ */
typedef enum SDL_BlendOperation typedef enum
{ {
SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */
SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */
SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */
SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */ SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */
SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */ SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */
} SDL_BlendOperation; } SDL_BlendOperation;
/** /**
* The normalized factor used to multiply pixel components * \brief The normalized factor used to multiply pixel components
*/ */
typedef enum SDL_BlendFactor typedef enum
{ {
SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */ SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */
SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */ SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */
@@ -159,18 +158,18 @@ typedef enum SDL_BlendFactor
* case. * case.
* *
* \param srcColorFactor the SDL_BlendFactor applied to the red, green, and * \param srcColorFactor the SDL_BlendFactor applied to the red, green, and
* blue components of the source pixels. * blue components of the source pixels
* \param dstColorFactor the SDL_BlendFactor applied to the red, green, and * \param dstColorFactor the SDL_BlendFactor applied to the red, green, and
* blue components of the destination pixels. * blue components of the destination pixels
* \param colorOperation the SDL_BlendOperation used to combine the red, * \param colorOperation the SDL_BlendOperation used to combine the red,
* green, and blue components of the source and * green, and blue components of the source and
* destination pixels. * destination pixels
* \param srcAlphaFactor the SDL_BlendFactor applied to the alpha component of * \param srcAlphaFactor the SDL_BlendFactor applied to the alpha component of
* the source pixels. * the source pixels
* \param dstAlphaFactor the SDL_BlendFactor applied to the alpha component of * \param dstAlphaFactor the SDL_BlendFactor applied to the alpha component of
* the destination pixels. * the destination pixels
* \param alphaOperation the SDL_BlendOperation used to combine the alpha * \param alphaOperation the SDL_BlendOperation used to combine the alpha
* component of the source and destination pixels. * component of the source and destination pixels
* \returns an SDL_BlendMode that represents the chosen factors and * \returns an SDL_BlendMode that represents the chosen factors and
* operations. * operations.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,7 +20,7 @@
*/ */
/** /**
* # CategoryClipboard * \file SDL_clipboard.h
* *
* Include file for SDL clipboard handling * Include file for SDL clipboard handling
*/ */
@@ -41,7 +41,7 @@ extern "C" {
/** /**
* Put UTF-8 text into the clipboard. * Put UTF-8 text into the clipboard.
* *
* \param text the text to store in the clipboard. * \param text the text to store in the clipboard
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -85,7 +85,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void);
/** /**
* Put UTF-8 text into the primary selection. * Put UTF-8 text into the primary selection.
* *
* \param text the text to store in the primary selection. * \param text the text to store in the primary selection
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,41 +19,313 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
#ifndef SDL_config_h_ #ifndef SDL_config_windows_h_
#define SDL_config_windows_h_
#define SDL_config_h_ #define SDL_config_h_
#include "SDL_platform.h" #include "SDL_platform.h"
/* WIKI CATEGORY: - */ /* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK,
* but out of caution we'll only use it if the compiler supports __has_include() to confirm its presence.
/* Add any platform that doesn't build using the configure system. */ * If your compiler doesn't support __has_include() but you have winsdkver.h, define HAVE_WINSDKVER_H. */
#if defined(__WIN32__) #if !defined(HAVE_WINSDKVER_H) && defined(__has_include)
#include "SDL_config_windows.h" #if __has_include(<winsdkver.h>)
#elif defined(__WINRT__) #define HAVE_WINSDKVER_H 1
#include "SDL_config_winrt.h" #endif
#elif defined(__WINGDK__)
#include "SDL_config_wingdk.h"
#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
#include "SDL_config_xbox.h"
#elif defined(__MACOSX__)
#include "SDL_config_macosx.h"
#elif defined(__IPHONEOS__)
#include "SDL_config_iphoneos.h"
#elif defined(__ANDROID__)
#include "SDL_config_android.h"
#elif defined(__OS2__)
#include "SDL_config_os2.h"
#elif defined(__EMSCRIPTEN__)
#include "SDL_config_emscripten.h"
#elif defined(__NGAGE__)
#include "SDL_config_ngage.h"
#else
/* This is a minimal configuration just to get SDL running on new platforms. */
#include "SDL_config_minimal.h"
#endif /* platform config */
#ifdef USING_GENERATED_CONFIG_H
#error Wrong SDL_config.h, check your include path?
#endif #endif
#endif /* SDL_config_h_ */ #ifdef HAVE_WINSDKVER_H
#include <winsdkver.h>
#endif
/* sdkddkver.h defines more specific SDK version numbers. This is needed because older versions of the
* Windows 10 SDK have broken declarations for the C API for DirectX 12. */
#if !defined(HAVE_SDKDDKVER_H) && defined(__has_include)
#if __has_include(<sdkddkver.h>)
#define HAVE_SDKDDKVER_H 1
#endif
#endif
#ifdef HAVE_SDKDDKVER_H
#include <sdkddkver.h>
#endif
/* This is a set of defines to configure the SDL features */
#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_)
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#else
#define HAVE_STDINT_H 1
#endif /* Visual Studio 2008 */
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#ifdef _WIN64
# define SIZEOF_VOIDP 8
#else
# define SIZEOF_VOIDP 4
#endif
#ifdef __clang__
# define HAVE_GCC_ATOMICS 1
#endif
#define HAVE_DDRAW_H 1
#define HAVE_DINPUT_H 1
#define HAVE_DSOUND_H 1
#ifndef __WATCOMC__
#define HAVE_DXGI_H 1
#define HAVE_XINPUT_H 1
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */
#define HAVE_WINDOWS_GAMING_INPUT_H 1
#endif
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */
#define HAVE_D3D11_H 1
#define HAVE_ROAPI_H 1
#endif
#if defined(WDK_NTDDI_VERSION) && WDK_NTDDI_VERSION > 0x0A000008 /* 10.0.19041.0 */
#define HAVE_D3D12_H 1
#endif
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */
#define HAVE_SHELLSCALINGAPI_H 1
#endif
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
#define HAVE_TPCSHRD_H 1
#define HAVE_SENSORSAPI_H 1
#endif
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
#define HAVE_IMMINTRIN_H 1
#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))
# if __has_include(<immintrin.h>)
# define HAVE_IMMINTRIN_H 1
# endif
#endif
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
#ifdef HAVE_LIBC
/* Useful headers */
#define STDC_HEADERS 1
#define HAVE_CTYPE_H 1
#define HAVE_FLOAT_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
/* OpenWatcom requires specific calling conventions for qsort and bsearch */
#ifndef __WATCOMC__
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#endif
#define HAVE_ABS 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE__STRREV 1
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__STRUPR */
/* #undef HAVE__STRLWR */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_STRTOK_R */
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__LTOA */
/* #undef HAVE__ULTOA */
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE__STRICMP 1
#define HAVE__STRNICMP 1
#define HAVE__WCSICMP 1
#define HAVE__WCSNICMP 1
#define HAVE__WCSDUP 1
#define HAVE_ACOS 1
#define HAVE_ASIN 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
#define HAVE_CEIL 1
#define HAVE_COS 1
#define HAVE_EXP 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_FMOD 1
#define HAVE_LOG 1
#define HAVE_LOG10 1
#define HAVE_POW 1
#define HAVE_SIN 1
#define HAVE_SQRT 1
#define HAVE_TAN 1
#ifndef __WATCOMC__
#define HAVE_ACOSF 1
#define HAVE_ASINF 1
#define HAVE_ATANF 1
#define HAVE_ATAN2F 1
#define HAVE_CEILF 1
#define HAVE__COPYSIGN 1
#define HAVE_COSF 1
#define HAVE_EXPF 1
#define HAVE_FABSF 1
#define HAVE_FLOORF 1
#define HAVE_FMODF 1
#define HAVE_LOGF 1
#define HAVE_LOG10F 1
#define HAVE_POWF 1
#define HAVE_SINF 1
#define HAVE_SQRTF 1
#define HAVE_TANF 1
#endif
#if defined(_MSC_VER)
/* These functions were added with the VC++ 2013 C runtime library */
#if _MSC_VER >= 1800
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_VSSCANF 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#endif
/* This function is available with at least the VC++ 2008 C runtime library */
#if _MSC_VER >= 1400
#define HAVE__FSEEKI64 1
#endif
#ifdef _USE_MATH_DEFINES
#define HAVE_M_PI 1
#endif
#elif defined(__WATCOMC__)
#define HAVE__FSEEKI64 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_VSSCANF 1
#define HAVE_ROUND 1
#define HAVE_SCALBN 1
#define HAVE_TRUNC 1
#else
#define HAVE_M_PI 1
#endif
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#endif
/* Enable various audio drivers */
#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H)
#define SDL_AUDIO_DRIVER_WASAPI 1
#endif
#define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_AUDIO_DRIVER_WINMM 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
#define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_HIDAPI 1
#ifndef __WINRT__
#define SDL_JOYSTICK_RAWINPUT 1
#endif
#define SDL_JOYSTICK_VIRTUAL 1
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
#define SDL_JOYSTICK_WGI 1
#endif
#define SDL_JOYSTICK_XINPUT 1
#define SDL_HAPTIC_DINPUT 1
#define SDL_HAPTIC_XINPUT 1
/* Enable the sensor driver */
#ifdef HAVE_SENSORSAPI_H
#define SDL_SENSOR_WINDOWS 1
#else
#define SDL_SENSOR_DUMMY 1
#endif
/* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */
#define SDL_THREAD_GENERIC_COND_SUFFIX 1
#define SDL_THREAD_WINDOWS 1
/* Enable various timer systems */
#define SDL_TIMER_WINDOWS 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_WINDOWS 1
#ifndef SDL_VIDEO_RENDER_D3D
#define SDL_VIDEO_RENDER_D3D 1
#endif
#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H)
#define SDL_VIDEO_RENDER_D3D11 1
#endif
#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H)
#define SDL_VIDEO_RENDER_D3D12 1
#endif
/* Enable OpenGL support */
#ifndef SDL_VIDEO_OPENGL
#define SDL_VIDEO_OPENGL 1
#endif
#ifndef SDL_VIDEO_OPENGL_WGL
#define SDL_VIDEO_OPENGL_WGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL
#define SDL_VIDEO_RENDER_OGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL_ES2
#define SDL_VIDEO_RENDER_OGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_ES2
#define SDL_VIDEO_OPENGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_EGL
#define SDL_VIDEO_OPENGL_EGL 1
#endif
/* Enable Vulkan support */
#define SDL_VIDEO_VULKAN 1
/* Enable system power support */
#define SDL_POWER_WINDOWS 1
/* Enable filesystem support */
#define SDL_FILESYSTEM_WINDOWS 1
#endif /* SDL_config_windows_h_ */
/* vi: set ts=4 sw=4 expandtab: */
@@ -1,194 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_android_h_
#define SDL_config_android_h_
#define SDL_config_h_
#include "SDL_platform.h"
/**
* \file SDL_config_android.h
*
* This is a configuration that can be used to build SDL for Android
*/
#include <stdarg.h>
#define HAVE_GCC_ATOMICS 1
#define STDC_HEADERS 1
#define HAVE_ALLOCA_H 1
#define HAVE_CTYPE_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_TYPES_H 1
/* C library functions */
#define HAVE_DLOPEN 1
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_SETENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_STRCASESTR 1
#define HAVE_VSSCANF 1
#define HAVE_VSNPRINTF 1
#define HAVE_ACOS 1
#define HAVE_ACOSF 1
#define HAVE_ASIN 1
#define HAVE_ASINF 1
#define HAVE_ATAN 1
#define HAVE_ATANF 1
#define HAVE_ATAN2 1
#define HAVE_ATAN2F 1
#define HAVE_CEIL 1
#define HAVE_CEILF 1
#define HAVE_COPYSIGN 1
#define HAVE_COPYSIGNF 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_EXP 1
#define HAVE_EXPF 1
#define HAVE_FABS 1
#define HAVE_FABSF 1
#define HAVE_FLOOR 1
#define HAVE_FLOORF 1
#define HAVE_FMOD 1
#define HAVE_FMODF 1
#define HAVE_LOG 1
#define HAVE_LOGF 1
#define HAVE_LOG10 1
#define HAVE_LOG10F 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_POW 1
#define HAVE_POWF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
#define HAVE_SYSCONF 1
#define HAVE_CLOCK_GETTIME 1
#ifdef __LP64__
#define SIZEOF_VOIDP 8
#else
#define SIZEOF_VOIDP 4
#endif
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_ANDROID 1
#define SDL_AUDIO_DRIVER_OPENSLES 1
#define SDL_AUDIO_DRIVER_AAUDIO 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
#define SDL_JOYSTICK_ANDROID 1
#define SDL_JOYSTICK_HIDAPI 1
#define SDL_JOYSTICK_VIRTUAL 1
#define SDL_HAPTIC_ANDROID 1
/* Enable sensor driver */
#define SDL_SENSOR_ANDROID 1
/* Enable various shared object loading systems */
#define SDL_LOADSO_DLOPEN 1
/* Enable various threading systems */
#define SDL_THREAD_PTHREAD 1
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
/* Enable various timer systems */
#define SDL_TIMER_UNIX 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_ANDROID 1
/* Enable OpenGL ES */
#define SDL_VIDEO_OPENGL_ES 1
#define SDL_VIDEO_OPENGL_ES2 1
#define SDL_VIDEO_OPENGL_EGL 1
#define SDL_VIDEO_RENDER_OGL_ES 1
#define SDL_VIDEO_RENDER_OGL_ES2 1
/* Enable Vulkan support */
/* Android does not support Vulkan in native code using the "armeabi" ABI. */
#if defined(__ARM_ARCH) && __ARM_ARCH < 7
#define SDL_VIDEO_VULKAN 0
#else
#define SDL_VIDEO_VULKAN 1
#endif
/* Enable system power support */
#define SDL_POWER_ANDROID 1
/* Enable the filesystem driver */
#define SDL_FILESYSTEM_ANDROID 1
#endif /* SDL_config_android_h_ */
@@ -1,218 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef _SDL_config_emscripten_h_
#define _SDL_config_emscripten_h_
#include "SDL_platform.h"
/**
* \file SDL_config_emscripten.h
*
* This is a configuration that can be used to build SDL for Emscripten.
*/
#ifdef __LP64__
#define SIZEOF_VOIDP 8
#else
#define SIZEOF_VOIDP 4
#endif
#define HAVE_GCC_ATOMICS 1
/* Useful headers */
#define STDC_HEADERS 1
#define HAVE_ALLOCA_H 1
#define HAVE_CTYPE_H 1
#define HAVE_ICONV_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MATH_H 1
#define HAVE_MEMORY_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDARG_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_WCHAR_H 1
/* C library functions */
#define HAVE_DLOPEN 1
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_WCSLEN 1
#define HAVE_WCSDUP 1
#define HAVE_WCSSTR 1
#define HAVE_WCSCMP 1
#define HAVE_WCSNCMP 1
#define HAVE_WCSCASECMP 1
#define HAVE_WCSNCASECMP 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_VSSCANF 1
#define HAVE_VSNPRINTF 1
#define HAVE_M_PI 1
#define HAVE_ACOS 1
#define HAVE_ACOSF 1
#define HAVE_ASIN 1
#define HAVE_ASINF 1
#define HAVE_ATAN 1
#define HAVE_ATANF 1
#define HAVE_ATAN2 1
#define HAVE_ATAN2F 1
#define HAVE_CEIL 1
#define HAVE_CEILF 1
#define HAVE_COPYSIGN 1
#define HAVE_COPYSIGNF 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_EXP 1
#define HAVE_EXPF 1
#define HAVE_FABS 1
#define HAVE_FABSF 1
#define HAVE_FLOOR 1
#define HAVE_FLOORF 1
#define HAVE_FMOD 1
#define HAVE_FMODF 1
#define HAVE_LOG 1
#define HAVE_LOGF 1
#define HAVE_LOG10 1
#define HAVE_LOG10F 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_POW 1
#define HAVE_POWF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#define HAVE_FSEEKO 1
#define HAVE_FSEEKO64 1
#define HAVE_SIGACTION 1
#define HAVE_SA_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
#define HAVE_SYSCONF 1
#define HAVE_CLOCK_GETTIME 1
/* #undef HAVE_GETPAGESIZE */
#define HAVE_MPROTECT 1
#define HAVE_ICONV 1
/* SDL internal assertion support */
/* #undef SDL_DEFAULT_ASSERT_LEVEL */
#define SDL_CPUINFO_DISABLED 1
#define SDL_HAPTIC_DISABLED 1
#define SDL_HIDAPI_DISABLED 1
#ifndef __EMSCRIPTEN_PTHREADS__
#define SDL_THREADS_DISABLED 1
#endif
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
#define SDL_AUDIO_DRIVER_EMSCRIPTEN 1
/* Enable various input drivers */
#define SDL_JOYSTICK_EMSCRIPTEN 1
/* Enable various sensor drivers */
#define SDL_SENSOR_DUMMY 1
/* Enable various shared object loading systems */
#define SDL_LOADSO_DLOPEN 1
/* Enable various threading systems */
#ifdef __EMSCRIPTEN_PTHREADS__
#define SDL_THREAD_PTHREAD 1
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
#endif
/* Enable various timer systems */
#define SDL_TIMER_UNIX 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_EMSCRIPTEN 1
#define SDL_VIDEO_RENDER_OGL_ES2 1
/* Enable OpenGL support */
/* #undef SDL_VIDEO_OPENGL */
/* #undef SDL_VIDEO_OPENGL_ES */
#define SDL_VIDEO_OPENGL_ES2 1
/* #undef SDL_VIDEO_OPENGL_BGL */
/* #undef SDL_VIDEO_OPENGL_CGL */
/* #undef SDL_VIDEO_OPENGL_GLX */
/* #undef SDL_VIDEO_OPENGL_WGL */
#define SDL_VIDEO_OPENGL_EGL 1
/* #undef SDL_VIDEO_OPENGL_OSMESA */
/* #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC */
/* Enable system power support */
#define SDL_POWER_EMSCRIPTEN 1
/* Enable system filesystem support */
#define SDL_FILESYSTEM_EMSCRIPTEN 1
#endif /* _SDL_config_emscripten_h_ */
@@ -1,217 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_iphoneos_h_
#define SDL_config_iphoneos_h_
#define SDL_config_h_
#include "SDL_platform.h"
#ifdef __LP64__
#define SIZEOF_VOIDP 8
#else
#define SIZEOF_VOIDP 4
#endif
#define HAVE_GCC_ATOMICS 1
#define STDC_HEADERS 1
#define HAVE_ALLOCA_H 1
#define HAVE_CTYPE_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_TYPES_H 1
/* The libunwind functions are only available on x86 */
/* #undef HAVE_LIBUNWIND_H */
/* C library functions */
#define HAVE_DLOPEN 1
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_SETENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_STRCASESTR 1
#define HAVE_VSSCANF 1
#define HAVE_VSNPRINTF 1
#define HAVE_M_PI 1
#define HAVE_ACOS 1
#define HAVE_ACOSF 1
#define HAVE_ASIN 1
#define HAVE_ASINF 1
#define HAVE_ATAN 1
#define HAVE_ATANF 1
#define HAVE_ATAN2 1
#define HAVE_ATAN2F 1
#define HAVE_CEIL 1
#define HAVE_CEILF 1
#define HAVE_COPYSIGN 1
#define HAVE_COPYSIGNF 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_EXP 1
#define HAVE_EXPF 1
#define HAVE_FABS 1
#define HAVE_FABSF 1
#define HAVE_FLOOR 1
#define HAVE_FLOORF 1
#define HAVE_FMOD 1
#define HAVE_FMODF 1
#define HAVE_LOG 1
#define HAVE_LOGF 1
#define HAVE_LOG10 1
#define HAVE_LOG10F 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_POW 1
#define HAVE_POWF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
#define HAVE_SYSCONF 1
#define HAVE_SYSCTLBYNAME 1
#define HAVE_O_CLOEXEC 1
/* enable iPhone version of Core Audio driver */
#define SDL_AUDIO_DRIVER_COREAUDIO 1
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DUMMY 1
/* Enable joystick support */
/* Only enable HIDAPI support if you want to support Steam Controllers on iOS and tvOS */
/*#define SDL_JOYSTICK_HIDAPI 1*/
#define SDL_JOYSTICK_MFI 1
#define SDL_JOYSTICK_VIRTUAL 1
#ifdef __TVOS__
#define SDL_SENSOR_DUMMY 1
#else
/* Enable the CoreMotion sensor driver */
#define SDL_SENSOR_COREMOTION 1
#endif
/* Enable Unix style SO loading */
#define SDL_LOADSO_DLOPEN 1
/* Enable various threading systems */
#define SDL_THREAD_PTHREAD 1
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
/* Enable various timer systems */
#define SDL_TIMER_UNIX 1
/* Supported video drivers */
#define SDL_VIDEO_DRIVER_UIKIT 1
#define SDL_VIDEO_DRIVER_DUMMY 1
/* Enable OpenGL ES */
#if !TARGET_OS_MACCATALYST
#define SDL_VIDEO_OPENGL_ES2 1
#define SDL_VIDEO_OPENGL_ES 1
#define SDL_VIDEO_RENDER_OGL_ES 1
#define SDL_VIDEO_RENDER_OGL_ES2 1
#endif
/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer
Also supported in simulator from iOS 13.0 and tvOS 13.0
*/
#if (TARGET_OS_SIMULATOR && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) || (__TV_OS_VERSION_MIN_REQUIRED >= 130000))) || (!TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000)))
#define SDL_PLATFORM_SUPPORTS_METAL 1
#else
#define SDL_PLATFORM_SUPPORTS_METAL 0
#endif
#if SDL_PLATFORM_SUPPORTS_METAL
#define SDL_VIDEO_RENDER_METAL 1
#endif
#if SDL_PLATFORM_SUPPORTS_METAL
#define SDL_VIDEO_VULKAN 1
#endif
#if SDL_PLATFORM_SUPPORTS_METAL
#define SDL_VIDEO_METAL 1
#endif
/* Enable system power support */
#define SDL_POWER_UIKIT 1
/* enable iPhone keyboard support */
#define SDL_IPHONE_KEYBOARD 1
/* enable iOS extended launch screen */
#define SDL_IPHONE_LAUNCHSCREEN 1
/* enable filesystem support */
#define SDL_FILESYSTEM_COCOA 1
#endif /* SDL_config_iphoneos_h_ */
@@ -1,277 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_macosx_h_
#define SDL_config_macosx_h_
#define SDL_config_h_
#include "SDL_platform.h"
/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */
#include <AvailabilityMacros.h>
/* This is a set of defines to configure the SDL features */
#ifdef __LP64__
#define SIZEOF_VOIDP 8
#else
#define SIZEOF_VOIDP 4
#endif
/* Useful headers */
#define STDC_HEADERS 1
#define HAVE_ALLOCA_H 1
#define HAVE_CTYPE_H 1
#define HAVE_FLOAT_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_LIBUNWIND_H 1
/* C library functions */
#define HAVE_DLOPEN 1
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOK_R 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_STRCASESTR 1
#define HAVE_VSSCANF 1
#define HAVE_VSNPRINTF 1
#define HAVE_M_PI 1
#define HAVE_ACOS 1
#define HAVE_ACOSF 1
#define HAVE_ASIN 1
#define HAVE_ASINF 1
#define HAVE_ATAN 1
#define HAVE_ATANF 1
#define HAVE_ATAN2 1
#define HAVE_ATAN2F 1
#define HAVE_CEIL 1
#define HAVE_CEILF 1
#define HAVE_COPYSIGN 1
#define HAVE_COPYSIGNF 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_EXP 1
#define HAVE_EXPF 1
#define HAVE_FABS 1
#define HAVE_FABSF 1
#define HAVE_FLOOR 1
#define HAVE_FLOORF 1
#define HAVE_FMOD 1
#define HAVE_FMODF 1
#define HAVE_LOG 1
#define HAVE_LOGF 1
#define HAVE_LOG10 1
#define HAVE_LOG10F 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_POW 1
#define HAVE_POWF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
#define HAVE_SYSCONF 1
#define HAVE_SYSCTLBYNAME 1
#if defined(__has_include) && (defined(__i386__) || defined(__x86_64))
# if __has_include(<immintrin.h>)
# define HAVE_IMMINTRIN_H 1
# endif
#endif
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070)
#define HAVE_O_CLOEXEC 1
#endif
#define HAVE_GCC_ATOMICS 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_COREAUDIO 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
#define SDL_JOYSTICK_HIDAPI 1
#define SDL_JOYSTICK_IOKIT 1
#define SDL_JOYSTICK_VIRTUAL 1
#define SDL_HAPTIC_IOKIT 1
/* The MFI controller support requires ARC Objective C runtime */
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !defined(__i386__)
#define SDL_JOYSTICK_MFI 1
#endif
/* Enable the dummy sensor driver */
#define SDL_SENSOR_DUMMY 1
/* Enable various shared object loading systems */
#define SDL_LOADSO_DLOPEN 1
/* Enable various threading systems */
#define SDL_THREAD_PTHREAD 1
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
/* Enable various timer systems */
#define SDL_TIMER_UNIX 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_COCOA 1
#define SDL_VIDEO_DRIVER_DUMMY 1
#undef SDL_VIDEO_DRIVER_X11
#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/opt/X11/lib/libX11.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/opt/X11/lib/libXext.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/opt/X11/lib/libXi.6.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/opt/X11/lib/libXrandr.2.dylib"
#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/opt/X11/lib/libXss.1.dylib"
#define SDL_VIDEO_DRIVER_X11_XDBE 1
#define SDL_VIDEO_DRIVER_X11_XRANDR 1
#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1
#define SDL_VIDEO_DRIVER_X11_XSHAPE 1
#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1
#ifdef MAC_OS_X_VERSION_10_8
/*
* No matter the versions targeted, this is the 10.8 or later SDK, so you have
* to use the external Xquartz, which is a more modern Xlib. Previous SDKs
* used an older Xlib.
*/
#define SDL_VIDEO_DRIVER_X11_XINPUT2 1
#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL
#define SDL_VIDEO_RENDER_OGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL_ES2
#define SDL_VIDEO_RENDER_OGL_ES2 1
#endif
/* Metal only supported on 64-bit architectures with 10.11+ */
#if TARGET_RT_64_BIT && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100)
#define SDL_PLATFORM_SUPPORTS_METAL 1
#else
#define SDL_PLATFORM_SUPPORTS_METAL 0
#endif
#ifndef SDL_VIDEO_RENDER_METAL
#if SDL_PLATFORM_SUPPORTS_METAL
#define SDL_VIDEO_RENDER_METAL 1
#else
#define SDL_VIDEO_RENDER_METAL 0
#endif
#endif
/* Enable OpenGL support */
#ifndef SDL_VIDEO_OPENGL
#define SDL_VIDEO_OPENGL 1
#endif
#ifndef SDL_VIDEO_OPENGL_ES2
#define SDL_VIDEO_OPENGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_EGL
#define SDL_VIDEO_OPENGL_EGL 1
#endif
#ifndef SDL_VIDEO_OPENGL_CGL
#define SDL_VIDEO_OPENGL_CGL 1
#endif
#ifndef SDL_VIDEO_OPENGL_GLX
#define SDL_VIDEO_OPENGL_GLX 1
#endif
/* Enable Vulkan and Metal support */
#ifndef SDL_VIDEO_VULKAN
#if SDL_PLATFORM_SUPPORTS_METAL
#define SDL_VIDEO_VULKAN 1
#else
#define SDL_VIDEO_VULKAN 0
#endif
#endif
#ifndef SDL_VIDEO_METAL
#if SDL_PLATFORM_SUPPORTS_METAL
#define SDL_VIDEO_METAL 1
#else
#define SDL_VIDEO_METAL 0
#endif
#endif
/* Enable system power support */
#define SDL_POWER_MACOSX 1
/* enable filesystem support */
#define SDL_FILESYSTEM_COCOA 1
/* Enable assembly routines */
#ifdef __ppc__
#define SDL_ALTIVEC_BLITTERS 1
#endif
#endif /* SDL_config_macosx_h_ */
@@ -1,95 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_minimal_h_
#define SDL_config_minimal_h_
#define SDL_config_h_
#include "SDL_platform.h"
/**
* \file SDL_config_minimal.h
*
* This is the minimal configuration that can be used to build SDL.
*/
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_)
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#else
#define HAVE_STDINT_H 1
#endif /* Visual Studio 2008 */
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#ifdef __GNUC__
#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1
#endif
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
#define SDL_JOYSTICK_DISABLED 1
/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DISABLED 1
/* Enable the stub HIDAPI */
#define SDL_HIDAPI_DISABLED 1
/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */
#define SDL_SENSOR_DISABLED 1
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
/* Enable the stub thread support (src/thread/generic/\*.c) */
#define SDL_THREADS_DISABLED 1
/* Enable the stub timer support (src/timer/dummy/\*.c) */
#define SDL_TIMERS_DISABLED 1
/* Enable the dummy video driver (src/video/dummy/\*.c) */
#define SDL_VIDEO_DRIVER_DUMMY 1
/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
#define SDL_FILESYSTEM_DUMMY 1
#endif /* SDL_config_minimal_h_ */
@@ -1,89 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_ngage_h_
#define SDL_config_ngage_h_
#define SDL_config_h_
#include "SDL_platform.h"
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
typedef unsigned long uintptr_t;
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_MATH_H 1
#define HAVE_CEIL 1
#define HAVE_COPYSIGN 1
#define HAVE_COS 1
#define HAVE_EXP 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_LOG 1
#define HAVE_LOG10 1
#define HAVE_SCALBN 1
#define HAVE_SIN 1
#define HAVE_SQRT 1
#define HAVE_TAN 1
#define HAVE_MALLOC 1
#define SDL_MAIN_NEEDED 1
#define LACKS_SYS_MMAN_H 1
/* Enable the N-Gage thread support (src/thread/ngage/\*.c) */
#define SDL_THREAD_NGAGE 1
/* Enable the N-Gage timer support (src/timer/ngage/\*.c) */
#define SDL_TIMER_NGAGE 1
/* Enable the N-Gage video driver (src/video/ngage/\*.c) */
#define SDL_VIDEO_DRIVER_NGAGE 1
/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
#define SDL_JOYSTICK_DISABLED 1
/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */
#define SDL_HAPTIC_DISABLED 1
/* Enable the stub HIDAPI */
#define SDL_HIDAPI_DISABLED 1
/* Enable the stub sensor driver (src/sensor/dummy/\*.c) */
#define SDL_SENSOR_DISABLED 1
/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
#define SDL_LOADSO_DISABLED 1
/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */
#define SDL_FILESYSTEM_DUMMY 1
#endif /* SDL_config_ngage_h_ */
@@ -1,204 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_os2_h_
#define SDL_config_os2_h_
#define SDL_config_h_
#include "SDL_platform.h"
#define SIZEOF_VOIDP 4
#define SDL_AUDIO_DRIVER_DUMMY 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_OS2 1
#define SDL_POWER_DISABLED 1
#define SDL_HAPTIC_DISABLED 1
#define SDL_SENSOR_DUMMY 1
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_OS2 1
#define SDL_JOYSTICK_OS2 1
#ifndef HAVE_LIBUSB_H /* see Makefile */
#define SDL_HIDAPI_DISABLED 1
/*#undef SDL_JOYSTICK_HIDAPI */
#else
#define SDL_JOYSTICK_HIDAPI 1
#define HAVE_LIBUSB 1
/* dynamically loaded libusb-1.0 dll: */
#define SDL_LIBUSB_DYNAMIC "usb100.dll"
#endif
#define SDL_JOYSTICK_VIRTUAL 1
/* Enable OpenGL support */
/* #undef SDL_VIDEO_OPENGL */
#define SDL_THREAD_OS2 1
#define SDL_LOADSO_OS2 1
#define SDL_TIMER_OS2 1
#define SDL_FILESYSTEM_OS2 1
/* use libsamplerate for audio rate conversion. */
/*#define HAVE_LIBSAMPLERATE_H 1 */
/* Enable dynamic libsamplerate support */
#define SDL_LIBSAMPLERATE_DYNAMIC "SAMPRATE.DLL"
#define HAVE_LIBC 1
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_STDIO_H 1
#define STDC_HEADERS 1
#define HAVE_STDLIB_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRING_H 1
#define HAVE_STRINGS_H 1
#define HAVE_WCHAR_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_CTYPE_H 1
#define HAVE_MATH_H 1
#define HAVE_FLOAT_H 1
#define HAVE_SIGNAL_H 1
#if 0 /* see Makefile */
#define HAVE_ICONV 1
#define HAVE_ICONV_H 1
#endif
/* #undef HAVE_DLOPEN */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#if defined(__WATCOMC__)
#define HAVE__FSEEKI64 1
#define HAVE__FTELLI64 1
#endif
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_SETENV 1
#define HAVE_PUTENV 1
/* OpenWatcom requires specific calling conventions for qsort and bsearch */
#ifndef __WATCOMC__
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#endif
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_WCSCMP 1
#define HAVE__WCSICMP 1
#define HAVE__WCSNICMP 1
#define HAVE_WCSLEN 1
#define HAVE_WCSLCPY 1
#define HAVE_WCSLCAT 1
/* #undef HAVE_WCSDUP */
#define HAVE__WCSDUP 1
#define HAVE_WCSSTR 1
#define HAVE_WCSCMP 1
#define HAVE_WCSNCMP 1
#define HAVE_STRLEN 1
#define HAVE_STRLCPY 1
#define HAVE_STRLCAT 1
#define HAVE__STRREV 1
#define HAVE__STRUPR 1
#define HAVE__STRLWR 1
/* #undef HAVE_INDEX */
/* #undef HAVE_RINDEX */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_STRTOK_R */
#define HAVE_ITOA 1
#define HAVE__LTOA 1
#define HAVE__ULTOA 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE__I64TOA 1
#define HAVE__UI64TOA 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRICMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_SSCANF 1
#define HAVE_VSSCANF 1
#define HAVE_SNPRINTF 1
#define HAVE_VSNPRINTF 1
#define HAVE_SETJMP 1
#define HAVE_ACOS 1
/* #undef HAVE_ACOSF */
#define HAVE_ASIN 1
/* #undef HAVE_ASINF */
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
/* #undef HAVE_ATAN2F */
#define HAVE_CEIL 1
/* #undef HAVE_CEILF */
/* #undef HAVE_COPYSIGN */
/* #undef HAVE_COPYSIGNF */
#define HAVE_COS 1
/* #undef HAVE_COSF */
#define HAVE_EXP 1
/* #undef HAVE_EXPF */
#define HAVE_FABS 1
/* #undef HAVE_FABSF */
#define HAVE_FLOOR 1
/* #undef HAVE_FLOORF */
#define HAVE_FMOD 1
/* #undef HAVE_FMODF */
#define HAVE_LOG 1
/* #undef HAVE_LOGF */
#define HAVE_LOG10 1
/* #undef HAVE_LOG10F */
#define HAVE_POW 1
/* #undef HAVE_POWF */
#define HAVE_SIN 1
/* #undef HAVE_SINF */
/* #undef HAVE_SCALBN */
/* #undef HAVE_SCALBNF */
#define HAVE_SQRT 1
/* #undef HAVE_SQRTF */
#define HAVE_TAN 1
/* #undef HAVE_TANF */
/* #undef HAVE_TRUNC */
/* #undef HAVE_TRUNCF */
/* #undef HAVE_LROUND */
/* #undef HAVE_LROUNDF */
/* #undef HAVE_ROUND */
/* #undef HAVE_ROUNDF */
#endif /* SDL_config_os2_h_ */
@@ -1,141 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_pandora_h_
#define SDL_config_pandora_h_
#define SDL_config_h_
/* This is a set of defines to configure the SDL features */
/* General platform specific identifiers */
#include "SDL_platform.h"
#ifdef __LP64__
#define SIZEOF_VOIDP 8
#else
#define SIZEOF_VOIDP 4
#endif
#define SDL_BYTEORDER 1234
#define STDC_HEADERS 1
#define HAVE_ALLOCA_H 1
#define HAVE_CTYPE_H 1
#define HAVE_ICONV_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MALLOC_H 1
#define HAVE_MATH_H 1
#define HAVE_MEMORY_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDARG_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRING_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_DLOPEN 1
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_GETENV 1
#define HAVE_SETENV 1
#define HAVE_PUTENV 1
#define HAVE_UNSETENV 1
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#define HAVE_ABS 1
#define HAVE_BCOPY 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_STRLEN 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE_STRCASECMP 1
#define HAVE_STRNCASECMP 1
#define HAVE_VSSCANF 1
#define HAVE_VSNPRINTF 1
#define HAVE_M_PI 1
#define HAVE_CEIL 1
#define HAVE_COPYSIGN 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_EXP 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_LOG 1
#define HAVE_LOG10 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#define HAVE_SIGACTION 1
#define HAVE_SETJMP 1
#define HAVE_NANOSLEEP 1
#define SDL_AUDIO_DRIVER_DUMMY 1
#define SDL_AUDIO_DRIVER_OSS 1
#define SDL_INPUT_LINUXEV 1
#define SDL_JOYSTICK_LINUX 1
#define SDL_JOYSTICK_VIRTUAL 1
#define SDL_HAPTIC_LINUX 1
#define SDL_SENSOR_DUMMY 1
#define SDL_LOADSO_DLOPEN 1
#define SDL_THREAD_PTHREAD 1
#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1
#define SDL_TIMER_UNIX 1
#define SDL_FILESYSTEM_UNIX 1
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_X11 1
#define SDL_VIDEO_DRIVER_PANDORA 1
#define SDL_VIDEO_RENDER_OGL_ES 1
#define SDL_VIDEO_OPENGL_ES 1
#endif /* SDL_config_pandora_h_ */
@@ -1,333 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_windows_h_
#define SDL_config_windows_h_
#define SDL_config_h_
#include "SDL_platform.h"
/* winsdkver.h defines _WIN32_MAXVER for SDK version detection. It is present since at least the Windows 7 SDK,
* but out of caution we'll only use it if the compiler supports __has_include() to confirm its presence.
* If your compiler doesn't support __has_include() but you have winsdkver.h, define HAVE_WINSDKVER_H. */
#if !defined(HAVE_WINSDKVER_H) && defined(__has_include)
#if __has_include(<winsdkver.h>)
#define HAVE_WINSDKVER_H 1
#endif
#endif
#ifdef HAVE_WINSDKVER_H
#include <winsdkver.h>
#endif
/* sdkddkver.h defines more specific SDK version numbers. This is needed because older versions of the
* Windows 10 SDK have broken declarations for the C API for DirectX 12. */
#if !defined(HAVE_SDKDDKVER_H) && defined(__has_include)
#if __has_include(<sdkddkver.h>)
#define HAVE_SDKDDKVER_H 1
#endif
#endif
#ifdef HAVE_SDKDDKVER_H
#include <sdkddkver.h>
#endif
/* This is a set of defines to configure the SDL features */
#if !defined(HAVE_STDINT_H) && !defined(_STDINT_H_)
/* Most everything except Visual Studio 2008 and earlier has stdint.h now */
#if defined(_MSC_VER) && (_MSC_VER < 1600)
typedef signed __int8 int8_t;
typedef unsigned __int8 uint8_t;
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#ifndef _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __int64 uintptr_t;
#else
typedef unsigned int uintptr_t;
#endif
#define _UINTPTR_T_DEFINED
#endif
#else
#define HAVE_STDINT_H 1
#endif /* Visual Studio 2008 */
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
#ifdef _WIN64
# define SIZEOF_VOIDP 8
#else
# define SIZEOF_VOIDP 4
#endif
#ifdef __clang__
# define HAVE_GCC_ATOMICS 1
#endif
#define HAVE_DDRAW_H 1
#define HAVE_DINPUT_H 1
#define HAVE_DSOUND_H 1
#ifndef __WATCOMC__
#define HAVE_DXGI_H 1
#define HAVE_XINPUT_H 1
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0A00 /* Windows 10 SDK */
#define HAVE_WINDOWS_GAMING_INPUT_H 1
#endif
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0602 /* Windows 8 SDK */
#define HAVE_D3D11_H 1
#define HAVE_ROAPI_H 1
#endif
#if defined(__has_include)
#if __has_include(<d3d12.h>) && __has_include(<d3d12sdklayers.h>)
#define HAVE_D3D12_H 1
#endif
#endif
#if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */
#define HAVE_SHELLSCALINGAPI_H 1
#endif
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
#define HAVE_TPCSHRD_H 1
#define HAVE_SENSORSAPI_H 1
#endif
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
#define HAVE_IMMINTRIN_H 1
#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))
# if __has_include(<immintrin.h>)
# define HAVE_IMMINTRIN_H 1
# endif
#endif
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
#ifdef HAVE_LIBC
/* Useful headers */
#define STDC_HEADERS 1
#define HAVE_CTYPE_H 1
#define HAVE_FLOAT_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
/* OpenWatcom requires specific calling conventions for qsort and bsearch */
#ifndef __WATCOMC__
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#endif
#define HAVE_ABS 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE__STRREV 1
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__STRUPR */
/* #undef HAVE__STRLWR */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_STRTOK_R */
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__LTOA */
/* #undef HAVE__ULTOA */
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE__STRICMP 1
#define HAVE__STRNICMP 1
#define HAVE__WCSICMP 1
#define HAVE__WCSNICMP 1
#define HAVE__WCSDUP 1
#define HAVE_ACOS 1
#define HAVE_ASIN 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
#define HAVE_CEIL 1
#define HAVE_COS 1
#define HAVE_EXP 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_FMOD 1
#define HAVE_LOG 1
#define HAVE_LOG10 1
#define HAVE_POW 1
#define HAVE_SIN 1
#define HAVE_SQRT 1
#define HAVE_TAN 1
#ifndef __WATCOMC__
#define HAVE_ACOSF 1
#define HAVE_ASINF 1
#define HAVE_ATANF 1
#define HAVE_ATAN2F 1
#define HAVE_CEILF 1
#define HAVE__COPYSIGN 1
#define HAVE_COSF 1
#define HAVE_EXPF 1
#define HAVE_FABSF 1
#define HAVE_FLOORF 1
#define HAVE_FMODF 1
#define HAVE_LOGF 1
#define HAVE_LOG10F 1
#define HAVE_POWF 1
#define HAVE_SINF 1
#define HAVE_SQRTF 1
#define HAVE_TANF 1
#endif
#if defined(_MSC_VER)
/* These functions were added with the VC++ 2013 C runtime library */
#if _MSC_VER >= 1800
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_VSSCANF 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#endif
/* This function is available with at least the VC++ 2008 C runtime library */
#if _MSC_VER >= 1400
#define HAVE__FSEEKI64 1
#endif
#ifdef _USE_MATH_DEFINES
#define HAVE_M_PI 1
#endif
#elif defined(__WATCOMC__)
#define HAVE__FSEEKI64 1
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_VSSCANF 1
#define HAVE_ROUND 1
#define HAVE_SCALBN 1
#define HAVE_TRUNC 1
#else
#define HAVE_M_PI 1
#endif
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#endif
/* Enable various audio drivers */
#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H)
#define SDL_AUDIO_DRIVER_WASAPI 1
#endif
#define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_AUDIO_DRIVER_WINMM 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
#define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_HIDAPI 1
#ifndef __WINRT__
#define SDL_JOYSTICK_RAWINPUT 1
#endif
#define SDL_JOYSTICK_VIRTUAL 1
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
#define SDL_JOYSTICK_WGI 1
#endif
#define SDL_JOYSTICK_XINPUT 1
#define SDL_HAPTIC_DINPUT 1
#define SDL_HAPTIC_XINPUT 1
/* Enable the sensor driver */
#ifdef HAVE_SENSORSAPI_H
#define SDL_SENSOR_WINDOWS 1
#else
#define SDL_SENSOR_DUMMY 1
#endif
/* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */
#define SDL_THREAD_GENERIC_COND_SUFFIX 1
#define SDL_THREAD_WINDOWS 1
/* Enable various timer systems */
#define SDL_TIMER_WINDOWS 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_WINDOWS 1
#ifndef SDL_VIDEO_RENDER_D3D
#define SDL_VIDEO_RENDER_D3D 1
#endif
#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H)
#define SDL_VIDEO_RENDER_D3D11 1
#endif
#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H)
#define SDL_VIDEO_RENDER_D3D12 1
#endif
/* Enable OpenGL support */
#ifndef SDL_VIDEO_OPENGL
#define SDL_VIDEO_OPENGL 1
#endif
#ifndef SDL_VIDEO_OPENGL_WGL
#define SDL_VIDEO_OPENGL_WGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL
#define SDL_VIDEO_RENDER_OGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL_ES2
#define SDL_VIDEO_RENDER_OGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_ES2
#define SDL_VIDEO_OPENGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_EGL
#define SDL_VIDEO_OPENGL_EGL 1
#endif
/* Enable Vulkan support */
#define SDL_VIDEO_VULKAN 1
/* Enable system power support */
#define SDL_POWER_WINDOWS 1
/* Enable filesystem support */
#define SDL_FILESYSTEM_WINDOWS 1
#endif /* SDL_config_windows_h_ */
/* vi: set ts=4 sw=4 expandtab: */
@@ -1,253 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_wingdk_h_
#define SDL_config_wingdk_h_
#define SDL_config_h_
#include "SDL_platform.h"
/* Windows GDK does not need Windows SDK version checks because it requires
* a recent version of the Windows 10 SDK. */
/* GDK only supports 64-bit */
# define SIZEOF_VOIDP 8
#ifdef __clang__
# define HAVE_GCC_ATOMICS 1
#endif
#define HAVE_DDRAW_H 1
#define HAVE_DINPUT_H 1
#define HAVE_DSOUND_H 1
/* No SDK version checks needed for these because the SDK has to be new. */
#define HAVE_DXGI_H 1
#define HAVE_XINPUT_H 1
#define HAVE_WINDOWS_GAMING_INPUT_H 1
#define HAVE_D3D11_H 1
#define HAVE_ROAPI_H 1
#define HAVE_D3D12_H 1
#define HAVE_SHELLSCALINGAPI_H 1
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
#define HAVE_TPCSHRD_H 1
#define HAVE_SENSORSAPI_H 1
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
#define HAVE_IMMINTRIN_H 1
#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))
# if __has_include(<immintrin.h>)
# define HAVE_IMMINTRIN_H 1
# endif
#endif
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
#ifdef HAVE_LIBC
/* Useful headers */
#define STDC_HEADERS 1
#define HAVE_CTYPE_H 1
#define HAVE_FLOAT_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#define HAVE_ABS 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE__STRREV 1
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__STRUPR */
/* #undef HAVE__STRLWR */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_STRTOK_R */
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__LTOA */
/* #undef HAVE__ULTOA */
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE__STRICMP 1
#define HAVE__STRNICMP 1
#define HAVE__WCSICMP 1
#define HAVE__WCSNICMP 1
#define HAVE__WCSDUP 1
#define HAVE_ACOS 1
#define HAVE_ASIN 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
#define HAVE_CEIL 1
#define HAVE_COS 1
#define HAVE_EXP 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_FMOD 1
#define HAVE_LOG 1
#define HAVE_LOG10 1
#define HAVE_POW 1
#define HAVE_SIN 1
#define HAVE_SQRT 1
#define HAVE_TAN 1
#define HAVE_ACOSF 1
#define HAVE_ASINF 1
#define HAVE_ATANF 1
#define HAVE_ATAN2F 1
#define HAVE_CEILF 1
#define HAVE__COPYSIGN 1
#define HAVE_COSF 1
#define HAVE_EXPF 1
#define HAVE_FABSF 1
#define HAVE_FLOORF 1
#define HAVE_FMODF 1
#define HAVE_LOGF 1
#define HAVE_LOG10F 1
#define HAVE_POWF 1
#define HAVE_SINF 1
#define HAVE_SQRTF 1
#define HAVE_TANF 1
#if defined(_MSC_VER)
/* These functions were added with the VC++ 2013 C runtime library */
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_VSSCANF 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#define HAVE__FSEEKI64 1
#ifdef _USE_MATH_DEFINES
#define HAVE_M_PI 1
#endif
#else
#define HAVE_M_PI 1
#endif
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
#endif
/* Enable various audio drivers */
#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H)
#define SDL_AUDIO_DRIVER_WASAPI 1
#endif
#define SDL_AUDIO_DRIVER_DSOUND 1
#define SDL_AUDIO_DRIVER_WINMM 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
#define SDL_JOYSTICK_DINPUT 1
#define SDL_JOYSTICK_HIDAPI 1
#define SDL_JOYSTICK_RAWINPUT 1
#define SDL_JOYSTICK_VIRTUAL 1
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
#define SDL_JOYSTICK_WGI 1
#endif
#define SDL_JOYSTICK_XINPUT 1
#define SDL_HAPTIC_DINPUT 1
#define SDL_HAPTIC_XINPUT 1
/* Enable the sensor driver */
#ifdef HAVE_SENSORSAPI_H
#define SDL_SENSOR_WINDOWS 1
#else
#define SDL_SENSOR_DUMMY 1
#endif
/* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */
#define SDL_THREAD_GENERIC_COND_SUFFIX 1
#define SDL_THREAD_WINDOWS 1
/* Enable various timer systems */
#define SDL_TIMER_WINDOWS 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_WINDOWS 1
#ifndef SDL_VIDEO_RENDER_D3D
#define SDL_VIDEO_RENDER_D3D 1
#endif
#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H)
#define SDL_VIDEO_RENDER_D3D11 1
#endif
#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H)
#define SDL_VIDEO_RENDER_D3D12 1
#endif
/* Enable OpenGL support */
#ifndef SDL_VIDEO_OPENGL
#define SDL_VIDEO_OPENGL 1
#endif
#ifndef SDL_VIDEO_OPENGL_WGL
#define SDL_VIDEO_OPENGL_WGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL
#define SDL_VIDEO_RENDER_OGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL_ES2
#define SDL_VIDEO_RENDER_OGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_ES2
#define SDL_VIDEO_OPENGL_ES2 1
#endif
#ifndef SDL_VIDEO_OPENGL_EGL
#define SDL_VIDEO_OPENGL_EGL 1
#endif
/* Enable Vulkan support */
#define SDL_VIDEO_VULKAN 1
/* Enable system power support */
#define SDL_POWER_WINDOWS 1
/* Enable filesystem support */
#define SDL_FILESYSTEM_WINDOWS 1
#endif /* SDL_config_wingdk_h_ */
/* vi: set ts=4 sw=4 expandtab: */
@@ -1,220 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_winrt_h_
#define SDL_config_winrt_h_
#define SDL_config_h_
#include "SDL_platform.h"
/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used
by SDL to determine which version of the Windows SDK is being used.
*/
#include <sdkddkver.h>
/* Define possibly-undefined NTDDI values (used when compiling SDL against
older versions of the Windows SDK.
*/
#ifndef NTDDI_WINBLUE
#define NTDDI_WINBLUE 0x06030000
#endif
#ifndef NTDDI_WIN10
#define NTDDI_WIN10 0x0A000000
#endif
/* This is a set of defines to configure the SDL features */
#ifdef _WIN64
# define SIZEOF_VOIDP 8
#else
# define SIZEOF_VOIDP 4
#endif
#ifdef __clang__
# define HAVE_GCC_ATOMICS 1
#endif
/* Useful headers */
#define HAVE_DXGI_H 1
#if !SDL_WINAPI_FAMILY_PHONE
#define HAVE_XINPUT_H 1
#endif
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
#define HAVE_TPCSHRD_H 1
#define HAVE_LIBC 1
#define STDC_HEADERS 1
#define HAVE_CTYPE_H 1
#define HAVE_FLOAT_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#define HAVE_ABS 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE__STRREV 1
#define HAVE__STRUPR 1
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
/* #undef HAVE_STRTOLL */
/* #undef HAVE_STRTOULL */
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE__STRICMP 1
#define HAVE__STRNICMP 1
#define HAVE_VSNPRINTF 1
/* TODO, WinRT: consider using ??_s versions of the following */
/* #undef HAVE__STRLWR */
/* #undef HAVE_ITOA */
/* #undef HAVE__LTOA */
/* #undef HAVE__ULTOA */
/* #undef HAVE_SSCANF */
#define HAVE_M_PI 1
#define HAVE_ACOS 1
#define HAVE_ACOSF 1
#define HAVE_ASIN 1
#define HAVE_ASINF 1
#define HAVE_ATAN 1
#define HAVE_ATANF 1
#define HAVE_ATAN2 1
#define HAVE_ATAN2F 1
#define HAVE_CEIL 1
#define HAVE_CEILF 1
#define HAVE__COPYSIGN 1
#define HAVE_COS 1
#define HAVE_COSF 1
#define HAVE_EXP 1
#define HAVE_EXPF 1
#define HAVE_FABS 1
#define HAVE_FABSF 1
#define HAVE_FLOOR 1
#define HAVE_FLOORF 1
#define HAVE_FMOD 1
#define HAVE_FMODF 1
#define HAVE_LOG 1
#define HAVE_LOGF 1
#define HAVE_LOG10 1
#define HAVE_LOG10F 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_POW 1
#define HAVE_POWF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE__SCALB 1
#define HAVE_SIN 1
#define HAVE_SINF 1
#define HAVE_SQRT 1
#define HAVE_SQRTF 1
#define HAVE_TAN 1
#define HAVE_TANF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#define HAVE__FSEEKI64 1
#define HAVE_ROAPI_H 1
/* Enable various audio drivers */
#define SDL_AUDIO_DRIVER_WASAPI 1
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
#if SDL_WINAPI_FAMILY_PHONE
#define SDL_JOYSTICK_DISABLED 1
#define SDL_HAPTIC_DISABLED 1
#else
#define SDL_JOYSTICK_VIRTUAL 1
#if (NTDDI_VERSION >= NTDDI_WIN10)
#define SDL_JOYSTICK_WGI 1
#define SDL_HAPTIC_DISABLED 1
#else
#define SDL_JOYSTICK_XINPUT 1
#define SDL_HAPTIC_XINPUT 1
#endif /* WIN10 */
#endif
/* WinRT doesn't have HIDAPI available */
#define SDL_HIDAPI_DISABLED 1
/* Enable the dummy sensor driver */
#define SDL_SENSOR_DUMMY 1
/* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */
#if (NTDDI_VERSION >= NTDDI_WINBLUE)
#define SDL_THREAD_GENERIC_COND_SUFFIX 1
#define SDL_THREAD_WINDOWS 1
#else
/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */
#define SDL_THREAD_STDCPP 1
#endif
/* Enable various timer systems */
#define SDL_TIMER_WINDOWS 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_WINRT 1
#define SDL_VIDEO_DRIVER_DUMMY 1
/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */
#define SDL_VIDEO_OPENGL_ES2 1
#define SDL_VIDEO_OPENGL_EGL 1
/* Enable appropriate renderer(s) */
#define SDL_VIDEO_RENDER_D3D11 1
/* Disable D3D12 as it's not implemented for WinRT */
/* #undef SDL_VIDEO_RENDER_D3D12 */
#ifdef SDL_VIDEO_OPENGL_ES2
#define SDL_VIDEO_RENDER_OGL_ES2 1
#endif
/* Enable system power support */
#define SDL_POWER_WINRT 1
#endif /* SDL_config_winrt_h_ */
@@ -1,240 +0,0 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifndef SDL_config_wingdk_h_
#define SDL_config_wingdk_h_
#define SDL_config_h_
#include "SDL_platform.h"
/* Windows GDK does not need Windows SDK version checks because it requires
* a recent version of the Windows 10 SDK. */
/* GDK only supports 64-bit */
# define SIZEOF_VOIDP 8
#ifdef __clang__
# define HAVE_GCC_ATOMICS 1
#endif
/*#define HAVE_DDRAW_H 1*/
/*#define HAVE_DINPUT_H 1*/
/*#define HAVE_DSOUND_H 1*/
/* No SDK version checks needed for these because the SDK has to be new. */
/* #define HAVE_DXGI_H 1 */
#define HAVE_XINPUT_H 1
/*#define HAVE_WINDOWS_GAMING_INPUT_H 1*/
/*#define HAVE_D3D11_H 1*/
/*#define HAVE_ROAPI_H 1*/
#define HAVE_D3D12_H 1
/*#define HAVE_SHELLSCALINGAPI_H 1*/
#define HAVE_MMDEVICEAPI_H 1
#define HAVE_AUDIOCLIENT_H 1
/*#define HAVE_TPCSHRD_H 1*/
/*#define HAVE_SENSORSAPI_H 1*/
#if (defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64)) && (defined(_MSC_VER) && _MSC_VER >= 1600)
#define HAVE_IMMINTRIN_H 1
#elif defined(__has_include) && (defined(__i386__) || defined(__x86_64))
# if __has_include(<immintrin.h>)
# define HAVE_IMMINTRIN_H 1
# endif
#endif
/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
#ifdef HAVE_LIBC
/* Useful headers */
#define STDC_HEADERS 1
#define HAVE_CTYPE_H 1
#define HAVE_FLOAT_H 1
#define HAVE_LIMITS_H 1
#define HAVE_MATH_H 1
#define HAVE_SIGNAL_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1
/* C library functions */
#define HAVE_MALLOC 1
#define HAVE_CALLOC 1
#define HAVE_REALLOC 1
#define HAVE_FREE 1
#define HAVE_ALLOCA 1
#define HAVE_QSORT 1
#define HAVE_BSEARCH 1
#define HAVE_ABS 1
#define HAVE_MEMSET 1
#define HAVE_MEMCPY 1
#define HAVE_MEMMOVE 1
#define HAVE_MEMCMP 1
#define HAVE_STRLEN 1
#define HAVE__STRREV 1
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__STRUPR */
/* #undef HAVE__STRLWR */
#define HAVE_STRCHR 1
#define HAVE_STRRCHR 1
#define HAVE_STRSTR 1
/* #undef HAVE_STRTOK_R */
/* These functions have security warnings, so we won't use them */
/* #undef HAVE__LTOA */
/* #undef HAVE__ULTOA */
#define HAVE_STRTOL 1
#define HAVE_STRTOUL 1
#define HAVE_STRTOD 1
#define HAVE_ATOI 1
#define HAVE_ATOF 1
#define HAVE_STRCMP 1
#define HAVE_STRNCMP 1
#define HAVE__STRICMP 1
#define HAVE__STRNICMP 1
#define HAVE__WCSICMP 1
#define HAVE__WCSNICMP 1
#define HAVE__WCSDUP 1
#define HAVE_ACOS 1
#define HAVE_ASIN 1
#define HAVE_ATAN 1
#define HAVE_ATAN2 1
#define HAVE_CEIL 1
#define HAVE_COS 1
#define HAVE_EXP 1
#define HAVE_FABS 1
#define HAVE_FLOOR 1
#define HAVE_FMOD 1
#define HAVE_LOG 1
#define HAVE_LOG10 1
#define HAVE_POW 1
#define HAVE_SIN 1
#define HAVE_SQRT 1
#define HAVE_TAN 1
#define HAVE_ACOSF 1
#define HAVE_ASINF 1
#define HAVE_ATANF 1
#define HAVE_ATAN2F 1
#define HAVE_CEILF 1
#define HAVE__COPYSIGN 1
#define HAVE_COSF 1
#define HAVE_EXPF 1
#define HAVE_FABSF 1
#define HAVE_FLOORF 1
#define HAVE_FMODF 1
#define HAVE_LOGF 1
#define HAVE_LOG10F 1
#define HAVE_POWF 1
#define HAVE_SINF 1
#define HAVE_SQRTF 1
#define HAVE_TANF 1
#if defined(_MSC_VER)
/* These functions were added with the VC++ 2013 C runtime library */
#define HAVE_STRTOLL 1
#define HAVE_STRTOULL 1
#define HAVE_VSSCANF 1
#define HAVE_LROUND 1
#define HAVE_LROUNDF 1
#define HAVE_ROUND 1
#define HAVE_ROUNDF 1
#define HAVE_SCALBN 1
#define HAVE_SCALBNF 1
#define HAVE_TRUNC 1
#define HAVE_TRUNCF 1
#define HAVE__FSEEKI64 1
#ifdef _USE_MATH_DEFINES
#define HAVE_M_PI 1
#endif
#else
#define HAVE_M_PI 1
#endif
#else
#define HAVE_STDARG_H 1
#define HAVE_STDDEF_H 1
#define HAVE_STDINT_H 1
#endif
/* Enable various audio drivers */
#if defined(HAVE_MMDEVICEAPI_H) && defined(HAVE_AUDIOCLIENT_H)
#define SDL_AUDIO_DRIVER_WASAPI 1
#endif
/*#define SDL_AUDIO_DRIVER_DSOUND 1*/
/*#define SDL_AUDIO_DRIVER_WINMM 1*/
#define SDL_AUDIO_DRIVER_DISK 1
#define SDL_AUDIO_DRIVER_DUMMY 1
/* Enable various input drivers */
/*#define SDL_JOYSTICK_DINPUT 1*/
/*#define SDL_JOYSTICK_HIDAPI 1*/
/*#define SDL_JOYSTICK_RAWINPUT 1*/
#define SDL_JOYSTICK_VIRTUAL 1
#ifdef HAVE_WINDOWS_GAMING_INPUT_H
#define SDL_JOYSTICK_WGI 1
#endif
#define SDL_JOYSTICK_XINPUT 1
/*#define SDL_HAPTIC_DINPUT 1*/
#define SDL_HAPTIC_XINPUT 1
/* Enable the sensor driver */
#ifdef HAVE_SENSORSAPI_H
#define SDL_SENSOR_WINDOWS 1
#else
#define SDL_SENSOR_DUMMY 1
#endif
/* Enable various shared object loading systems */
#define SDL_LOADSO_WINDOWS 1
/* Enable various threading systems */
#define SDL_THREAD_GENERIC_COND_SUFFIX 1
#define SDL_THREAD_WINDOWS 1
/* Enable various timer systems */
#define SDL_TIMER_WINDOWS 1
/* Enable various video drivers */
#define SDL_VIDEO_DRIVER_DUMMY 1
#define SDL_VIDEO_DRIVER_WINDOWS 1
#if !defined(SDL_VIDEO_RENDER_D3D12) && defined(HAVE_D3D12_H)
#define SDL_VIDEO_RENDER_D3D12 1
#endif
/* Enable OpenGL support */
#ifndef SDL_VIDEO_OPENGL
#define SDL_VIDEO_OPENGL 1
#endif
#ifndef SDL_VIDEO_OPENGL_WGL
#define SDL_VIDEO_OPENGL_WGL 1
#endif
#ifndef SDL_VIDEO_RENDER_OGL
#define SDL_VIDEO_RENDER_OGL 1
#endif
/* Enable system power support */
/*#define SDL_POWER_WINDOWS 1*/
#define SDL_POWER_HARDWIRED 1
/* Enable filesystem support */
/* #define SDL_FILESYSTEM_WINDOWS 1*/
#define SDL_FILESYSTEM_XBOX 1
/* Disable IME as not supported yet (TODO: Xbox IME?) */
#define SDL_DISABLE_WINDOWS_IME 1
#endif /* SDL_config_wingdk_h_ */
/* vi: set ts=4 sw=4 expandtab: */
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,16 +19,10 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: CPUInfo */
/** /**
* # CategoryCPUInfo * \file SDL_cpuinfo.h
* *
* CPU feature detection for SDL. * CPU feature detection for SDL.
*
* These functions are largely concerned with reporting if the system has
* access to various SIMD instruction sets, but also has other important info
* to share, such as number of logical CPU cores.
*/ */
#ifndef SDL_cpuinfo_h_ #ifndef SDL_cpuinfo_h_
@@ -59,11 +53,9 @@ _m_prefetch(void *__P)
#ifndef __MMX__ #ifndef __MMX__
#define __MMX__ #define __MMX__
#endif #endif
/*
#ifndef __3dNOW__ #ifndef __3dNOW__
#define __3dNOW__ #define __3dNOW__
#endif #endif
*/
#endif #endif
#ifndef __SSE__ #ifndef __SSE__
#define __SSE__ #define __SSE__
@@ -115,8 +107,7 @@ _m_prefetch(void *__P)
#include <lasxintrin.h> #include <lasxintrin.h>
#define __LASX__ #define __LASX__
#endif #endif
#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) && \ #if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H)
(defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86))
#include <immintrin.h> #include <immintrin.h>
#else #else
#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) #if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H)
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,10 +19,11 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* This is a simple file to encapsulate the EGL API headers. * \file SDL_egl.h
*
* This is a simple file to encapsulate the EGL API headers.
*/ */
#if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) #if !defined(_MSC_VER) && !defined(__ANDROID__) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
#if defined(__vita__) || defined(__psp2__) #if defined(__vita__) || defined(__psp2__)
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryEndian * \file SDL_endian.h
* *
* Functions for reading and writing endian-specific values * Functions for reading and writing endian-specific values
*/ */
#ifndef SDL_endian_h_ #ifndef SDL_endian_h_
@@ -59,15 +59,6 @@ _m_prefetch(void *__P)
#ifdef __linux__ #ifdef __linux__
#include <endian.h> #include <endian.h>
#define SDL_BYTEORDER __BYTE_ORDER #define SDL_BYTEORDER __BYTE_ORDER
#elif defined(__sun) && defined(__SVR4) /* Solaris */
#include <sys/byteorder.h>
#if defined(_LITTLE_ENDIAN)
#define SDL_BYTEORDER SDL_LIL_ENDIAN
#elif defined(_BIG_ENDIAN)
#define SDL_BYTEORDER SDL_BIG_ENDIAN
#else
#error Unsupported endianness
#endif
#elif defined(__OpenBSD__) || defined(__DragonFly__) #elif defined(__OpenBSD__) || defined(__DragonFly__)
#include <endian.h> #include <endian.h>
#define SDL_BYTEORDER BYTE_ORDER #define SDL_BYTEORDER BYTE_ORDER
@@ -88,7 +79,7 @@ _m_prefetch(void *__P)
defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \ defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
(defined(__MIPS__) && defined(__MIPSEB__)) || \ (defined(__MIPS__) && defined(__MIPSEB__)) || \
defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \ defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \
defined(__sparc__) || defined(__sparc) defined(__sparc__)
#define SDL_BYTEORDER SDL_BIG_ENDIAN #define SDL_BYTEORDER SDL_BIG_ENDIAN
#else #else
#define SDL_BYTEORDER SDL_LIL_ENDIAN #define SDL_BYTEORDER SDL_LIL_ENDIAN
@@ -189,16 +180,6 @@ extern __inline Uint16 SDL_Swap16(Uint16);
parm [ax] \ parm [ax] \
modify [ax]; modify [ax];
#else #else
/**
* Use this function to swap the byte order of a 16-bit value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapBE16
* \sa SDL_SwapLE16
*/
SDL_FORCE_INLINE Uint16 SDL_FORCE_INLINE Uint16
SDL_Swap16(Uint16 x) SDL_Swap16(Uint16 x)
{ {
@@ -250,16 +231,6 @@ extern __inline Uint32 SDL_Swap32(Uint32);
parm [eax] \ parm [eax] \
modify [eax]; modify [eax];
#else #else
/**
* Use this function to swap the byte order of a 32-bit value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapBE32
* \sa SDL_SwapLE32
*/
SDL_FORCE_INLINE Uint32 SDL_FORCE_INLINE Uint32
SDL_Swap32(Uint32 x) SDL_Swap32(Uint32 x)
{ {
@@ -305,16 +276,6 @@ extern __inline Uint64 SDL_Swap64(Uint64);
parm [eax edx] \ parm [eax edx] \
modify [eax edx]; modify [eax edx];
#else #else
/**
* Use this function to swap the byte order of a 64-bit value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapBE64
* \sa SDL_SwapLE64
*/
SDL_FORCE_INLINE Uint64 SDL_FORCE_INLINE Uint64
SDL_Swap64(Uint64 x) SDL_Swap64(Uint64 x)
{ {
@@ -332,15 +293,6 @@ SDL_Swap64(Uint64 x)
#endif #endif
/**
* Use this function to swap the byte order of a floating point value.
*
* \param x the value to be swapped.
* \returns the swapped value.
*
* \sa SDL_SwapFloatBE
* \sa SDL_SwapFloatLE
*/
SDL_FORCE_INLINE float SDL_FORCE_INLINE float
SDL_SwapFloat(float x) SDL_SwapFloat(float x)
{ {
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryError * \file SDL_error.h
* *
* Simple error message routines for SDL. * Simple error message routines for SDL.
*/ */
#ifndef SDL_error_h_ #ifndef SDL_error_h_
@@ -53,9 +53,9 @@ extern "C" {
* } * }
* ``` * ```
* *
* \param fmt a printf()-style message format string. * \param fmt a printf()-style message format string
* \param ... additional parameters matching % tokens in the `fmt` string, if * \param ... additional parameters matching % tokens in the `fmt` string, if
* any. * any
* \returns always -1. * \returns always -1.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -109,8 +109,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetError(void);
* otherwise operates exactly the same as SDL_GetError(). * otherwise operates exactly the same as SDL_GetError().
* *
* \param errstr A buffer to fill with the last error message that was set for * \param errstr A buffer to fill with the last error message that was set for
* the current thread. * the current thread
* \param maxlen The size of the buffer pointed to by the errstr parameter. * \param maxlen The size of the buffer pointed to by the errstr parameter
* \returns the pointer passed in as the `errstr` parameter. * \returns the pointer passed in as the `errstr` parameter.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryEvents * \file SDL_events.h
* *
* Include file for SDL event handling. * Include file for SDL event handling.
*/ */
#ifndef SDL_events_h_ #ifndef SDL_events_h_
@@ -52,7 +52,7 @@ extern "C" {
/** /**
* The types of events that can be delivered. * The types of events that can be delivered.
*/ */
typedef enum SDL_EventType typedef enum
{ {
SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */ SDL_FIRSTEVENT = 0, /**< Unused (do not remove) */
@@ -131,8 +131,6 @@ typedef enum SDL_EventType
SDL_CONTROLLERTOUCHPADMOTION, /**< Game controller touchpad finger was moved */ SDL_CONTROLLERTOUCHPADMOTION, /**< Game controller touchpad finger was moved */
SDL_CONTROLLERTOUCHPADUP, /**< Game controller touchpad finger was lifted */ SDL_CONTROLLERTOUCHPADUP, /**< Game controller touchpad finger was lifted */
SDL_CONTROLLERSENSORUPDATE, /**< Game controller sensor was updated */ SDL_CONTROLLERSENSORUPDATE, /**< Game controller sensor was updated */
SDL_CONTROLLERUPDATECOMPLETE_RESERVED_FOR_SDL3,
SDL_CONTROLLERSTEAMHANDLEUPDATED, /**< Game controller Steam handle has changed */
/* Touch events */ /* Touch events */
SDL_FINGERDOWN = 0x700, SDL_FINGERDOWN = 0x700,
@@ -167,7 +165,7 @@ typedef enum SDL_EventType
/* Internal events */ /* Internal events */
SDL_POLLSENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */ SDL_POLLSENTINEL = 0x7F00, /**< Signals the end of an event poll cycle */
/** Events SDL_USEREVENT through SDL_LASTEVENT are for your use, /** Events ::SDL_USEREVENT through ::SDL_LASTEVENT are for your use,
* and should be allocated with SDL_RegisterEvents() * and should be allocated with SDL_RegisterEvents()
*/ */
SDL_USEREVENT = 0x8000, SDL_USEREVENT = 0x8000,
@@ -179,7 +177,7 @@ typedef enum SDL_EventType
} SDL_EventType; } SDL_EventType;
/** /**
* Fields shared by every event * \brief Fields shared by every event
*/ */
typedef struct SDL_CommonEvent typedef struct SDL_CommonEvent
{ {
@@ -188,14 +186,14 @@ typedef struct SDL_CommonEvent
} SDL_CommonEvent; } SDL_CommonEvent;
/** /**
* Display state change event data (event.display.*) * \brief Display state change event data (event.display.*)
*/ */
typedef struct SDL_DisplayEvent typedef struct SDL_DisplayEvent
{ {
Uint32 type; /**< SDL_DISPLAYEVENT */ Uint32 type; /**< ::SDL_DISPLAYEVENT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 display; /**< The associated display index */ Uint32 display; /**< The associated display index */
Uint8 event; /**< SDL_DisplayEventID */ Uint8 event; /**< ::SDL_DisplayEventID */
Uint8 padding1; Uint8 padding1;
Uint8 padding2; Uint8 padding2;
Uint8 padding3; Uint8 padding3;
@@ -203,14 +201,14 @@ typedef struct SDL_DisplayEvent
} SDL_DisplayEvent; } SDL_DisplayEvent;
/** /**
* Window state change event data (event.window.*) * \brief Window state change event data (event.window.*)
*/ */
typedef struct SDL_WindowEvent typedef struct SDL_WindowEvent
{ {
Uint32 type; /**< SDL_WINDOWEVENT */ Uint32 type; /**< ::SDL_WINDOWEVENT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The associated window */ Uint32 windowID; /**< The associated window */
Uint8 event; /**< SDL_WindowEventID */ Uint8 event; /**< ::SDL_WindowEventID */
Uint8 padding1; Uint8 padding1;
Uint8 padding2; Uint8 padding2;
Uint8 padding3; Uint8 padding3;
@@ -219,14 +217,14 @@ typedef struct SDL_WindowEvent
} SDL_WindowEvent; } SDL_WindowEvent;
/** /**
* Keyboard button event structure (event.key.*) * \brief Keyboard button event structure (event.key.*)
*/ */
typedef struct SDL_KeyboardEvent typedef struct SDL_KeyboardEvent
{ {
Uint32 type; /**< SDL_KEYDOWN or SDL_KEYUP */ Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */ Uint32 windowID; /**< The window with keyboard focus, if any */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 repeat; /**< Non-zero if this is a key repeat */ Uint8 repeat; /**< Non-zero if this is a key repeat */
Uint8 padding2; Uint8 padding2;
Uint8 padding3; Uint8 padding3;
@@ -234,13 +232,12 @@ typedef struct SDL_KeyboardEvent
} SDL_KeyboardEvent; } SDL_KeyboardEvent;
#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32) #define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32)
/** /**
* Keyboard text editing event structure (event.edit.*) * \brief Keyboard text editing event structure (event.edit.*)
*/ */
typedef struct SDL_TextEditingEvent typedef struct SDL_TextEditingEvent
{ {
Uint32 type; /**< SDL_TEXTEDITING */ Uint32 type; /**< ::SDL_TEXTEDITING */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */ Uint32 windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */
@@ -249,12 +246,12 @@ typedef struct SDL_TextEditingEvent
} SDL_TextEditingEvent; } SDL_TextEditingEvent;
/** /**
* Extended keyboard text editing event structure (event.editExt.*) when text * \brief Extended keyboard text editing event structure (event.editExt.*) when text would be
* would be truncated if stored in the text buffer SDL_TextEditingEvent * truncated if stored in the text buffer SDL_TextEditingEvent
*/ */
typedef struct SDL_TextEditingExtEvent typedef struct SDL_TextEditingExtEvent
{ {
Uint32 type; /**< SDL_TEXTEDITING_EXT */ Uint32 type; /**< ::SDL_TEXTEDITING_EXT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */ Uint32 windowID; /**< The window with keyboard focus, if any */
char* text; /**< The editing text, which should be freed with SDL_free(), and will not be NULL */ char* text; /**< The editing text, which should be freed with SDL_free(), and will not be NULL */
@@ -262,43 +259,24 @@ typedef struct SDL_TextEditingExtEvent
Sint32 length; /**< The length of selected editing text */ Sint32 length; /**< The length of selected editing text */
} SDL_TextEditingExtEvent; } SDL_TextEditingExtEvent;
/**
* The maximum bytes of text that can be supplied in an SDL_TextInputEvent.
*/
#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32) #define SDL_TEXTINPUTEVENT_TEXT_SIZE (32)
/** /**
* Keyboard text input event structure (event.text.*) * \brief Keyboard text input event structure (event.text.*)
*
* `text` is limited to SDL_TEXTINPUTEVENT_TEXT_SIZE bytes. If the incoming
* string is larger than this, SDL will split it and send it in pieces, across
* multiple events. The string is in UTF-8 format, and if split, SDL
* guarantees that it will not split in the middle of a UTF-8 sequence, so any
* event will only contain complete codepoints. However, if there are several
* codepoints that go together into a single glyph (like an emoji "thumbs up"
* followed by a skin color), they may be split between events.
*
* This event will never be delivered unless text input is enabled by calling
* SDL_StartTextInput(). Text input is enabled by default on desktop
* platforms, and disabled by default on mobile platforms!
*
* \sa SDL_StartTextInput
* \sa SDL_StopTextInput
*/ */
typedef struct SDL_TextInputEvent typedef struct SDL_TextInputEvent
{ {
Uint32 type; /**< SDL_TEXTINPUT */ Uint32 type; /**< ::SDL_TEXTINPUT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with keyboard focus, if any */ Uint32 windowID; /**< The window with keyboard focus, if any */
char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text; UTF-8 encoded. */ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */
} SDL_TextInputEvent; } SDL_TextInputEvent;
/** /**
* Mouse motion event structure (event.motion.*) * \brief Mouse motion event structure (event.motion.*)
*/ */
typedef struct SDL_MouseMotionEvent typedef struct SDL_MouseMotionEvent
{ {
Uint32 type; /**< SDL_MOUSEMOTION */ Uint32 type; /**< ::SDL_MOUSEMOTION */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 windowID; /**< The window with mouse focus, if any */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@@ -310,16 +288,16 @@ typedef struct SDL_MouseMotionEvent
} SDL_MouseMotionEvent; } SDL_MouseMotionEvent;
/** /**
* Mouse button event structure (event.button.*) * \brief Mouse button event structure (event.button.*)
*/ */
typedef struct SDL_MouseButtonEvent typedef struct SDL_MouseButtonEvent
{ {
Uint32 type; /**< SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 windowID; /**< The window with mouse focus, if any */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Uint8 button; /**< The mouse button index */ Uint8 button; /**< The mouse button index */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */ Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */
Uint8 padding1; Uint8 padding1;
Sint32 x; /**< X coordinate, relative to window */ Sint32 x; /**< X coordinate, relative to window */
@@ -327,11 +305,11 @@ typedef struct SDL_MouseButtonEvent
} SDL_MouseButtonEvent; } SDL_MouseButtonEvent;
/** /**
* Mouse wheel event structure (event.wheel.*) * \brief Mouse wheel event structure (event.wheel.*)
*/ */
typedef struct SDL_MouseWheelEvent typedef struct SDL_MouseWheelEvent
{ {
Uint32 type; /**< SDL_MOUSEWHEEL */ Uint32 type; /**< ::SDL_MOUSEWHEEL */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 windowID; /**< The window with mouse focus, if any */
Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
@@ -345,11 +323,11 @@ typedef struct SDL_MouseWheelEvent
} SDL_MouseWheelEvent; } SDL_MouseWheelEvent;
/** /**
* Joystick axis motion event structure (event.jaxis.*) * \brief Joystick axis motion event structure (event.jaxis.*)
*/ */
typedef struct SDL_JoyAxisEvent typedef struct SDL_JoyAxisEvent
{ {
Uint32 type; /**< SDL_JOYAXISMOTION */ Uint32 type; /**< ::SDL_JOYAXISMOTION */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The joystick axis index */ Uint8 axis; /**< The joystick axis index */
@@ -361,11 +339,11 @@ typedef struct SDL_JoyAxisEvent
} SDL_JoyAxisEvent; } SDL_JoyAxisEvent;
/** /**
* Joystick trackball motion event structure (event.jball.*) * \brief Joystick trackball motion event structure (event.jball.*)
*/ */
typedef struct SDL_JoyBallEvent typedef struct SDL_JoyBallEvent
{ {
Uint32 type; /**< SDL_JOYBALLMOTION */ Uint32 type; /**< ::SDL_JOYBALLMOTION */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 ball; /**< The joystick trackball index */ Uint8 ball; /**< The joystick trackball index */
@@ -377,18 +355,18 @@ typedef struct SDL_JoyBallEvent
} SDL_JoyBallEvent; } SDL_JoyBallEvent;
/** /**
* Joystick hat position change event structure (event.jhat.*) * \brief Joystick hat position change event structure (event.jhat.*)
*/ */
typedef struct SDL_JoyHatEvent typedef struct SDL_JoyHatEvent
{ {
Uint32 type; /**< SDL_JOYHATMOTION */ Uint32 type; /**< ::SDL_JOYHATMOTION */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 hat; /**< The joystick hat index */ Uint8 hat; /**< The joystick hat index */
Uint8 value; /**< The hat position value. Uint8 value; /**< The hat position value.
* \sa SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP * \sa ::SDL_HAT_LEFTUP ::SDL_HAT_UP ::SDL_HAT_RIGHTUP
* \sa SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT * \sa ::SDL_HAT_LEFT ::SDL_HAT_CENTERED ::SDL_HAT_RIGHT
* \sa SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN * \sa ::SDL_HAT_LEFTDOWN ::SDL_HAT_DOWN ::SDL_HAT_RIGHTDOWN
* *
* Note that zero means the POV is centered. * Note that zero means the POV is centered.
*/ */
@@ -397,51 +375,46 @@ typedef struct SDL_JoyHatEvent
} SDL_JoyHatEvent; } SDL_JoyHatEvent;
/** /**
* Joystick button event structure (event.jbutton.*) * \brief Joystick button event structure (event.jbutton.*)
*/ */
typedef struct SDL_JoyButtonEvent typedef struct SDL_JoyButtonEvent
{ {
Uint32 type; /**< SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The joystick button index */ Uint8 button; /**< The joystick button index */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1; Uint8 padding1;
Uint8 padding2; Uint8 padding2;
} SDL_JoyButtonEvent; } SDL_JoyButtonEvent;
/** /**
* Joystick device event structure (event.jdevice.*) * \brief Joystick device event structure (event.jdevice.*)
*
* SDL will send JOYSTICK_ADDED events for devices that are already plugged in
* during SDL_Init.
*
* \sa SDL_ControllerDeviceEvent
*/ */
typedef struct SDL_JoyDeviceEvent typedef struct SDL_JoyDeviceEvent
{ {
Uint32 type; /**< SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED */ Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */
} SDL_JoyDeviceEvent; } SDL_JoyDeviceEvent;
/** /**
* Joysick battery level change event structure (event.jbattery.*) * \brief Joysick battery level change event structure (event.jbattery.*)
*/ */
typedef struct SDL_JoyBatteryEvent typedef struct SDL_JoyBatteryEvent
{ {
Uint32 type; /**< SDL_JOYBATTERYUPDATED */ Uint32 type; /**< ::SDL_JOYBATTERYUPDATED */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
SDL_JoystickPowerLevel level; /**< The joystick battery level */ SDL_JoystickPowerLevel level; /**< The joystick battery level */
} SDL_JoyBatteryEvent; } SDL_JoyBatteryEvent;
/** /**
* Game controller axis motion event structure (event.caxis.*) * \brief Game controller axis motion event structure (event.caxis.*)
*/ */
typedef struct SDL_ControllerAxisEvent typedef struct SDL_ControllerAxisEvent
{ {
Uint32 type; /**< SDL_CONTROLLERAXISMOTION */ Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */ Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */
@@ -454,42 +427,36 @@ typedef struct SDL_ControllerAxisEvent
/** /**
* Game controller button event structure (event.cbutton.*) * \brief Game controller button event structure (event.cbutton.*)
*/ */
typedef struct SDL_ControllerButtonEvent typedef struct SDL_ControllerButtonEvent
{ {
Uint32 type; /**< SDL_CONTROLLERBUTTONDOWN or SDL_CONTROLLERBUTTONUP */ Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Uint8 button; /**< The controller button (SDL_GameControllerButton) */ Uint8 button; /**< The controller button (SDL_GameControllerButton) */
Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1; Uint8 padding1;
Uint8 padding2; Uint8 padding2;
} SDL_ControllerButtonEvent; } SDL_ControllerButtonEvent;
/** /**
* Controller device event structure (event.cdevice.*) * \brief Controller device event structure (event.cdevice.*)
*
* Joysticks that are supported game controllers receive both an
* SDL_JoyDeviceEvent and an SDL_ControllerDeviceEvent.
*
* SDL will send CONTROLLERDEVICEADDED events for joysticks that are already
* plugged in during SDL_Init() and are recognized as game controllers.
*/ */
typedef struct SDL_ControllerDeviceEvent typedef struct SDL_ControllerDeviceEvent
{ {
Uint32 type; /**< SDL_CONTROLLERDEVICEADDED, SDL_CONTROLLERDEVICEREMOVED, SDL_CONTROLLERDEVICEREMAPPED, or SDL_CONTROLLERSTEAMHANDLEUPDATED */ Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */
} SDL_ControllerDeviceEvent; } SDL_ControllerDeviceEvent;
/** /**
* Game controller touchpad event structure (event.ctouchpad.*) * \brief Game controller touchpad event structure (event.ctouchpad.*)
*/ */
typedef struct SDL_ControllerTouchpadEvent typedef struct SDL_ControllerTouchpadEvent
{ {
Uint32 type; /**< SDL_CONTROLLERTOUCHPADDOWN or SDL_CONTROLLERTOUCHPADMOTION or SDL_CONTROLLERTOUCHPADUP */ Uint32 type; /**< ::SDL_CONTROLLERTOUCHPADDOWN or ::SDL_CONTROLLERTOUCHPADMOTION or ::SDL_CONTROLLERTOUCHPADUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Sint32 touchpad; /**< The index of the touchpad */ Sint32 touchpad; /**< The index of the touchpad */
@@ -500,24 +467,24 @@ typedef struct SDL_ControllerTouchpadEvent
} SDL_ControllerTouchpadEvent; } SDL_ControllerTouchpadEvent;
/** /**
* Game controller sensor event structure (event.csensor.*) * \brief Game controller sensor event structure (event.csensor.*)
*/ */
typedef struct SDL_ControllerSensorEvent typedef struct SDL_ControllerSensorEvent
{ {
Uint32 type; /**< SDL_CONTROLLERSENSORUPDATE */ Uint32 type; /**< ::SDL_CONTROLLERSENSORUPDATE */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_JoystickID which; /**< The joystick instance id */ SDL_JoystickID which; /**< The joystick instance id */
Sint32 sensor; /**< The type of the sensor, one of the values of SDL_SensorType */ Sint32 sensor; /**< The type of the sensor, one of the values of ::SDL_SensorType */
float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */ float data[3]; /**< Up to 3 values from the sensor, as defined in SDL_sensor.h */
Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */ Uint64 timestamp_us; /**< The timestamp of the sensor reading in microseconds, if the hardware provides this information. */
} SDL_ControllerSensorEvent; } SDL_ControllerSensorEvent;
/** /**
* Audio device event structure (event.adevice.*) * \brief Audio device event structure (event.adevice.*)
*/ */
typedef struct SDL_AudioDeviceEvent typedef struct SDL_AudioDeviceEvent
{ {
Uint32 type; /**< SDL_AUDIODEVICEADDED, or SDL_AUDIODEVICEREMOVED */ Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */ Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */
Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */ Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */
@@ -528,11 +495,11 @@ typedef struct SDL_AudioDeviceEvent
/** /**
* Touch finger event structure (event.tfinger.*) * \brief Touch finger event structure (event.tfinger.*)
*/ */
typedef struct SDL_TouchFingerEvent typedef struct SDL_TouchFingerEvent
{ {
Uint32 type; /**< SDL_FINGERMOTION or SDL_FINGERDOWN or SDL_FINGERUP */ Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */ SDL_TouchID touchId; /**< The touch device id */
SDL_FingerID fingerId; SDL_FingerID fingerId;
@@ -546,11 +513,11 @@ typedef struct SDL_TouchFingerEvent
/** /**
* Multiple Finger Gesture Event (event.mgesture.*) * \brief Multiple Finger Gesture Event (event.mgesture.*)
*/ */
typedef struct SDL_MultiGestureEvent typedef struct SDL_MultiGestureEvent
{ {
Uint32 type; /**< SDL_MULTIGESTURE */ Uint32 type; /**< ::SDL_MULTIGESTURE */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */ SDL_TouchID touchId; /**< The touch device id */
float dTheta; float dTheta;
@@ -563,11 +530,11 @@ typedef struct SDL_MultiGestureEvent
/** /**
* Dollar Gesture Event (event.dgesture.*) * \brief Dollar Gesture Event (event.dgesture.*)
*/ */
typedef struct SDL_DollarGestureEvent typedef struct SDL_DollarGestureEvent
{ {
Uint32 type; /**< SDL_DOLLARGESTURE or SDL_DOLLARRECORD */ Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_TouchID touchId; /**< The touch device id */ SDL_TouchID touchId; /**< The touch device id */
SDL_GestureID gestureId; SDL_GestureID gestureId;
@@ -579,15 +546,13 @@ typedef struct SDL_DollarGestureEvent
/** /**
* An event used to request a file open by the system (event.drop.*) * \brief An event used to request a file open by the system (event.drop.*)
* * This event is enabled by default, you can disable it with SDL_EventState().
* This event is enabled by default, you can disable it with SDL_EventState(). * \note If this event is enabled, you must free the filename in the event.
*
* If this event is enabled, you must free the filename in the event.
*/ */
typedef struct SDL_DropEvent typedef struct SDL_DropEvent
{ {
Uint32 type; /**< SDL_DROPBEGIN or SDL_DROPFILE or SDL_DROPTEXT or SDL_DROPCOMPLETE */ Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */
Uint32 windowID; /**< The window that was dropped on, if any */ Uint32 windowID; /**< The window that was dropped on, if any */
@@ -595,11 +560,11 @@ typedef struct SDL_DropEvent
/** /**
* Sensor event structure (event.sensor.*) * \brief Sensor event structure (event.sensor.*)
*/ */
typedef struct SDL_SensorEvent typedef struct SDL_SensorEvent
{ {
Uint32 type; /**< SDL_SENSORUPDATE */ Uint32 type; /**< ::SDL_SENSORUPDATE */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Sint32 which; /**< The instance ID of the sensor */ Sint32 which; /**< The instance ID of the sensor */
float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */
@@ -607,20 +572,29 @@ typedef struct SDL_SensorEvent
} SDL_SensorEvent; } SDL_SensorEvent;
/** /**
* The "quit requested" event * \brief The "quit requested" event
*/ */
typedef struct SDL_QuitEvent typedef struct SDL_QuitEvent
{ {
Uint32 type; /**< SDL_QUIT */ Uint32 type; /**< ::SDL_QUIT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_QuitEvent; } SDL_QuitEvent;
/** /**
* A user-defined event type (event.user.*) * \brief OS Specific event
*/
typedef struct SDL_OSEvent
{
Uint32 type; /**< ::SDL_QUIT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_OSEvent;
/**
* \brief A user-defined event type (event.user.*)
*/ */
typedef struct SDL_UserEvent typedef struct SDL_UserEvent
{ {
Uint32 type; /**< SDL_USEREVENT through SDL_LASTEVENT-1 */ Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
Uint32 windowID; /**< The associated window if any */ Uint32 windowID; /**< The associated window if any */
Sint32 code; /**< User defined event code */ Sint32 code; /**< User defined event code */
@@ -633,24 +607,20 @@ struct SDL_SysWMmsg;
typedef struct SDL_SysWMmsg SDL_SysWMmsg; typedef struct SDL_SysWMmsg SDL_SysWMmsg;
/** /**
* A video driver dependent system event (event.syswm.*) * \brief A video driver dependent system event (event.syswm.*)
* This event is disabled by default, you can enable it with SDL_EventState()
* *
* This event is disabled by default, you can enable it with SDL_EventState() * \note If you want to use this event, you should include SDL_syswm.h.
*
* If you want to use this event, you should include SDL_syswm.h.
*/ */
typedef struct SDL_SysWMEvent typedef struct SDL_SysWMEvent
{ {
Uint32 type; /**< SDL_SYSWMEVENT */ Uint32 type; /**< ::SDL_SYSWMEVENT */
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */
} SDL_SysWMEvent; } SDL_SysWMEvent;
/** /**
* General event structure * \brief General event structure
*
* The SDL_Event structure is the core of all event handling in SDL. SDL_Event
* is a union of all event structures used in SDL.
*/ */
typedef union SDL_Event typedef union SDL_Event
{ {
@@ -733,7 +703,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NUL
extern DECLSPEC void SDLCALL SDL_PumpEvents(void); extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
/* @{ */ /* @{ */
typedef enum SDL_eventaction typedef enum
{ {
SDL_ADDEVENT, SDL_ADDEVENT,
SDL_PEEKEVENT, SDL_PEEKEVENT,
@@ -760,15 +730,15 @@ typedef enum SDL_eventaction
* *
* This function is thread-safe. * This function is thread-safe.
* *
* \param events destination buffer for the retrieved events. * \param events destination buffer for the retrieved events
* \param numevents if action is SDL_ADDEVENT, the number of events to add * \param numevents if action is SDL_ADDEVENT, the number of events to add
* back to the event queue; if action is SDL_PEEKEVENT or * back to the event queue; if action is SDL_PEEKEVENT or
* SDL_GETEVENT, the maximum number of events to retrieve. * SDL_GETEVENT, the maximum number of events to retrieve
* \param action action to take; see [[#action|Remarks]] for details. * \param action action to take; see [[#action|Remarks]] for details
* \param minType minimum value of the event type to be considered; * \param minType minimum value of the event type to be considered;
* SDL_FIRSTEVENT is a safe choice. * SDL_FIRSTEVENT is a safe choice
* \param maxType maximum value of the event type to be considered; * \param maxType maximum value of the event type to be considered;
* SDL_LASTEVENT is a safe choice. * SDL_LASTEVENT is a safe choice
* \returns the number of events actually stored or a negative error code on * \returns the number of events actually stored or a negative error code on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -789,7 +759,7 @@ extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event * events, int numevents,
* If you need to check for a range of event types, use SDL_HasEvents() * If you need to check for a range of event types, use SDL_HasEvents()
* instead. * instead.
* *
* \param type the type of event to be queried; see SDL_EventType for details. * \param type the type of event to be queried; see SDL_EventType for details
* \returns SDL_TRUE if events matching `type` are present, or SDL_FALSE if * \returns SDL_TRUE if events matching `type` are present, or SDL_FALSE if
* events matching `type` are not present. * events matching `type` are not present.
* *
@@ -806,9 +776,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type);
* If you need to check for a single event type, use SDL_HasEvent() instead. * If you need to check for a single event type, use SDL_HasEvent() instead.
* *
* \param minType the low end of event type to be queried, inclusive; see * \param minType the low end of event type to be queried, inclusive; see
* SDL_EventType for details. * SDL_EventType for details
* \param maxType the high end of event type to be queried, inclusive; see * \param maxType the high end of event type to be queried, inclusive; see
* SDL_EventType for details. * SDL_EventType for details
* \returns SDL_TRUE if events with type >= `minType` and <= `maxType` are * \returns SDL_TRUE if events with type >= `minType` and <= `maxType` are
* present, or SDL_FALSE if not. * present, or SDL_FALSE if not.
* *
@@ -832,7 +802,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType);
* sure that all pending OS events are flushed, you can call SDL_PumpEvents() * sure that all pending OS events are flushed, you can call SDL_PumpEvents()
* on the main thread immediately before the flush call. * on the main thread immediately before the flush call.
* *
* \param type the type of event to be cleared; see SDL_EventType for details. * \param type the type of event to be cleared; see SDL_EventType for details
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -855,9 +825,9 @@ extern DECLSPEC void SDLCALL SDL_FlushEvent(Uint32 type);
* on the main thread immediately before the flush call. * on the main thread immediately before the flush call.
* *
* \param minType the low end of event type to be cleared, inclusive; see * \param minType the low end of event type to be cleared, inclusive; see
* SDL_EventType for details. * SDL_EventType for details
* \param maxType the high end of event type to be cleared, inclusive; see * \param maxType the high end of event type to be cleared, inclusive; see
* SDL_EventType for details. * SDL_EventType for details
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -898,7 +868,7 @@ extern DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType);
* ``` * ```
* *
* \param event the SDL_Event structure to be filled with the next event from * \param event the SDL_Event structure to be filled with the next event from
* the queue, or NULL. * the queue, or NULL
* \returns 1 if there is a pending event or 0 if there are none available. * \returns 1 if there is a pending event or 0 if there are none available.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -922,7 +892,7 @@ extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event * event);
* this function in the thread that initialized the video subsystem. * this function in the thread that initialized the video subsystem.
* *
* \param event the SDL_Event structure to be filled in with the next event * \param event the SDL_Event structure to be filled in with the next event
* from the queue, or NULL. * from the queue, or NULL
* \returns 1 on success or 0 if there was an error while waiting for events; * \returns 1 on success or 0 if there was an error while waiting for events;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -945,9 +915,9 @@ extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event * event);
* this function in the thread that initialized the video subsystem. * this function in the thread that initialized the video subsystem.
* *
* \param event the SDL_Event structure to be filled in with the next event * \param event the SDL_Event structure to be filled in with the next event
* from the queue, or NULL. * from the queue, or NULL
* \param timeout the maximum number of milliseconds to wait for the next * \param timeout the maximum number of milliseconds to wait for the next
* available event. * available event
* \returns 1 on success or 0 if there was an error while waiting for events; * \returns 1 on success or 0 if there was an error while waiting for events;
* call SDL_GetError() for more information. This also returns 0 if * call SDL_GetError() for more information. This also returns 0 if
* the timeout elapsed without an event arriving. * the timeout elapsed without an event arriving.
@@ -982,7 +952,7 @@ extern DECLSPEC int SDLCALL SDL_WaitEventTimeout(SDL_Event * event,
* get an event type that does not conflict with other code that also wants * get an event type that does not conflict with other code that also wants
* its own custom event types. * its own custom event types.
* *
* \param event the SDL_Event to be added to the queue. * \param event the SDL_Event to be added to the queue
* \returns 1 on success, 0 if the event was filtered, or a negative error * \returns 1 on success, 0 if the event was filtered, or a negative error
* code on failure; call SDL_GetError() for more information. A * code on failure; call SDL_GetError() for more information. A
* common reason for error is the event queue being full. * common reason for error is the event queue being full.
@@ -998,11 +968,11 @@ extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event * event);
/** /**
* A function pointer used for callbacks that watch the event queue. * A function pointer used for callbacks that watch the event queue.
* *
* \param userdata what was passed as `userdata` to SDL_SetEventFilter() or * \param userdata what was passed as `userdata` to SDL_SetEventFilter()
* SDL_AddEventWatch, etc. * or SDL_AddEventWatch, etc
* \param event the event that triggered the callback. * \param event the event that triggered the callback
* \returns 1 to permit event to be added to the queue, and 0 to disallow it. * \returns 1 to permit event to be added to the queue, and 0 to disallow
* When used with SDL_AddEventWatch, the return value is ignored. * it. When used with SDL_AddEventWatch, the return value is ignored.
* *
* \sa SDL_SetEventFilter * \sa SDL_SetEventFilter
* \sa SDL_AddEventWatch * \sa SDL_AddEventWatch
@@ -1025,7 +995,7 @@ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
* interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the * interrupt signal (e.g. pressing Ctrl-C), it will be delivered to the
* application at the next event poll. * application at the next event poll.
* *
* There is one caveat when dealing with the SDL_QuitEvent event type. The * There is one caveat when dealing with the ::SDL_QuitEvent event type. The
* event filter is only called when the window manager desires to close the * event filter is only called when the window manager desires to close the
* application window. If the event filter returns 1, then the window will be * application window. If the event filter returns 1, then the window will be
* closed, otherwise the window will remain open if possible. * closed, otherwise the window will remain open if possible.
@@ -1040,8 +1010,8 @@ typedef int (SDLCALL * SDL_EventFilter) (void *userdata, SDL_Event * event);
* the event filter, but events pushed onto the queue with SDL_PeepEvents() do * the event filter, but events pushed onto the queue with SDL_PeepEvents() do
* not. * not.
* *
* \param filter An SDL_EventFilter function to call when an event happens. * \param filter An SDL_EventFilter function to call when an event happens
* \param userdata a pointer that is passed to `filter`. * \param userdata a pointer that is passed to `filter`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1060,9 +1030,9 @@ extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter,
* This function can be used to "chain" filters, by saving the existing filter * This function can be used to "chain" filters, by saving the existing filter
* before replacing it with a function that will call that saved filter. * before replacing it with a function that will call that saved filter.
* *
* \param filter the current callback function will be stored here. * \param filter the current callback function will be stored here
* \param userdata the pointer that is passed to the current event filter will * \param userdata the pointer that is passed to the current event filter will
* be stored here. * be stored here
* \returns SDL_TRUE on success or SDL_FALSE if there is no event filter set. * \returns SDL_TRUE on success or SDL_FALSE if there is no event filter set.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -1091,7 +1061,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter * filter,
* through SDL_PeepEvents(). * through SDL_PeepEvents().
* *
* \param filter an SDL_EventFilter function to call when an event happens. * \param filter an SDL_EventFilter function to call when an event happens.
* \param userdata a pointer that is passed to `filter`. * \param userdata a pointer that is passed to `filter`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1107,8 +1077,8 @@ extern DECLSPEC void SDLCALL SDL_AddEventWatch(SDL_EventFilter filter,
* This function takes the same input as SDL_AddEventWatch() to identify and * This function takes the same input as SDL_AddEventWatch() to identify and
* delete the corresponding callback. * delete the corresponding callback.
* *
* \param filter the function originally passed to SDL_AddEventWatch(). * \param filter the function originally passed to SDL_AddEventWatch()
* \param userdata the pointer originally passed to SDL_AddEventWatch(). * \param userdata the pointer originally passed to SDL_AddEventWatch()
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1125,8 +1095,8 @@ extern DECLSPEC void SDLCALL SDL_DelEventWatch(SDL_EventFilter filter,
* this function does not change the filter permanently, it only uses the * this function does not change the filter permanently, it only uses the
* supplied filter until this function returns. * supplied filter until this function returns.
* *
* \param filter the SDL_EventFilter function to call when an event happens. * \param filter the SDL_EventFilter function to call when an event happens
* \param userdata a pointer that is passed to `filter`. * \param userdata a pointer that is passed to `filter`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1152,8 +1122,8 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter,
* from the event queue and will not be filtered * from the event queue and will not be filtered
* - `SDL_ENABLE`: the event will be processed normally * - `SDL_ENABLE`: the event will be processed normally
* *
* \param type the type of event; see SDL_EventType for details. * \param type the type of event; see SDL_EventType for details
* \param state how to process the event. * \param state how to process the event
* \returns `SDL_DISABLE` or `SDL_ENABLE`, representing the processing state * \returns `SDL_DISABLE` or `SDL_ENABLE`, representing the processing state
* of the event before this function makes any changes to it. * of the event before this function makes any changes to it.
* *
@@ -1175,7 +1145,7 @@ extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint32 type, int state);
* Note, (Uint32)-1 means the maximum unsigned 32-bit integer value (or * Note, (Uint32)-1 means the maximum unsigned 32-bit integer value (or
* 0xFFFFFFFF), but is clearer to write. * 0xFFFFFFFF), but is clearer to write.
* *
* \param numevents the number of events to be allocated. * \param numevents the number of events to be allocated
* \returns the beginning event number, or (Uint32)-1 if there are not enough * \returns the beginning event number, or (Uint32)-1 if there are not enough
* user-defined events left. * user-defined events left.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryFilesystem * \file SDL_filesystem.h
* *
* Include file for filesystem SDL API functions * \brief Include file for filesystem SDL API functions
*/ */
#ifndef SDL_filesystem_h_ #ifndef SDL_filesystem_h_
@@ -64,7 +64,7 @@ extern "C" {
* directory of the application as it is uncommon to store resources outside * directory of the application as it is uncommon to store resources outside
* the executable. As such it is not a writable directory. * the executable. As such it is not a writable directory.
* *
* The returned path is guaranteed to end with a path separator ('\\' on * The returned path is guaranteed to end with a path separator ('\' on
* Windows, '/' on most other platforms). * Windows, '/' on most other platforms).
* *
* The pointer returned is owned by the caller. Please call SDL_free() on the * The pointer returned is owned by the caller. Please call SDL_free() on the
@@ -120,14 +120,14 @@ extern DECLSPEC char *SDLCALL SDL_GetBasePath(void);
* - ...only use letters, numbers, and spaces. Avoid punctuation like "Game * - ...only use letters, numbers, and spaces. Avoid punctuation like "Game
* Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. * Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
* *
* The returned path is guaranteed to end with a path separator ('\\' on * The returned path is guaranteed to end with a path separator ('\' on
* Windows, '/' on most other platforms). * Windows, '/' on most other platforms).
* *
* The pointer returned is owned by the caller. Please call SDL_free() on the * The pointer returned is owned by the caller. Please call SDL_free() on the
* pointer when done with it. * pointer when done with it.
* *
* \param org the name of your organization. * \param org the name of your organization
* \param app the name of your application. * \param app the name of your application
* \returns a UTF-8 string of the user directory in platform-dependent * \returns a UTF-8 string of the user directory in platform-dependent
* notation. NULL if there's a problem (creating directory failed, * notation. NULL if there's a problem (creating directory failed,
* etc.). * etc.).
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,12 +19,10 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: GameController */
/** /**
* # CategoryGameController * \file SDL_gamecontroller.h
* *
* Include file for SDL game controller event handling * Include file for SDL game controller event handling
*/ */
#ifndef SDL_gamecontroller_h_ #ifndef SDL_gamecontroller_h_
@@ -46,7 +44,7 @@ extern "C" {
* \file SDL_gamecontroller.h * \file SDL_gamecontroller.h
* *
* In order to use these functions, SDL_Init() must have been called * In order to use these functions, SDL_Init() must have been called
* with the SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system * with the ::SDL_INIT_GAMECONTROLLER flag. This causes SDL to scan the system
* for game controllers, and load appropriate drivers. * for game controllers, and load appropriate drivers.
* *
* If you would like to receive controller updates while the application * If you would like to receive controller updates while the application
@@ -60,7 +58,7 @@ extern "C" {
struct _SDL_GameController; struct _SDL_GameController;
typedef struct _SDL_GameController SDL_GameController; typedef struct _SDL_GameController SDL_GameController;
typedef enum SDL_GameControllerType typedef enum
{ {
SDL_CONTROLLER_TYPE_UNKNOWN = 0, SDL_CONTROLLER_TYPE_UNKNOWN = 0,
SDL_CONTROLLER_TYPE_XBOX360, SDL_CONTROLLER_TYPE_XBOX360,
@@ -75,11 +73,10 @@ typedef enum SDL_GameControllerType
SDL_CONTROLLER_TYPE_NVIDIA_SHIELD, SDL_CONTROLLER_TYPE_NVIDIA_SHIELD,
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT,
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT,
SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR
SDL_CONTROLLER_TYPE_MAX
} SDL_GameControllerType; } SDL_GameControllerType;
typedef enum SDL_GameControllerBindType typedef enum
{ {
SDL_CONTROLLER_BINDTYPE_NONE = 0, SDL_CONTROLLER_BINDTYPE_NONE = 0,
SDL_CONTROLLER_BINDTYPE_BUTTON, SDL_CONTROLLER_BINDTYPE_BUTTON,
@@ -88,7 +85,7 @@ typedef enum SDL_GameControllerBindType
} SDL_GameControllerBindType; } SDL_GameControllerBindType;
/** /**
* Get the SDL joystick layer binding for this controller button/axis mapping * Get the SDL joystick layer binding for this controller button/axis mapping
*/ */
typedef struct SDL_GameControllerButtonBind typedef struct SDL_GameControllerButtonBind
{ {
@@ -146,10 +143,6 @@ typedef struct SDL_GameControllerButtonBind
* If a new mapping is loaded for an already known controller GUID, the later * If a new mapping is loaded for an already known controller GUID, the later
* version will overwrite the one currently loaded. * version will overwrite the one currently loaded.
* *
* If this function is called before SDL_Init, SDL will generate an
* SDL_CONTROLLERDEVICEADDED event for matching controllers that are plugged
* in at the time that SDL_Init is called.
*
* Mappings not belonging to the current platform or with no platform field * Mappings not belonging to the current platform or with no platform field
* specified will be ignored (i.e. mappings for Linux will be ignored in * specified will be ignored (i.e. mappings for Linux will be ignored in
* Windows, etc). * Windows, etc).
@@ -158,8 +151,8 @@ typedef struct SDL_GameControllerButtonBind
* processing it, so take this into consideration if you are in a memory * processing it, so take this into consideration if you are in a memory
* constrained environment. * constrained environment.
* *
* \param rw the data stream for the mappings to be added. * \param rw the data stream for the mappings to be added
* \param freerw non-zero to close the stream after being read. * \param freerw non-zero to close the stream after being read
* \returns the number of mappings added or -1 on error; call SDL_GetError() * \returns the number of mappings added or -1 on error; call SDL_GetError()
* for more information. * for more information.
* *
@@ -168,15 +161,13 @@ typedef struct SDL_GameControllerButtonBind
* \sa SDL_GameControllerAddMapping * \sa SDL_GameControllerAddMapping
* \sa SDL_GameControllerAddMappingsFromFile * \sa SDL_GameControllerAddMappingsFromFile
* \sa SDL_GameControllerMappingForGUID * \sa SDL_GameControllerMappingForGUID
* \sa SDL_CONTROLLERDEVICEADDED
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw); extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw);
/** /**
* Load a set of mappings from a file, filtered by the current * Load a set of mappings from a file, filtered by the current SDL_GetPlatform()
* SDL_GetPlatform()
* *
* Convenience macro. * Convenience macro.
*/ */
#define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1) #define SDL_GameControllerAddMappingsFromFile(file) SDL_GameControllerAddMappingsFromRW(SDL_RWFromFile(file, "rb"), 1)
@@ -198,11 +189,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw,
* "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7" * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7"
* ``` * ```
* *
* If this function is called before SDL_Init, SDL will generate an * \param mappingString the mapping string
* SDL_CONTROLLERDEVICEADDED event for matching controllers that are plugged
* in at the time that SDL_Init is called.
*
* \param mappingString the mapping string.
* \returns 1 if a new mapping is added, 0 if an existing mapping is updated, * \returns 1 if a new mapping is added, 0 if an existing mapping is updated,
* -1 on error; call SDL_GetError() for more information. * -1 on error; call SDL_GetError() for more information.
* *
@@ -210,7 +197,6 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw,
* *
* \sa SDL_GameControllerMapping * \sa SDL_GameControllerMapping
* \sa SDL_GameControllerMappingForGUID * \sa SDL_GameControllerMappingForGUID
* \sa SDL_CONTROLLERDEVICEADDED
*/ */
extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString); extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString);
@@ -238,7 +224,7 @@ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_ind
* *
* The returned string must be freed with SDL_free(). * The returned string must be freed with SDL_free().
* *
* \param guid a structure containing the GUID for which a mapping is desired. * \param guid a structure containing the GUID for which a mapping is desired
* \returns a mapping string or NULL on error; call SDL_GetError() for more * \returns a mapping string or NULL on error; call SDL_GetError() for more
* information. * information.
* *
@@ -257,7 +243,7 @@ extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID
* Details about mappings are discussed with SDL_GameControllerAddMapping(). * Details about mappings are discussed with SDL_GameControllerAddMapping().
* *
* \param gamecontroller the game controller you want to get the current * \param gamecontroller the game controller you want to get the current
* mapping for. * mapping for
* \returns a string that has the controller's mapping or NULL if no mapping * \returns a string that has the controller's mapping or NULL if no mapping
* is available; call SDL_GetError() for more information. * is available; call SDL_GetError() for more information.
* *
@@ -275,7 +261,7 @@ extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController *gam
* SDL_JoystickOpen(). * SDL_JoystickOpen().
* *
* \param joystick_index the device_index of a device, up to * \param joystick_index the device_index of a device, up to
* SDL_NumJoysticks(). * SDL_NumJoysticks()
* \returns SDL_TRUE if the given joystick is supported by the game controller * \returns SDL_TRUE if the given joystick is supported by the game controller
* interface, SDL_FALSE if it isn't or it's an invalid index. * interface, SDL_FALSE if it isn't or it's an invalid index.
* *
@@ -295,7 +281,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index);
* SDL_JoystickOpen(). * SDL_JoystickOpen().
* *
* \param joystick_index the device_index of a device, from zero to * \param joystick_index the device_index of a device, from zero to
* SDL_NumJoysticks()-1. * SDL_NumJoysticks()-1
* \returns the implementation-dependent name for the game controller, or NULL * \returns the implementation-dependent name for the game controller, or NULL
* if there is no name or the index is invalid. * if there is no name or the index is invalid.
* *
@@ -316,7 +302,7 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_
* SDL_JoystickOpen(). * SDL_JoystickOpen().
* *
* \param joystick_index the device_index of a device, from zero to * \param joystick_index the device_index of a device, from zero to
* SDL_NumJoysticks()-1. * SDL_NumJoysticks()-1
* \returns the implementation-dependent path for the game controller, or NULL * \returns the implementation-dependent path for the game controller, or NULL
* if there is no path or the index is invalid. * if there is no path or the index is invalid.
* *
@@ -332,7 +318,7 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerPathForIndex(int joystick_
* This can be called before any controllers are opened. * This can be called before any controllers are opened.
* *
* \param joystick_index the device_index of a device, from zero to * \param joystick_index the device_index of a device, from zero to
* SDL_NumJoysticks()-1. * SDL_NumJoysticks()-1
* \returns the controller type. * \returns the controller type.
* *
* \since This function is available since SDL 2.0.12. * \since This function is available since SDL 2.0.12.
@@ -345,7 +331,7 @@ extern DECLSPEC SDL_GameControllerType SDLCALL SDL_GameControllerTypeForIndex(in
* This can be called before any controllers are opened. * This can be called before any controllers are opened.
* *
* \param joystick_index the device_index of a device, from zero to * \param joystick_index the device_index of a device, from zero to
* SDL_NumJoysticks()-1. * SDL_NumJoysticks()-1
* \returns the mapping string. Must be freed with SDL_free(). Returns NULL if * \returns the mapping string. Must be freed with SDL_free(). Returns NULL if
* no mapping is available. * no mapping is available.
* *
@@ -365,7 +351,7 @@ extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joysti
* be used there instead. * be used there instead.
* *
* \param joystick_index the device_index of a device, up to * \param joystick_index the device_index of a device, up to
* SDL_NumJoysticks(). * SDL_NumJoysticks()
* \returns a gamecontroller identifier or NULL if an error occurred; call * \returns a gamecontroller identifier or NULL if an error occurred; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -380,7 +366,7 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerOpen(int joystick_
/** /**
* Get the SDL_GameController associated with an instance id. * Get the SDL_GameController associated with an instance id.
* *
* \param joyid the instance id to get the SDL_GameController for. * \param joyid the instance id to get the SDL_GameController for
* \returns an SDL_GameController on success or NULL on failure; call * \returns an SDL_GameController on success or NULL on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -412,7 +398,7 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromPlayerIndex(in
* it takes a controller identifier instead of the (unstable) device index. * it takes a controller identifier instead of the (unstable) device index.
* *
* \param gamecontroller a game controller identifier previously returned by * \param gamecontroller a game controller identifier previously returned by
* SDL_GameControllerOpen(). * SDL_GameControllerOpen()
* \returns the implementation dependent name for the game controller, or NULL * \returns the implementation dependent name for the game controller, or NULL
* if there is no name or the identifier passed is invalid. * if there is no name or the identifier passed is invalid.
* *
@@ -430,7 +416,7 @@ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *g
* it takes a controller identifier instead of the (unstable) device index. * it takes a controller identifier instead of the (unstable) device index.
* *
* \param gamecontroller a game controller identifier previously returned by * \param gamecontroller a game controller identifier previously returned by
* SDL_GameControllerOpen(). * SDL_GameControllerOpen()
* \returns the implementation dependent path for the game controller, or NULL * \returns the implementation dependent path for the game controller, or NULL
* if there is no path or the identifier passed is invalid. * if there is no path or the identifier passed is invalid.
* *
@@ -537,25 +523,11 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameCont
*/ */
extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller); extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller);
/**
* Get the Steam Input handle of an opened controller, if available.
*
* Returns an InputHandle_t for the controller that can be used with Steam
* Input API: https://partner.steamgames.com/doc/api/ISteamInput
*
* \param gamecontroller the game controller object to query.
* \returns the gamepad handle, or 0 if unavailable.
*
* \since This function is available since SDL 2.30.0.
*/
extern DECLSPEC Uint64 SDLCALL SDL_GameControllerGetSteamHandle(SDL_GameController *gamecontroller);
/** /**
* Check if a controller has been opened and is currently connected. * Check if a controller has been opened and is currently connected.
* *
* \param gamecontroller a game controller identifier previously returned by * \param gamecontroller a game controller identifier previously returned by
* SDL_GameControllerOpen(). * SDL_GameControllerOpen()
* \returns SDL_TRUE if the controller has been opened and is currently * \returns SDL_TRUE if the controller has been opened and is currently
* connected, or SDL_FALSE if not. * connected, or SDL_FALSE if not.
* *
@@ -580,7 +552,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerGetAttached(SDL_GameControlle
* cause SDL to crash. * cause SDL to crash.
* *
* \param gamecontroller the game controller object that you want to get a * \param gamecontroller the game controller object that you want to get a
* joystick from. * joystick from
* \returns a SDL_Joystick object; call SDL_GetError() for more information. * \returns a SDL_Joystick object; call SDL_GetError() for more information.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -597,7 +569,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_GameControllerGetJoystick(SDL_GameCont
* Any number can be passed to SDL_GameControllerEventState(), but only -1, 0, * Any number can be passed to SDL_GameControllerEventState(), but only -1, 0,
* and 1 will have any effect. Other numbers will just be returned. * and 1 will have any effect. Other numbers will just be returned.
* *
* \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`. * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`
* \returns the same value passed to the function, with exception to -1 * \returns the same value passed to the function, with exception to -1
* (SDL_QUERY), which will return the current state. * (SDL_QUERY), which will return the current state.
* *
@@ -620,19 +592,15 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
/** /**
* The list of axes available from a controller * The list of axes available from a controller
* *
* Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX,
* SDL_JOYSTICK_AXIS_MAX, and are centered within ~8000 of zero, though * and are centered within ~8000 of zero, though advanced UI will allow users to set
* advanced UI will allow users to set or autodetect the dead zone, which * or autodetect the dead zone, which varies between controllers.
* varies between controllers.
* *
* Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX (fully * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
* pressed) when reported by SDL_GameControllerGetAxis(). Note that this is
* not the same range that will be reported by the lower-level
* SDL_GetJoystickAxis().
*/ */
typedef enum SDL_GameControllerAxis typedef enum
{ {
SDL_CONTROLLER_AXIS_INVALID = -1, SDL_CONTROLLER_AXIS_INVALID = -1,
SDL_CONTROLLER_AXIS_LEFTX, SDL_CONTROLLER_AXIS_LEFTX,
@@ -656,7 +624,7 @@ typedef enum SDL_GameControllerAxis
* `SDL_CONTROLLER_AXIS_TRIGGERRIGHT` and `SDL_CONTROLLER_AXIS_TRIGGERLEFT`, * `SDL_CONTROLLER_AXIS_TRIGGERRIGHT` and `SDL_CONTROLLER_AXIS_TRIGGERLEFT`,
* respectively. * respectively.
* *
* \param str string representing a SDL_GameController axis. * \param str string representing a SDL_GameController axis
* \returns the SDL_GameControllerAxis enum corresponding to the input string, * \returns the SDL_GameControllerAxis enum corresponding to the input string,
* or `SDL_CONTROLLER_AXIS_INVALID` if no match was found. * or `SDL_CONTROLLER_AXIS_INVALID` if no match was found.
* *
@@ -671,7 +639,7 @@ extern DECLSPEC SDL_GameControllerAxis SDLCALL SDL_GameControllerGetAxisFromStri
* *
* The caller should not SDL_free() the returned string. * The caller should not SDL_free() the returned string.
* *
* \param axis an enum value for a given SDL_GameControllerAxis. * \param axis an enum value for a given SDL_GameControllerAxis
* \returns a string for the given axis, or NULL if an invalid axis is * \returns a string for the given axis, or NULL if an invalid axis is
* specified. The string returned is of the format used by * specified. The string returned is of the format used by
* SDL_GameController mapping strings. * SDL_GameController mapping strings.
@@ -685,8 +653,8 @@ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForAxis(SDL_GameC
/** /**
* Get the SDL joystick layer binding for a controller axis mapping. * Get the SDL joystick layer binding for a controller axis mapping.
* *
* \param gamecontroller a game controller. * \param gamecontroller a game controller
* \param axis an axis enum value (one of the SDL_GameControllerAxis values). * \param axis an axis enum value (one of the SDL_GameControllerAxis values)
* \returns a SDL_GameControllerButtonBind describing the bind. On failure * \returns a SDL_GameControllerButtonBind describing the bind. On failure
* (like the given Controller axis doesn't exist on the device), its * (like the given Controller axis doesn't exist on the device), its
* `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`. * `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`.
@@ -705,8 +673,8 @@ SDL_GameControllerGetBindForAxis(SDL_GameController *gamecontroller,
* This merely reports whether the controller's mapping defined this axis, as * This merely reports whether the controller's mapping defined this axis, as
* that is all the information SDL has about the physical device. * that is all the information SDL has about the physical device.
* *
* \param gamecontroller a game controller. * \param gamecontroller a game controller
* \param axis an axis enum value (an SDL_GameControllerAxis value). * \param axis an axis enum value (an SDL_GameControllerAxis value)
* \returns SDL_TRUE if the controller has this axis, SDL_FALSE otherwise. * \returns SDL_TRUE if the controller has this axis, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -719,15 +687,11 @@ SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameController
* *
* The axis indices start at index 0. * The axis indices start at index 0.
* *
* For thumbsticks, the state is a value ranging from -32768 (up/left) to * The state is a value ranging from -32768 to 32767. Triggers, however, range
* 32767 (down/right). * from 0 to 32767 (they never return a negative value).
* *
* Triggers range from 0 when released to 32767 when fully pressed, and never * \param gamecontroller a game controller
* return a negative value. Note that this differs from the value reported by * \param axis an axis index (one of the SDL_GameControllerAxis values)
* the lower-level SDL_JoystickGetAxis(), which normally uses the full range.
*
* \param gamecontroller a game controller.
* \param axis an axis index (one of the SDL_GameControllerAxis values).
* \returns axis state (including 0) on success or 0 (also) on failure; call * \returns axis state (including 0) on success or 0 (also) on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -739,9 +703,9 @@ extern DECLSPEC Sint16 SDLCALL
SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis); SDL_GameControllerGetAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis);
/** /**
* The list of buttons available from a controller * The list of buttons available from a controller
*/ */
typedef enum SDL_GameControllerButton typedef enum
{ {
SDL_CONTROLLER_BUTTON_INVALID = -1, SDL_CONTROLLER_BUTTON_INVALID = -1,
SDL_CONTROLLER_BUTTON_A, SDL_CONTROLLER_BUTTON_A,
@@ -776,7 +740,7 @@ typedef enum SDL_GameControllerButton
* SDL_GameController mapping. You do not normally need to call this function * SDL_GameController mapping. You do not normally need to call this function
* unless you are parsing SDL_GameController mappings in your own code. * unless you are parsing SDL_GameController mappings in your own code.
* *
* \param str string representing a SDL_GameController axis. * \param str string representing a SDL_GameController axis
* \returns the SDL_GameControllerButton enum corresponding to the input * \returns the SDL_GameControllerButton enum corresponding to the input
* string, or `SDL_CONTROLLER_AXIS_INVALID` if no match was found. * string, or `SDL_CONTROLLER_AXIS_INVALID` if no match was found.
* *
@@ -789,7 +753,7 @@ extern DECLSPEC SDL_GameControllerButton SDLCALL SDL_GameControllerGetButtonFrom
* *
* The caller should not SDL_free() the returned string. * The caller should not SDL_free() the returned string.
* *
* \param button an enum value for a given SDL_GameControllerButton. * \param button an enum value for a given SDL_GameControllerButton
* \returns a string for the given button, or NULL if an invalid button is * \returns a string for the given button, or NULL if an invalid button is
* specified. The string returned is of the format used by * specified. The string returned is of the format used by
* SDL_GameController mapping strings. * SDL_GameController mapping strings.
@@ -803,8 +767,8 @@ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetStringForButton(SDL_Gam
/** /**
* Get the SDL joystick layer binding for a controller button mapping. * Get the SDL joystick layer binding for a controller button mapping.
* *
* \param gamecontroller a game controller. * \param gamecontroller a game controller
* \param button an button enum value (an SDL_GameControllerButton value). * \param button an button enum value (an SDL_GameControllerButton value)
* \returns a SDL_GameControllerButtonBind describing the bind. On failure * \returns a SDL_GameControllerButtonBind describing the bind. On failure
* (like the given Controller button doesn't exist on the device), * (like the given Controller button doesn't exist on the device),
* its `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`. * its `.bindType` will be `SDL_CONTROLLER_BINDTYPE_NONE`.
@@ -823,8 +787,8 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller,
* This merely reports whether the controller's mapping defined this button, * This merely reports whether the controller's mapping defined this button,
* as that is all the information SDL has about the physical device. * as that is all the information SDL has about the physical device.
* *
* \param gamecontroller a game controller. * \param gamecontroller a game controller
* \param button a button enum value (an SDL_GameControllerButton value). * \param button a button enum value (an SDL_GameControllerButton value)
* \returns SDL_TRUE if the controller has this button, SDL_FALSE otherwise. * \returns SDL_TRUE if the controller has this button, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -835,8 +799,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasButton(SDL_GameController
/** /**
* Get the current state of a button on a game controller. * Get the current state of a button on a game controller.
* *
* \param gamecontroller a game controller. * \param gamecontroller a game controller
* \param button a button index (one of the SDL_GameControllerButton values). * \param button a button index (one of the SDL_GameControllerButton values)
* \returns 1 for pressed state or 0 for not pressed state or error; call * \returns 1 for pressed state or 0 for not pressed state or error; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -872,8 +836,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetTouchpadFinger(SDL_GameControll
/** /**
* Return whether a game controller has a particular sensor. * Return whether a game controller has a particular sensor.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \param type The type of sensor to query. * \param type The type of sensor to query
* \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise. * \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -883,9 +847,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasSensor(SDL_GameController
/** /**
* Set whether data reporting for a game controller sensor is enabled. * Set whether data reporting for a game controller sensor is enabled.
* *
* \param gamecontroller The controller to update. * \param gamecontroller The controller to update
* \param type The type of sensor to enable/disable. * \param type The type of sensor to enable/disable
* \param enabled Whether data reporting should be enabled. * \param enabled Whether data reporting should be enabled
* \returns 0 or -1 if an error occurred. * \returns 0 or -1 if an error occurred.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -895,8 +859,8 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSetSensorEnabled(SDL_GameControlle
/** /**
* Query whether sensor data reporting is enabled for a game controller. * Query whether sensor data reporting is enabled for a game controller.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \param type The type of sensor to query. * \param type The type of sensor to query
* \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise. * \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -907,8 +871,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerIsSensorEnabled(SDL_GameContr
* Get the data rate (number of events per second) of a game controller * Get the data rate (number of events per second) of a game controller
* sensor. * sensor.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \param type The type of sensor to query. * \param type The type of sensor to query
* \return the data rate, or 0.0f if the data rate is not available. * \return the data rate, or 0.0f if the data rate is not available.
* *
* \since This function is available since SDL 2.0.16. * \since This function is available since SDL 2.0.16.
@@ -921,10 +885,10 @@ extern DECLSPEC float SDLCALL SDL_GameControllerGetSensorDataRate(SDL_GameContro
* The number of values and interpretation of the data is sensor dependent. * The number of values and interpretation of the data is sensor dependent.
* See SDL_sensor.h for the details for each type of sensor. * See SDL_sensor.h for the details for each type of sensor.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \param type The type of sensor to query. * \param type The type of sensor to query
* \param data A pointer filled with the current sensor state. * \param data A pointer filled with the current sensor state
* \param num_values The number of values to write to data. * \param num_values The number of values to write to data
* \return 0 or -1 if an error occurred. * \return 0 or -1 if an error occurred.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -938,12 +902,12 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorData(SDL_GameController *
* The number of values and interpretation of the data is sensor dependent. * The number of values and interpretation of the data is sensor dependent.
* See SDL_sensor.h for the details for each type of sensor. * See SDL_sensor.h for the details for each type of sensor.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \param type The type of sensor to query. * \param type The type of sensor to query
* \param timestamp A pointer filled with the timestamp in microseconds of the * \param timestamp A pointer filled with the timestamp in microseconds of the
* current sensor reading if available, or 0 if not. * current sensor reading if available, or 0 if not
* \param data A pointer filled with the current sensor state. * \param data A pointer filled with the current sensor state
* \param num_values The number of values to write to data. * \param num_values The number of values to write to data
* \return 0 or -1 if an error occurred. * \return 0 or -1 if an error occurred.
* *
* \since This function is available since SDL 2.26.0. * \since This function is available since SDL 2.26.0.
@@ -956,13 +920,13 @@ extern DECLSPEC int SDLCALL SDL_GameControllerGetSensorDataWithTimestamp(SDL_Gam
* Each call to this function cancels any previous rumble effect, and calling * Each call to this function cancels any previous rumble effect, and calling
* it with 0 intensity stops any rumbling. * it with 0 intensity stops any rumbling.
* *
* \param gamecontroller The controller to vibrate. * \param gamecontroller The controller to vibrate
* \param low_frequency_rumble The intensity of the low frequency (left) * \param low_frequency_rumble The intensity of the low frequency (left)
* rumble motor, from 0 to 0xFFFF. * rumble motor, from 0 to 0xFFFF
* \param high_frequency_rumble The intensity of the high frequency (right) * \param high_frequency_rumble The intensity of the high frequency (right)
* rumble motor, from 0 to 0xFFFF. * rumble motor, from 0 to 0xFFFF
* \param duration_ms The duration of the rumble effect, in milliseconds. * \param duration_ms The duration of the rumble effect, in milliseconds
* \returns 0, or -1 if rumble isn't supported on this controller. * \returns 0, or -1 if rumble isn't supported on this controller
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
* *
@@ -981,13 +945,13 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecon
* want the (more common) whole-controller rumble, use * want the (more common) whole-controller rumble, use
* SDL_GameControllerRumble() instead. * SDL_GameControllerRumble() instead.
* *
* \param gamecontroller The controller to vibrate. * \param gamecontroller The controller to vibrate
* \param left_rumble The intensity of the left trigger rumble motor, from 0 * \param left_rumble The intensity of the left trigger rumble motor, from 0
* to 0xFFFF. * to 0xFFFF
* \param right_rumble The intensity of the right trigger rumble motor, from 0 * \param right_rumble The intensity of the right trigger rumble motor, from 0
* to 0xFFFF. * to 0xFFFF
* \param duration_ms The duration of the rumble effect, in milliseconds. * \param duration_ms The duration of the rumble effect, in milliseconds
* \returns 0, or -1 if trigger rumble isn't supported on this controller. * \returns 0, or -1 if trigger rumble isn't supported on this controller
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
* *
@@ -998,9 +962,9 @@ extern DECLSPEC int SDLCALL SDL_GameControllerRumbleTriggers(SDL_GameController
/** /**
* Query whether a game controller has an LED. * Query whether a game controller has an LED.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \returns SDL_TRUE, or SDL_FALSE if this controller does not have a * \returns SDL_TRUE, or SDL_FALSE if this controller does not have a
* modifiable LED. * modifiable LED
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
@@ -1009,9 +973,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasLED(SDL_GameController *ga
/** /**
* Query whether a game controller has rumble support. * Query whether a game controller has rumble support.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \returns SDL_TRUE, or SDL_FALSE if this controller does not have rumble * \returns SDL_TRUE, or SDL_FALSE if this controller does not have rumble
* support. * support
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
* *
@@ -1022,9 +986,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumble(SDL_GameController
/** /**
* Query whether a game controller has rumble support on triggers. * Query whether a game controller has rumble support on triggers.
* *
* \param gamecontroller The controller to query. * \param gamecontroller The controller to query
* \returns SDL_TRUE, or SDL_FALSE if this controller does not have trigger * \returns SDL_TRUE, or SDL_FALSE if this controller does not have trigger
* rumble support. * rumble support
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
* *
@@ -1035,11 +999,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GameControllerHasRumbleTriggers(SDL_GameCon
/** /**
* Update a game controller's LED color. * Update a game controller's LED color.
* *
* \param gamecontroller The controller to update. * \param gamecontroller The controller to update
* \param red The intensity of the red LED. * \param red The intensity of the red LED
* \param green The intensity of the green LED. * \param green The intensity of the green LED
* \param blue The intensity of the blue LED. * \param blue The intensity of the blue LED
* \returns 0, or -1 if this controller does not have a modifiable LED. * \returns 0, or -1 if this controller does not have a modifiable LED
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
@@ -1048,11 +1012,11 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSetLED(SDL_GameController *gamecon
/** /**
* Send a controller specific effect packet * Send a controller specific effect packet
* *
* \param gamecontroller The controller to affect. * \param gamecontroller The controller to affect
* \param data The data to send to the controller. * \param data The data to send to the controller
* \param size The size of the data to send to the controller. * \param size The size of the data to send to the controller
* \returns 0, or -1 if this controller or driver doesn't support effect * \returns 0, or -1 if this controller or driver doesn't support effect
* packets. * packets
* *
* \since This function is available since SDL 2.0.16. * \since This function is available since SDL 2.0.16.
*/ */
@@ -1062,7 +1026,7 @@ extern DECLSPEC int SDLCALL SDL_GameControllerSendEffect(SDL_GameController *gam
* Close a game controller previously opened with SDL_GameControllerOpen(). * Close a game controller previously opened with SDL_GameControllerOpen().
* *
* \param gamecontroller a game controller identifier previously returned by * \param gamecontroller a game controller identifier previously returned by
* SDL_GameControllerOpen(). * SDL_GameControllerOpen()
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1074,9 +1038,9 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon
* Return the sfSymbolsName for a given button on a game controller on Apple * Return the sfSymbolsName for a given button on a game controller on Apple
* platforms. * platforms.
* *
* \param gamecontroller the controller to query. * \param gamecontroller the controller to query
* \param button a button on the game controller. * \param button a button on the game controller
* \returns the sfSymbolsName or NULL if the name can't be found. * \returns the sfSymbolsName or NULL if the name can't be found
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
* *
@@ -1088,9 +1052,9 @@ extern DECLSPEC const char* SDLCALL SDL_GameControllerGetAppleSFSymbolsNameForBu
* Return the sfSymbolsName for a given axis on a game controller on Apple * Return the sfSymbolsName for a given axis on a game controller on Apple
* platforms. * platforms.
* *
* \param gamecontroller the controller to query. * \param gamecontroller the controller to query
* \param axis an axis on the game controller. * \param axis an axis on the game controller
* \returns the sfSymbolsName or NULL if the name can't be found. * \returns the sfSymbolsName or NULL if the name can't be found
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryGesture * \file SDL_gesture.h
* *
* Include file for SDL gesture event handling. * Include file for SDL gesture event handling.
*/ */
#ifndef SDL_gesture_h_ #ifndef SDL_gesture_h_
@@ -51,7 +51,7 @@ typedef Sint64 SDL_GestureID;
* If the parameter `touchId` is -1 (i.e., all devices), this function will * If the parameter `touchId` is -1 (i.e., all devices), this function will
* always return 1, regardless of whether there actually are any devices. * always return 1, regardless of whether there actually are any devices.
* *
* \param touchId the touch device id, or -1 for all touch devices. * \param touchId the touch device id, or -1 for all touch devices
* \returns 1 on success or 0 if the specified device could not be found. * \returns 1 on success or 0 if the specified device could not be found.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -64,7 +64,7 @@ extern DECLSPEC int SDLCALL SDL_RecordGesture(SDL_TouchID touchId);
/** /**
* Save all currently loaded Dollar Gesture templates. * Save all currently loaded Dollar Gesture templates.
* *
* \param dst a SDL_RWops to save to. * \param dst a SDL_RWops to save to
* \returns the number of saved templates on success or 0 on failure; call * \returns the number of saved templates on success or 0 on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -78,8 +78,8 @@ extern DECLSPEC int SDLCALL SDL_SaveAllDollarTemplates(SDL_RWops *dst);
/** /**
* Save a currently loaded Dollar Gesture template. * Save a currently loaded Dollar Gesture template.
* *
* \param gestureId a gesture id. * \param gestureId a gesture id
* \param dst a SDL_RWops to save to. * \param dst a SDL_RWops to save to
* \returns 1 on success or 0 on failure; call SDL_GetError() for more * \returns 1 on success or 0 on failure; call SDL_GetError() for more
* information. * information.
* *
@@ -94,8 +94,8 @@ extern DECLSPEC int SDLCALL SDL_SaveDollarTemplate(SDL_GestureID gestureId,SDL_R
/** /**
* Load Dollar Gesture templates from a file. * Load Dollar Gesture templates from a file.
* *
* \param touchId a touch id. * \param touchId a touch id
* \param src a SDL_RWops to load from. * \param src a SDL_RWops to load from
* \returns the number of loaded templates on success or a negative error code * \returns the number of loaded templates on success or a negative error code
* (or 0) on failure; call SDL_GetError() for more information. * (or 0) on failure; call SDL_GetError() for more information.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,13 +19,10 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: GUID */
/** /**
* # CategoryGUID * \file SDL_guid.h
* *
* A GUID is a 128-bit value that represents something that is uniquely * Include file for handling ::SDL_GUID values.
* identifiable by this value: "globally unique."
*/ */
#ifndef SDL_guid_h_ #ifndef SDL_guid_h_
@@ -41,38 +38,34 @@ extern "C" {
#endif #endif
/** /**
* An SDL_GUID is a 128-bit identifier. * An SDL_GUID is a 128-bit identifier for an input device that
* identifies that device across runs of SDL programs on the same
* platform. If the device is detached and then re-attached to a
* different port, or if the base system is rebooted, the device
* should still report the same GUID.
* *
* This is an acronym for "Globally Unique ID." * GUIDs are as precise as possible but are not guaranteed to
* distinguish physically distinct but equivalent devices. For
* example, two game controllers from the same vendor with the same
* product ID and revision may have the same GUID.
* *
* While a GUID can be used to assign a unique value to almost anything, in * GUIDs may be platform-dependent (i.e., the same device may report
* SDL these are largely used to identify input devices across runs of SDL * different GUIDs on different operating systems).
* programs on the same platform.If the device is detached and then
* re-attached to a different port, or if the base system is rebooted, the
* device should still report the same GUID.
*
* GUIDs are as precise as possible but are not guaranteed to distinguish
* physically distinct but equivalent devices. For example, two game
* controllers from the same vendor with the same product ID and revision may
* have the same GUID.
*
* GUIDs may be platform-dependent (i.e., the same device may report different
* GUIDs on different operating systems).
*/ */
typedef struct SDL_GUID { typedef struct {
Uint8 data[16]; Uint8 data[16];
} SDL_GUID; } SDL_GUID;
/* Function prototypes */ /* Function prototypes */
/** /**
* Get an ASCII string representation for a given SDL_GUID. * Get an ASCII string representation for a given ::SDL_GUID.
* *
* You should supply at least 33 bytes for pszGUID. * You should supply at least 33 bytes for pszGUID.
* *
* \param guid the SDL_GUID you wish to convert to string. * \param guid the ::SDL_GUID you wish to convert to string
* \param pszGUID buffer in which to write the ASCII string. * \param pszGUID buffer in which to write the ASCII string
* \param cbGUID the size of pszGUID. * \param cbGUID the size of pszGUID
* *
* \since This function is available since SDL 2.24.0. * \since This function is available since SDL 2.24.0.
* *
@@ -81,14 +74,14 @@ typedef struct SDL_GUID {
extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID); extern DECLSPEC void SDLCALL SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID);
/** /**
* Convert a GUID string into a SDL_GUID structure. * Convert a GUID string into a ::SDL_GUID structure.
* *
* Performs no error checking. If this function is given a string containing * Performs no error checking. If this function is given a string containing
* an invalid GUID, the function will silently succeed, but the GUID generated * an invalid GUID, the function will silently succeed, but the GUID generated
* will not be useful. * will not be useful.
* *
* \param pchGUID string containing an ASCII representation of a GUID. * \param pchGUID string containing an ASCII representation of a GUID
* \returns a SDL_GUID structure. * \returns a ::SDL_GUID structure.
* *
* \since This function is available since SDL 2.24.0. * \since This function is available since SDL 2.24.0.
* *
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,35 +19,44 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: HIDAPI */
/** /**
* # CategoryHIDAPI * \file SDL_hidapi.h
* *
* Header file for SDL HIDAPI functions. * Header file for SDL HIDAPI functions.
* *
* This is an adaptation of the original HIDAPI interface by Alan Ott, and * This is an adaptation of the original HIDAPI interface by Alan Ott,
* includes source code licensed under the following license: * and includes source code licensed under the following BSD license:
* *
* ``` Copyright (c) 2010, Alan Ott, Signal 11 Software
* HIDAPI - Multi-Platform library for All rights reserved.
* communication with HID devices.
* Redistribution and use in source and binary forms, with or without
* Copyright 2009, Alan Ott, Signal 11 Software. modification, are permitted provided that the following conditions are met:
* All Rights Reserved.
* * Redistributions of source code must retain the above copyright notice,
* This software may be used by anyone for any reason so this list of conditions and the following disclaimer.
* long as the copyright notice in the source files * Redistributions in binary form must reproduce the above copyright
* remains intact. notice, this list of conditions and the following disclaimer in the
* ``` documentation and/or other materials provided with the distribution.
* * Neither the name of Signal 11 Software nor the names of its
* (Note that this license is the same as item three of SDL's zlib license, so contributors may be used to endorse or promote products derived from
* it adds no new requirements on the user.) this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
* *
* If you would like a version of SDL without this code, you can build SDL * If you would like a version of SDL without this code, you can build SDL
* with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for * with SDL_HIDAPI_DISABLED defined to 1. You might want to do this for example
* example on iOS or tvOS to avoid a dependency on the CoreBluetooth * on iOS or tvOS to avoid a dependency on the CoreBluetooth framework.
* framework.
*/ */
#ifndef SDL_hidapi_h_ #ifndef SDL_hidapi_h_
@@ -62,15 +71,14 @@ extern "C" {
#endif #endif
/** /**
* A handle representing an open HID device * \brief A handle representing an open HID device
*/ */
struct SDL_hid_device_; struct SDL_hid_device_;
typedef struct SDL_hid_device_ SDL_hid_device; /**< opaque hidapi structure */ typedef struct SDL_hid_device_ SDL_hid_device; /**< opaque hidapi structure */
/** hidapi info structure */ /** hidapi info structure */
/** /**
* Information about a connected HID device * \brief Information about a connected HID device
*/ */
typedef struct SDL_hid_device_info typedef struct SDL_hid_device_info
{ {
@@ -226,13 +234,13 @@ extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id,
* The path name be determined by calling SDL_hid_enumerate(), or a * The path name be determined by calling SDL_hid_enumerate(), or a
* platform-specific path name can be used (eg: /dev/hidraw0 on Linux). * platform-specific path name can be used (eg: /dev/hidraw0 on Linux).
* *
* \param path The path name of the device to open. * \param path The path name of the device to open
* \returns a pointer to a SDL_hid_device object on success or NULL on * \returns a pointer to a SDL_hid_device object on success or NULL on
* failure. * failure.
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
*/ */
extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive); extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive /* = false */);
/** /**
* Write an Output report to a HID device. * Write an Output report to a HID device.
@@ -426,7 +434,7 @@ extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int
/** /**
* Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers * Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers
* *
* \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan. * \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
*/ */
File diff suppressed because it is too large. Load diff
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,26 +20,22 @@
*/ */
/** /**
* # CategoryJoystick * \file SDL_joystick.h
* *
* Include file for SDL joystick event handling * Include file for SDL joystick event handling
* *
* The term "device_index" identifies currently plugged in joystick devices * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick
* between 0 and SDL_NumJoysticks(), with the exact joystick behind a * behind a device_index changing as joysticks are plugged and unplugged.
* device_index changing as joysticks are plugged and unplugged.
* *
* The term "instance_id" is the current instantiation of a joystick device in * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted
* the system, if the joystick is removed and then re-inserted then it will * then it will get a new instance_id, instance_id's are monotonically increasing identifiers of a joystick plugged in.
* get a new instance_id, instance_id's are monotonically increasing
* identifiers of a joystick plugged in.
* *
* The term "player_index" is the number assigned to a player on a specific * The term "player_index" is the number assigned to a player on a specific
* controller. For XInput controllers this returns the XInput user index. Many * controller. For XInput controllers this returns the XInput user index.
* joysticks will not be able to supply this information. * Many joysticks will not be able to supply this information.
* *
* The term JoystickGUID is a stable 128-bit identifier for a joystick device * The term JoystickGUID is a stable 128-bit identifier for a joystick device that does not change over time, it identifies class of
* that does not change over time, it identifies class of the device (a X360 * the device (a X360 wired controller for example). This identifier is platform dependent.
* wired controller for example). This identifier is platform dependent.
*/ */
#ifndef SDL_joystick_h_ #ifndef SDL_joystick_h_
@@ -60,7 +56,7 @@ extern "C" {
* \file SDL_joystick.h * \file SDL_joystick.h
* *
* In order to use these functions, SDL_Init() must have been called * In order to use these functions, SDL_Init() must have been called
* with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system * with the ::SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
* for joysticks, and load appropriate drivers. * for joysticks, and load appropriate drivers.
* *
* If you would like to receive joystick updates while the application * If you would like to receive joystick updates while the application
@@ -77,21 +73,15 @@ extern SDL_mutex *SDL_joystick_lock;
struct _SDL_Joystick; struct _SDL_Joystick;
typedef struct _SDL_Joystick SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick;
/** /* A structure that encodes the stable unique id for a joystick device */
* A structure that encodes the stable unique id for a joystick device.
*
* This is just a standard SDL_GUID by a different name.
*/
typedef SDL_GUID SDL_JoystickGUID; typedef SDL_GUID SDL_JoystickGUID;
/** /**
* This is a unique ID for a joystick for the time it is connected to the * This is a unique ID for a joystick for the time it is connected to the system,
* system, and is never reused for the lifetime of the application. * and is never reused for the lifetime of the application. If the joystick is
* disconnected and reconnected, it will get a new ID.
* *
* If the joystick is disconnected and reconnected, it will get a new ID. * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
*
* The ID value starts at 0 and increments from there. The value -1 is an
* invalid ID.
*/ */
typedef Sint32 SDL_JoystickID; typedef Sint32 SDL_JoystickID;
@@ -182,7 +172,7 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
* This can be called before any joysticks are opened. * This can be called before any joysticks are opened.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system). * on the system)
* \returns the name of the selected joystick. If no name can be found, this * \returns the name of the selected joystick. If no name can be found, this
* function returns NULL; call SDL_GetError() for more information. * function returns NULL; call SDL_GetError() for more information.
* *
@@ -199,7 +189,7 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index);
* This can be called before any joysticks are opened. * This can be called before any joysticks are opened.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system). * on the system)
* \returns the path of the selected joystick. If no path can be found, this * \returns the path of the selected joystick. If no path can be found, this
* function returns NULL; call SDL_GetError() for more information. * function returns NULL; call SDL_GetError() for more information.
* *
@@ -225,9 +215,9 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index);
* This function can be called before any joysticks are opened. * This function can be called before any joysticks are opened.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the GUID of the selected joystick. If called on an invalid index, * \returns the GUID of the selected joystick. If called on an invalid index,
* this function returns a zero GUID. * this function returns a zero GUID
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -243,9 +233,9 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_in
* available this function returns 0. * available this function returns 0.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the USB vendor ID of the selected joystick. If called on an * \returns the USB vendor ID of the selected joystick. If called on an
* invalid index, this function returns zero. * invalid index, this function returns zero
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
*/ */
@@ -258,9 +248,9 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index);
* available this function returns 0. * available this function returns 0.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the USB product ID of the selected joystick. If called on an * \returns the USB product ID of the selected joystick. If called on an
* invalid index, this function returns zero. * invalid index, this function returns zero
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
*/ */
@@ -273,9 +263,9 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index);
* isn't available this function returns 0. * isn't available this function returns 0.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the product version of the selected joystick. If called on an * \returns the product version of the selected joystick. If called on an
* invalid index, this function returns zero. * invalid index, this function returns zero
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
*/ */
@@ -287,9 +277,9 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_in
* This can be called before any joysticks are opened. * This can be called before any joysticks are opened.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the SDL_JoystickType of the selected joystick. If called on an * \returns the SDL_JoystickType of the selected joystick. If called on an
* invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN`. * invalid index, this function returns `SDL_JOYSTICK_TYPE_UNKNOWN`
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
*/ */
@@ -301,7 +291,7 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_in
* This can be called before any joysticks are opened. * This can be called before any joysticks are opened.
* *
* \param device_index the index of the joystick to query (the N'th joystick * \param device_index the index of the joystick to query (the N'th joystick
* on the system. * on the system
* \returns the instance id of the selected joystick. If called on an invalid * \returns the instance id of the selected joystick. If called on an invalid
* index, this function returns -1. * index, this function returns -1.
* *
@@ -320,7 +310,7 @@ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int devic
* The joystick subsystem must be initialized before a joystick can be opened * The joystick subsystem must be initialized before a joystick can be opened
* for use. * for use.
* *
* \param device_index the index of the joystick to query. * \param device_index the index of the joystick to query
* \returns a joystick identifier or NULL if an error occurred; call * \returns a joystick identifier or NULL if an error occurred; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -334,7 +324,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickOpen(int device_index);
/** /**
* Get the SDL_Joystick associated with an instance id. * Get the SDL_Joystick associated with an instance id.
* *
* \param instance_id the instance id to get the SDL_Joystick for. * \param instance_id the instance id to get the SDL_Joystick for
* \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError()
* for more information. * for more information.
* *
@@ -345,7 +335,7 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID
/** /**
* Get the SDL_Joystick associated with a player index. * Get the SDL_Joystick associated with a player index.
* *
* \param player_index the player index to get the SDL_Joystick for. * \param player_index the player index to get the SDL_Joystick for
* \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError() * \returns an SDL_Joystick on success or NULL on failure; call SDL_GetError()
* for more information. * for more information.
* *
@@ -368,10 +358,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtual(SDL_JoystickType type,
/** /**
* The structure that defines an extended virtual joystick description * The structure that defines an extended virtual joystick description
* *
* The caller must zero the structure and then initialize the version with * The caller must zero the structure and then initialize the version with `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to SDL_JoystickAttachVirtualEx()
* `SDL_VIRTUAL_JOYSTICK_DESC_VERSION` before passing it to * All other elements of this structure are optional and can be left 0.
* SDL_JoystickAttachVirtualEx() All other elements of this structure are
* optional and can be left 0.
* *
* \sa SDL_JoystickAttachVirtualEx * \sa SDL_JoystickAttachVirtualEx
*/ */
@@ -402,7 +390,7 @@ typedef struct SDL_VirtualJoystickDesc
} SDL_VirtualJoystickDesc; } SDL_VirtualJoystickDesc;
/** /**
* The current version of the SDL_VirtualJoystickDesc structure * \brief The current version of the SDL_VirtualJoystickDesc structure
*/ */
#define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1 #define SDL_VIRTUAL_JOYSTICK_DESC_VERSION 1
@@ -419,7 +407,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystic
* Detach a virtual joystick. * Detach a virtual joystick.
* *
* \param device_index a value previously returned from * \param device_index a value previously returned from
* SDL_JoystickAttachVirtual(). * SDL_JoystickAttachVirtual()
* \returns 0 on success, or -1 if an error occurred. * \returns 0 on success, or -1 if an error occurred.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -497,7 +485,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, in
/** /**
* Get the implementation dependent name of a joystick. * Get the implementation dependent name of a joystick.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the name of the selected joystick. If no name can be found, this * \returns the name of the selected joystick. If no name can be found, this
* function returns NULL; call SDL_GetError() for more information. * function returns NULL; call SDL_GetError() for more information.
* *
@@ -511,7 +499,7 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick *joystick);
/** /**
* Get the implementation dependent path of a joystick. * Get the implementation dependent path of a joystick.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the path of the selected joystick. If no path can be found, this * \returns the path of the selected joystick. If no path can be found, this
* function returns NULL; call SDL_GetError() for more information. * function returns NULL; call SDL_GetError() for more information.
* *
@@ -527,7 +515,7 @@ extern DECLSPEC const char *SDLCALL SDL_JoystickPath(SDL_Joystick *joystick);
* For XInput controllers this returns the XInput user index. Many joysticks * For XInput controllers this returns the XInput user index. Many joysticks
* will not be able to supply this information. * will not be able to supply this information.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the player index, or -1 if it's not available. * \returns the player index, or -1 if it's not available.
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
@@ -537,7 +525,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick *joystick);
/** /**
* Set the player index of an opened joystick. * Set the player index of an opened joystick.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \param player_index Player index to assign to this joystick, or -1 to clear * \param player_index Player index to assign to this joystick, or -1 to clear
* the player index and turn off player LEDs. * the player index and turn off player LEDs.
* *
@@ -550,7 +538,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickSetPlayerIndex(SDL_Joystick *joystick,
* *
* This function requires an open joystick. * This function requires an open joystick.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the GUID of the given joystick. If called on an invalid index, * \returns the GUID of the given joystick. If called on an invalid index,
* this function returns a zero GUID; call SDL_GetError() for more * this function returns a zero GUID; call SDL_GetError() for more
* information. * information.
@@ -567,7 +555,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick *joyst
* *
* If the vendor ID isn't available this function returns 0. * If the vendor ID isn't available this function returns 0.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the USB vendor ID of the selected joystick, or 0 if unavailable. * \returns the USB vendor ID of the selected joystick, or 0 if unavailable.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
@@ -579,7 +567,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick *joystick);
* *
* If the product ID isn't available this function returns 0. * If the product ID isn't available this function returns 0.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the USB product ID of the selected joystick, or 0 if unavailable. * \returns the USB product ID of the selected joystick, or 0 if unavailable.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
@@ -591,7 +579,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick *joystick);
* *
* If the product version isn't available this function returns 0. * If the product version isn't available this function returns 0.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the product version of the selected joystick, or 0 if unavailable. * \returns the product version of the selected joystick, or 0 if unavailable.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
@@ -603,7 +591,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick *joyst
* *
* If the firmware version isn't available this function returns 0. * If the firmware version isn't available this function returns 0.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the firmware version of the selected joystick, or 0 if * \returns the firmware version of the selected joystick, or 0 if
* unavailable. * unavailable.
* *
@@ -616,7 +604,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetFirmwareVersion(SDL_Joystick *joys
* *
* Returns the serial number of the joystick, or NULL if it is not available. * Returns the serial number of the joystick, or NULL if it is not available.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the serial number of the selected joystick, or NULL if * \returns the serial number of the selected joystick, or NULL if
* unavailable. * unavailable.
* *
@@ -627,7 +615,7 @@ extern DECLSPEC const char * SDLCALL SDL_JoystickGetSerial(SDL_Joystick *joystic
/** /**
* Get the type of an opened joystick. * Get the type of an opened joystick.
* *
* \param joystick the SDL_Joystick obtained from SDL_JoystickOpen(). * \param joystick the SDL_Joystick obtained from SDL_JoystickOpen()
* \returns the SDL_JoystickType of the selected joystick. * \returns the SDL_JoystickType of the selected joystick.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
@@ -639,9 +627,9 @@ extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick *joyst
* *
* You should supply at least 33 bytes for pszGUID. * You should supply at least 33 bytes for pszGUID.
* *
* \param guid the SDL_JoystickGUID you wish to convert to string. * \param guid the SDL_JoystickGUID you wish to convert to string
* \param pszGUID buffer in which to write the ASCII string. * \param pszGUID buffer in which to write the ASCII string
* \param cbGUID the size of pszGUID. * \param cbGUID the size of pszGUID
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -658,7 +646,7 @@ extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, ch
* an invalid GUID, the function will silently succeed, but the GUID generated * an invalid GUID, the function will silently succeed, but the GUID generated
* will not be useful. * will not be useful.
* *
* \param pchGUID string containing an ASCII representation of a GUID. * \param pchGUID string containing an ASCII representation of a GUID
* \returns a SDL_JoystickGUID structure. * \returns a SDL_JoystickGUID structure.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -670,15 +658,15 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const cha
/** /**
* Get the device information encoded in a SDL_JoystickGUID structure * Get the device information encoded in a SDL_JoystickGUID structure
* *
* \param guid the SDL_JoystickGUID you wish to get info about. * \param guid the SDL_JoystickGUID you wish to get info about
* \param vendor A pointer filled in with the device VID, or 0 if not * \param vendor A pointer filled in with the device VID, or 0 if not
* available. * available
* \param product A pointer filled in with the device PID, or 0 if not * \param product A pointer filled in with the device PID, or 0 if not
* available. * available
* \param version A pointer filled in with the device version, or 0 if not * \param version A pointer filled in with the device version, or 0 if not
* available. * available
* \param crc16 A pointer filled in with a CRC used to distinguish different * \param crc16 A pointer filled in with a CRC used to distinguish different
* products with the same VID/PID, or 0 if not available. * products with the same VID/PID, or 0 if not available
* *
* \since This function is available since SDL 2.26.0. * \since This function is available since SDL 2.26.0.
* *
@@ -689,7 +677,7 @@ extern DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint
/** /**
* Get the status of a specified joystick. * Get the status of a specified joystick.
* *
* \param joystick the joystick to query. * \param joystick the joystick to query
* \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not; * \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -703,7 +691,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAttached(SDL_Joystick *joystick)
/** /**
* Get the instance ID of an opened joystick. * Get the instance ID of an opened joystick.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \returns the instance ID of the specified joystick on success or a negative * \returns the instance ID of the specified joystick on success or a negative
* error code on failure; call SDL_GetError() for more information. * error code on failure; call SDL_GetError() for more information.
* *
@@ -720,7 +708,7 @@ extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickInstanceID(SDL_Joystick *joys
* separate buttons or a POV hat, and not axes, but all of this is up to the * separate buttons or a POV hat, and not axes, but all of this is up to the
* device and platform. * device and platform.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \returns the number of axis controls/number of axes on success or a * \returns the number of axis controls/number of axes on success or a
* negative error code on failure; call SDL_GetError() for more * negative error code on failure; call SDL_GetError() for more
* information. * information.
@@ -740,7 +728,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
* *
* Most joysticks do not have trackballs. * Most joysticks do not have trackballs.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \returns the number of trackballs on success or a negative error code on * \returns the number of trackballs on success or a negative error code on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -753,7 +741,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
/** /**
* Get the number of POV hats on a joystick. * Get the number of POV hats on a joystick.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \returns the number of POV hats on success or a negative error code on * \returns the number of POV hats on success or a negative error code on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -767,7 +755,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
/** /**
* Get the number of buttons on a joystick. * Get the number of buttons on a joystick.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \returns the number of buttons on success or a negative error code on * \returns the number of buttons on success or a negative error code on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -802,17 +790,12 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
* **WARNING**: Calling this function may delete all events currently in SDL's * **WARNING**: Calling this function may delete all events currently in SDL's
* event queue. * event queue.
* *
* While `param` is meant to be one of `SDL_QUERY`, `SDL_IGNORE`, or * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`
* `SDL_ENABLE`, this function accepts any value, with any non-zero value that * \returns 1 if enabled, 0 if disabled, or a negative error code on failure;
* isn't `SDL_QUERY` being treated as `SDL_ENABLE`. * call SDL_GetError() for more information.
* *
* If SDL was built with events disabled (extremely uncommon!), this will do * If `state` is `SDL_QUERY` then the current state is returned,
* nothing and always return `SDL_IGNORE`. * otherwise the new processing state is returned.
*
* \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE`.
* \returns If `state` is `SDL_QUERY` then the current state is returned,
* otherwise `state` is returned (even if it was not one of the
* allowed values).
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -820,7 +803,6 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
*/ */
extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
/* Limits for joystick axes... */
#define SDL_JOYSTICK_AXIS_MAX 32767 #define SDL_JOYSTICK_AXIS_MAX 32767
#define SDL_JOYSTICK_AXIS_MIN -32768 #define SDL_JOYSTICK_AXIS_MIN -32768
@@ -837,8 +819,8 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
* 32767) representing the current position of the axis. It may be necessary * 32767) representing the current position of the axis. It may be necessary
* to impose certain tolerances on these values to account for jitter. * to impose certain tolerances on these values to account for jitter.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \param axis the axis to query; the axis indices start at index 0. * \param axis the axis to query; the axis indices start at index 0
* \returns a 16-bit signed integer representing the current position of the * \returns a 16-bit signed integer representing the current position of the
* axis or 0 on failure; call SDL_GetError() for more information. * axis or 0 on failure; call SDL_GetError() for more information.
* *
@@ -856,8 +838,8 @@ extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick,
* *
* The axis indices start at index 0. * The axis indices start at index 0.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \param axis the axis to query; the axis indices start at index 0. * \param axis the axis to query; the axis indices start at index 0
* \param state Upon return, the initial value is supplied here. * \param state Upon return, the initial value is supplied here.
* \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not.
* *
@@ -896,8 +878,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick *j
* - `SDL_HAT_LEFTUP` * - `SDL_HAT_LEFTUP`
* - `SDL_HAT_LEFTDOWN` * - `SDL_HAT_LEFTDOWN`
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \param hat the hat index to get the state from; indices start at index 0. * \param hat the hat index to get the state from; indices start at index 0
* \returns the current hat position. * \returns the current hat position.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -915,10 +897,10 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick,
* *
* Most joysticks do not have trackballs. * Most joysticks do not have trackballs.
* *
* \param joystick the SDL_Joystick to query. * \param joystick the SDL_Joystick to query
* \param ball the ball index to query; ball indices start at index 0. * \param ball the ball index to query; ball indices start at index 0
* \param dx stores the difference in the x axis position since the last poll. * \param dx stores the difference in the x axis position since the last poll
* \param dy stores the difference in the y axis position since the last poll. * \param dy stores the difference in the y axis position since the last poll
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -932,9 +914,9 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick,
/** /**
* Get the current state of a button on a joystick. * Get the current state of a button on a joystick.
* *
* \param joystick an SDL_Joystick structure containing joystick information. * \param joystick an SDL_Joystick structure containing joystick information
* \param button the button index to get the state from; indices start at * \param button the button index to get the state from; indices start at
* index 0. * index 0
* \returns 1 if the specified button is pressed, 0 otherwise. * \returns 1 if the specified button is pressed, 0 otherwise.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -950,13 +932,13 @@ extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick,
* Each call to this function cancels any previous rumble effect, and calling * Each call to this function cancels any previous rumble effect, and calling
* it with 0 intensity stops any rumbling. * it with 0 intensity stops any rumbling.
* *
* \param joystick The joystick to vibrate. * \param joystick The joystick to vibrate
* \param low_frequency_rumble The intensity of the low frequency (left) * \param low_frequency_rumble The intensity of the low frequency (left)
* rumble motor, from 0 to 0xFFFF. * rumble motor, from 0 to 0xFFFF
* \param high_frequency_rumble The intensity of the high frequency (right) * \param high_frequency_rumble The intensity of the high frequency (right)
* rumble motor, from 0 to 0xFFFF. * rumble motor, from 0 to 0xFFFF
* \param duration_ms The duration of the rumble effect, in milliseconds. * \param duration_ms The duration of the rumble effect, in milliseconds
* \returns 0, or -1 if rumble isn't supported on this joystick. * \returns 0, or -1 if rumble isn't supported on this joystick
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
* *
@@ -975,13 +957,13 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 lo
* want the (more common) whole-controller rumble, use SDL_JoystickRumble() * want the (more common) whole-controller rumble, use SDL_JoystickRumble()
* instead. * instead.
* *
* \param joystick The joystick to vibrate. * \param joystick The joystick to vibrate
* \param left_rumble The intensity of the left trigger rumble motor, from 0 * \param left_rumble The intensity of the left trigger rumble motor, from 0
* to 0xFFFF. * to 0xFFFF
* \param right_rumble The intensity of the right trigger rumble motor, from 0 * \param right_rumble The intensity of the right trigger rumble motor, from 0
* to 0xFFFF. * to 0xFFFF
* \param duration_ms The duration of the rumble effect, in milliseconds. * \param duration_ms The duration of the rumble effect, in milliseconds
* \returns 0, or -1 if trigger rumble isn't supported on this joystick. * \returns 0, or -1 if trigger rumble isn't supported on this joystick
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
* *
@@ -995,7 +977,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickRumbleTriggers(SDL_Joystick *joystick, U
* An example of a joystick LED is the light on the back of a PlayStation 4's * An example of a joystick LED is the light on the back of a PlayStation 4's
* DualShock 4 controller. * DualShock 4 controller.
* *
* \param joystick The joystick to query. * \param joystick The joystick to query
* \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise. * \return SDL_TRUE if the joystick has a modifiable LED, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -1005,7 +987,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasLED(SDL_Joystick *joystick);
/** /**
* Query whether a joystick has rumble support. * Query whether a joystick has rumble support.
* *
* \param joystick The joystick to query. * \param joystick The joystick to query
* \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise. * \return SDL_TRUE if the joystick has rumble, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
@@ -1017,7 +999,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumble(SDL_Joystick *joystick);
/** /**
* Query whether a joystick has rumble support on triggers. * Query whether a joystick has rumble support on triggers.
* *
* \param joystick The joystick to query. * \param joystick The joystick to query
* \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise. * \return SDL_TRUE if the joystick has trigger rumble, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
@@ -1032,11 +1014,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_JoystickHasRumbleTriggers(SDL_Joystick *joy
* An example of a joystick LED is the light on the back of a PlayStation 4's * An example of a joystick LED is the light on the back of a PlayStation 4's
* DualShock 4 controller. * DualShock 4 controller.
* *
* \param joystick The joystick to update. * \param joystick The joystick to update
* \param red The intensity of the red LED. * \param red The intensity of the red LED
* \param green The intensity of the green LED. * \param green The intensity of the green LED
* \param blue The intensity of the blue LED. * \param blue The intensity of the blue LED
* \returns 0 on success, -1 if this joystick does not have a modifiable LED. * \returns 0 on success, -1 if this joystick does not have a modifiable LED
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
*/ */
@@ -1045,11 +1027,10 @@ extern DECLSPEC int SDLCALL SDL_JoystickSetLED(SDL_Joystick *joystick, Uint8 red
/** /**
* Send a joystick specific effect packet * Send a joystick specific effect packet
* *
* \param joystick The joystick to affect. * \param joystick The joystick to affect
* \param data The data to send to the joystick. * \param data The data to send to the joystick
* \param size The size of the data to send to the joystick. * \param size The size of the data to send to the joystick
* \returns 0, or -1 if this joystick or driver doesn't support effect * \returns 0, or -1 if this joystick or driver doesn't support effect packets
* packets.
* *
* \since This function is available since SDL 2.0.16. * \since This function is available since SDL 2.0.16.
*/ */
@@ -1058,7 +1039,7 @@ extern DECLSPEC int SDLCALL SDL_JoystickSendEffect(SDL_Joystick *joystick, const
/** /**
* Close a joystick previously opened with SDL_JoystickOpen(). * Close a joystick previously opened with SDL_JoystickOpen().
* *
* \param joystick The joystick device to close. * \param joystick The joystick device to close
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1069,9 +1050,9 @@ extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
/** /**
* Get the battery level of a joystick as SDL_JoystickPowerLevel. * Get the battery level of a joystick as SDL_JoystickPowerLevel.
* *
* \param joystick the SDL_Joystick to query. * \param joystick the SDL_Joystick to query
* \returns the current battery level as SDL_JoystickPowerLevel on success or * \returns the current battery level as SDL_JoystickPowerLevel on success or
* `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown. * `SDL_JOYSTICK_POWER_UNKNOWN` if it is unknown
* *
* \since This function is available since SDL 2.0.4. * \since This function is available since SDL 2.0.4.
*/ */
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryKeyboard * \file SDL_keyboard.h
* *
* Include file for SDL keyboard event handling * Include file for SDL keyboard event handling
*/ */
#ifndef SDL_keyboard_h_ #ifndef SDL_keyboard_h_
@@ -40,16 +40,15 @@ extern "C" {
#endif #endif
/** /**
* The SDL keysym structure, used in key events. * \brief The SDL keysym structure, used in key events.
* *
* If you are looking for translated character input, see the SDL_TEXTINPUT * \note If you are looking for translated character input, see the ::SDL_TEXTINPUT event.
* event.
*/ */
typedef struct SDL_Keysym typedef struct SDL_Keysym
{ {
SDL_Scancode scancode; /**< SDL physical key code - see SDL_Scancode for details */ SDL_Scancode scancode; /**< SDL physical key code - see ::SDL_Scancode for details */
SDL_Keycode sym; /**< SDL virtual key code - see SDL_Keycode for details */ SDL_Keycode sym; /**< SDL virtual key code - see ::SDL_Keycode for details */
Uint16 mod; /**< current key modifiers - see SDL_Keymod for details */ Uint16 mod; /**< current key modifiers */
Uint32 unused; Uint32 unused;
} SDL_Keysym; } SDL_Keysym;
@@ -85,7 +84,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void);
* Note: This function doesn't take into account whether shift has been * Note: This function doesn't take into account whether shift has been
* pressed or not. * pressed or not.
* *
* \param numkeys if non-NULL, receives the length of the returned array. * \param numkeys if non-NULL, receives the length of the returned array
* \returns a pointer to an array of key states. * \returns a pointer to an array of key states.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -130,7 +129,7 @@ extern DECLSPEC SDL_Keymod SDLCALL SDL_GetModState(void);
* This does not change the keyboard state, only the key modifier flags that * This does not change the keyboard state, only the key modifier flags that
* SDL reports. * SDL reports.
* *
* \param modstate the desired SDL_Keymod for the keyboard. * \param modstate the desired SDL_Keymod for the keyboard
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -144,7 +143,7 @@ extern DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate);
* *
* See SDL_Keycode for details. * See SDL_Keycode for details.
* *
* \param scancode the desired SDL_Scancode to query. * \param scancode the desired SDL_Scancode to query
* \returns the SDL_Keycode that corresponds to the given SDL_Scancode. * \returns the SDL_Keycode that corresponds to the given SDL_Scancode.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -160,7 +159,7 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode
* *
* See SDL_Scancode for details. * See SDL_Scancode for details.
* *
* \param key the desired SDL_Keycode to query. * \param key the desired SDL_Keycode to query
* \returns the SDL_Scancode that corresponds to the given SDL_Keycode. * \returns the SDL_Scancode that corresponds to the given SDL_Keycode.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -184,7 +183,7 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key);
* unsuitable for creating a stable cross-platform two-way mapping between * unsuitable for creating a stable cross-platform two-way mapping between
* strings and scancodes. * strings and scancodes.
* *
* \param scancode the desired SDL_Scancode to query. * \param scancode the desired SDL_Scancode to query
* \returns a pointer to the name for the scancode. If the scancode doesn't * \returns a pointer to the name for the scancode. If the scancode doesn't
* have a name this function returns an empty string (""). * have a name this function returns an empty string ("").
* *
@@ -198,7 +197,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetScancodeName(SDL_Scancode scancode);
/** /**
* Get a scancode from a human-readable name. * Get a scancode from a human-readable name.
* *
* \param name the human-readable scancode name. * \param name the human-readable scancode name
* \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't * \returns the SDL_Scancode, or `SDL_SCANCODE_UNKNOWN` if the name wasn't
* recognized; call SDL_GetError() for more information. * recognized; call SDL_GetError() for more information.
* *
@@ -215,7 +214,7 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name);
* *
* See SDL_Scancode and SDL_Keycode for details. * See SDL_Scancode and SDL_Keycode for details.
* *
* \param key the desired SDL_Keycode to query. * \param key the desired SDL_Keycode to query
* \returns a pointer to a UTF-8 string that stays valid at least until the * \returns a pointer to a UTF-8 string that stays valid at least until the
* next call to this function. If you need it around any longer, you * next call to this function. If you need it around any longer, you
* must copy it. If the key doesn't have a name, this function * must copy it. If the key doesn't have a name, this function
@@ -232,7 +231,7 @@ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key);
/** /**
* Get a key code from a human-readable name. * Get a key code from a human-readable name.
* *
* \param name the human-readable key name. * \param name the human-readable key name
* \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call * \returns key code, or `SDLK_UNKNOWN` if the name wasn't recognized; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -254,10 +253,6 @@ extern DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name);
* *
* On some platforms using this function activates the screen keyboard. * On some platforms using this function activates the screen keyboard.
* *
* On desktop platforms, SDL_StartTextInput() is implicitly called on SDL
* video subsystem initialization which will cause SDL_TextInputEvent and
* SDL_TextEditingEvent to begin emitting.
*
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
* \sa SDL_SetTextInputRect * \sa SDL_SetTextInputRect
@@ -305,9 +300,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void);
/** /**
* Set the rectangle used to type Unicode text inputs. * Set the rectangle used to type Unicode text inputs.
* *
* Native input methods will place a window with word suggestions near it,
* without covering the text being inputted.
*
* To start text input in a given location, this function is intended to be * To start text input in a given location, this function is intended to be
* called before SDL_StartTextInput, although some platforms support moving * called before SDL_StartTextInput, although some platforms support moving
* the rectangle even while text input (and a composition) is active. * the rectangle even while text input (and a composition) is active.
@@ -317,7 +309,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void);
* any feedback. * any feedback.
* *
* \param rect the SDL_Rect structure representing the rectangle to receive * \param rect the SDL_Rect structure representing the rectangle to receive
* text (ignored if NULL). * text (ignored if NULL)
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -341,7 +333,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void);
/** /**
* Check whether the screen keyboard is shown for given window. * Check whether the screen keyboard is shown for given window.
* *
* \param window the window for which screen keyboard should be queried. * \param window the window for which screen keyboard should be queried
* \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not. * \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryKeycode * \file SDL_keycode.h
* *
* Defines constants which identify keyboard keys and modifiers. * Defines constants which identify keyboard keys and modifiers.
*/ */
#ifndef SDL_keycode_h_ #ifndef SDL_keycode_h_
@@ -32,22 +32,22 @@
#include "SDL_scancode.h" #include "SDL_scancode.h"
/** /**
* The SDL virtual key representation. * \brief The SDL virtual key representation.
* *
* Values of this type are used to represent keyboard keys using the current * Values of this type are used to represent keyboard keys using the current
* layout of the keyboard. These values include Unicode values representing * layout of the keyboard. These values include Unicode values representing
* the unmodified character that would be generated by pressing the key, or an * the unmodified character that would be generated by pressing the key, or
* SDLK_* constant for those keys that do not generate characters. * an SDLK_* constant for those keys that do not generate characters.
* *
* A special exception is the number keys at the top of the keyboard which map * A special exception is the number keys at the top of the keyboard which
* to SDLK_0...SDLK_9 on AZERTY layouts. * map to SDLK_0...SDLK_9 on AZERTY layouts.
*/ */
typedef Sint32 SDL_Keycode; typedef Sint32 SDL_Keycode;
#define SDLK_SCANCODE_MASK (1<<30) #define SDLK_SCANCODE_MASK (1<<30)
#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) #define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK)
typedef enum SDL_KeyCode typedef enum
{ {
SDLK_UNKNOWN = 0, SDLK_UNKNOWN = 0,
@@ -327,9 +327,9 @@ typedef enum SDL_KeyCode
} SDL_KeyCode; } SDL_KeyCode;
/** /**
* Enumeration of valid key mods (possibly OR'd together). * \brief Enumeration of valid key mods (possibly OR'd together).
*/ */
typedef enum SDL_Keymod typedef enum
{ {
KMOD_NONE = 0x0000, KMOD_NONE = 0x0000,
KMOD_LSHIFT = 0x0001, KMOD_LSHIFT = 0x0001,
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,25 +19,23 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: LoadSO */
/** /**
* # CategoryLoadSO * \file SDL_loadso.h
* *
* System-dependent library loading routines. * System dependent library loading routines
* *
* Some things to keep in mind: * Some things to keep in mind:
* * \li These functions only work on C function names. Other languages may
* - These functions only work on C function names. Other languages may have * have name mangling and intrinsic language support that varies from
* name mangling and intrinsic language support that varies from compiler to * compiler to compiler.
* compiler. * \li Make sure you declare your function pointers with the same calling
* - Make sure you declare your function pointers with the same calling * convention as the actual library function. Your code will crash
* convention as the actual library function. Your code will crash * mysteriously if you do not do this.
* mysteriously if you do not do this. * \li Avoid namespace collisions. If you load a symbol from the library,
* - Avoid namespace collisions. If you load a symbol from the library, it is * it is not defined whether or not it goes into the global symbol
* not defined whether or not it goes into the global symbol namespace for * namespace for the application. If it does and it conflicts with
* the application. If it does and it conflicts with symbols in your code or * symbols in your code or other shared libraries, you will not get
* other shared libraries, you will not get the results you expect. :) * the results you expect. :)
*/ */
#ifndef SDL_loadso_h_ #ifndef SDL_loadso_h_
@@ -55,7 +53,7 @@ extern "C" {
/** /**
* Dynamically load a shared object. * Dynamically load a shared object.
* *
* \param sofile a system-dependent name of the object file. * \param sofile a system-dependent name of the object file
* \returns an opaque pointer to the object handle or NULL if there was an * \returns an opaque pointer to the object handle or NULL if there was an
* error; call SDL_GetError() for more information. * error; call SDL_GetError() for more information.
* *
@@ -81,8 +79,8 @@ extern DECLSPEC void *SDLCALL SDL_LoadObject(const char *sofile);
* *
* If the requested function doesn't exist, NULL is returned. * If the requested function doesn't exist, NULL is returned.
* *
* \param handle a valid shared object handle returned by SDL_LoadObject(). * \param handle a valid shared object handle returned by SDL_LoadObject()
* \param name the name of the function to look up. * \param name the name of the function to look up
* \returns a pointer to the function or NULL if there was an error; call * \returns a pointer to the function or NULL if there was an error; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -97,7 +95,7 @@ extern DECLSPEC void *SDLCALL SDL_LoadFunction(void *handle,
/** /**
* Unload a shared object from memory. * Unload a shared object from memory.
* *
* \param handle a valid shared object handle returned by SDL_LoadObject(). * \param handle a valid shared object handle returned by SDL_LoadObject()
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryLocale * \file SDL_locale.h
* *
* Include file for SDL locale services * Include file for SDL locale services
*/ */
#ifndef _SDL_locale_h #ifndef _SDL_locale_h
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,19 +20,18 @@
*/ */
/** /**
* # CategoryLog * \file SDL_log.h
* *
* Simple log messages with categories and priorities. * Simple log messages with categories and priorities.
* *
* By default logs are quiet, but if you're debugging SDL you might want: * By default logs are quiet, but if you're debugging SDL you might want:
* *
* SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN); * SDL_LogSetAllPriority(SDL_LOG_PRIORITY_WARN);
* *
* Here's where the messages go on different platforms: * Here's where the messages go on different platforms:
* * Windows: debug output stream
* - Windows: debug output stream * Android: log output
* - Android: log output * Others: standard error output (stderr)
* - Others: standard error output (stderr)
*/ */
#ifndef SDL_log_h_ #ifndef SDL_log_h_
@@ -48,20 +47,21 @@ extern "C" {
/** /**
* The maximum size of a log message prior to SDL 2.0.24 * \brief The maximum size of a log message prior to SDL 2.0.24
* *
* As of 2.0.24 there is no limit to the length of SDL log messages. * As of 2.0.24 there is no limit to the length of SDL log messages.
*/ */
#define SDL_MAX_LOG_MESSAGE 4096 #define SDL_MAX_LOG_MESSAGE 4096
/** /**
* The predefined log categories * \brief The predefined log categories
* *
* By default the application category is enabled at the INFO level, the * By default the application category is enabled at the INFO level,
* assert category is enabled at the WARN level, test is enabled at the * the assert category is enabled at the WARN level, test is enabled
* VERBOSE level and all other categories are enabled at the ERROR level. * at the VERBOSE level and all other categories are enabled at the
* CRITICAL level.
*/ */
typedef enum SDL_LogCategory typedef enum
{ {
SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_CATEGORY_APPLICATION,
SDL_LOG_CATEGORY_ERROR, SDL_LOG_CATEGORY_ERROR,
@@ -97,9 +97,9 @@ typedef enum SDL_LogCategory
} SDL_LogCategory; } SDL_LogCategory;
/** /**
* The predefined log priorities * \brief The predefined log priorities
*/ */
typedef enum SDL_LogPriority typedef enum
{ {
SDL_LOG_PRIORITY_VERBOSE = 1, SDL_LOG_PRIORITY_VERBOSE = 1,
SDL_LOG_PRIORITY_DEBUG, SDL_LOG_PRIORITY_DEBUG,
@@ -114,7 +114,7 @@ typedef enum SDL_LogPriority
/** /**
* Set the priority of all log categories. * Set the priority of all log categories.
* *
* \param priority the SDL_LogPriority to assign. * \param priority the SDL_LogPriority to assign
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -125,8 +125,8 @@ extern DECLSPEC void SDLCALL SDL_LogSetAllPriority(SDL_LogPriority priority);
/** /**
* Set the priority of a particular log category. * Set the priority of a particular log category.
* *
* \param category the category to assign a priority to. * \param category the category to assign a priority to
* \param priority the SDL_LogPriority to assign. * \param priority the SDL_LogPriority to assign
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -139,8 +139,8 @@ extern DECLSPEC void SDLCALL SDL_LogSetPriority(int category,
/** /**
* Get the priority of a particular log category. * Get the priority of a particular log category.
* *
* \param category the category to query. * \param category the category to query
* \returns the SDL_LogPriority for the requested category. * \returns the SDL_LogPriority for the requested category
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -166,7 +166,7 @@ extern DECLSPEC void SDLCALL SDL_LogResetPriorities(void);
* = * \param fmt a printf() style message format string * = * \param fmt a printf() style message format string
* *
* \param ... additional parameters matching % tokens in the `fmt` string, if * \param ... additional parameters matching % tokens in the `fmt` string, if
* any. * any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -184,10 +184,10 @@ extern DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, .
/** /**
* Log a message with SDL_LOG_PRIORITY_VERBOSE. * Log a message with SDL_LOG_PRIORITY_VERBOSE.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -205,10 +205,10 @@ extern DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRI
/** /**
* Log a message with SDL_LOG_PRIORITY_DEBUG. * Log a message with SDL_LOG_PRIORITY_DEBUG.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -226,10 +226,10 @@ extern DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_STRING
/** /**
* Log a message with SDL_LOG_PRIORITY_INFO. * Log a message with SDL_LOG_PRIORITY_INFO.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -247,10 +247,10 @@ extern DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STRING
/** /**
* Log a message with SDL_LOG_PRIORITY_WARN. * Log a message with SDL_LOG_PRIORITY_WARN.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -268,10 +268,10 @@ extern DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING
/** /**
* Log a message with SDL_LOG_PRIORITY_ERROR. * Log a message with SDL_LOG_PRIORITY_ERROR.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -289,10 +289,10 @@ extern DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_STRING
/** /**
* Log a message with SDL_LOG_PRIORITY_CRITICAL. * Log a message with SDL_LOG_PRIORITY_CRITICAL.
* *
* \param category the category of the message. * \param category the category of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -310,11 +310,11 @@ extern DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT_STR
/** /**
* Log a message with the specified category and priority. * Log a message with the specified category and priority.
* *
* \param category the category of the message. * \param category the category of the message
* \param priority the priority of the message. * \param priority the priority of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ... additional parameters matching % tokens in the **fmt** string, * \param ... additional parameters matching % tokens in the **fmt** string,
* if any. * if any
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -334,10 +334,10 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
/** /**
* Log a message with the specified category and priority. * Log a message with the specified category and priority.
* *
* \param category the category of the message. * \param category the category of the message
* \param priority the priority of the message. * \param priority the priority of the message
* \param fmt a printf() style message format string. * \param fmt a printf() style message format string
* \param ap a variable argument list. * \param ap a variable argument list
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -352,18 +352,17 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category,
*/ */
extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, extern DECLSPEC void SDLCALL SDL_LogMessageV(int category,
SDL_LogPriority priority, SDL_LogPriority priority,
SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); const char *fmt, va_list ap);
/** /**
* The prototype for the log output callback function. * The prototype for the log output callback function.
* *
* This function is called by SDL when there is new text to be logged. * This function is called by SDL when there is new text to be logged.
* *
* \param userdata what was passed as `userdata` to * \param userdata what was passed as `userdata` to SDL_LogSetOutputFunction()
* SDL_LogSetOutputFunction(). * \param category the category of the message
* \param category the category of the message. * \param priority the priority of the message
* \param priority the priority of the message. * \param message the message being output
* \param message the message being output.
*/ */
typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message);
@@ -371,9 +370,9 @@ typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_
* Get the current log output function. * Get the current log output function.
* *
* \param callback an SDL_LogOutputFunction filled in with the current log * \param callback an SDL_LogOutputFunction filled in with the current log
* callback. * callback
* \param userdata a pointer filled in with the pointer that is passed to * \param userdata a pointer filled in with the pointer that is passed to
* `callback`. * `callback`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -384,8 +383,8 @@ extern DECLSPEC void SDLCALL SDL_LogGetOutputFunction(SDL_LogOutputFunction *cal
/** /**
* Replace the default log output function with one of your own. * Replace the default log output function with one of your own.
* *
* \param callback an SDL_LogOutputFunction to call instead of the default. * \param callback an SDL_LogOutputFunction to call instead of the default
* \param userdata a pointer that is passed to `callback`. * \param userdata a pointer that is passed to `callback`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -25,9 +25,9 @@
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
/** /**
* # CategoryMain * \file SDL_main.h
* *
* Redefine main() on some platforms so that it is called by SDL. * Redefine main() on some platforms so that it is called by SDL.
*/ */
#ifndef SDL_MAIN_HANDLED #ifndef SDL_MAIN_HANDLED
@@ -129,14 +129,14 @@
* *
* The application's main() function must be called with C linkage, * The application's main() function must be called with C linkage,
* and should be declared like this: * and should be declared like this:
* ```c * \code
* #ifdef __cplusplus * #ifdef __cplusplus
* extern "C" * extern "C"
* #endif * #endif
* int main(int argc, char *argv[]) * int main(int argc, char *argv[])
* { * {
* } * }
* ``` * \endcode
*/ */
#if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE) #if defined(SDL_MAIN_NEEDED) || defined(SDL_MAIN_AVAILABLE)
@@ -149,7 +149,7 @@ extern "C" {
#endif #endif
/** /**
* The prototype for the application's main() function * The prototype for the application's main() function
*/ */
typedef int (*SDL_main_func)(int argc, char *argv[]); typedef int (*SDL_main_func)(int argc, char *argv[]);
extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); extern SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]);
@@ -222,8 +222,8 @@ extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
/** /**
* Initialize and launch an SDL/WinRT application. * Initialize and launch an SDL/WinRT application.
* *
* \param mainFunction the SDL app's C-style main(), an SDL_main_func. * \param mainFunction the SDL app's C-style main(), an SDL_main_func
* \param reserved reserved for future use; should be NULL. * \param reserved reserved for future use; should be NULL
* \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve * \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve
* more information on the failure. * more information on the failure.
* *
@@ -238,10 +238,10 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(SDL_main_func mainFunction, void * r
/** /**
* Initializes and launches an SDL application. * Initializes and launches an SDL application.
* *
* \param argc The argc parameter from the application's main() function. * \param argc The argc parameter from the application's main() function
* \param argv The argv parameter from the application's main() function. * \param argv The argv parameter from the application's main() function
* \param mainFunction The SDL app's C-style main(), an SDL_main_func. * \param mainFunction The SDL app's C-style main(), an SDL_main_func
* \return the return value from mainFunction. * \return the return value from mainFunction
* *
* \since This function is available since SDL 2.0.10. * \since This function is available since SDL 2.0.10.
*/ */
@@ -254,8 +254,8 @@ extern DECLSPEC int SDLCALL SDL_UIKitRunApp(int argc, char *argv[], SDL_main_fun
/** /**
* Initialize and launch an SDL GDK application. * Initialize and launch an SDL GDK application.
* *
* \param mainFunction the SDL app's C-style main(), an SDL_main_func. * \param mainFunction the SDL app's C-style main(), an SDL_main_func
* \param reserved reserved for future use; should be NULL. * \param reserved reserved for future use; should be NULL
* \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve * \returns 0 on success or -1 on failure; call SDL_GetError() to retrieve
* more information on the failure. * more information on the failure.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -32,11 +32,9 @@ extern "C" {
#endif #endif
/** /**
* SDL_MessageBox flags. * SDL_MessageBox flags. If supported will display warning icon, etc.
*
* If supported will display warning icon, etc.
*/ */
typedef enum SDL_MessageBoxFlags typedef enum
{ {
SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */ SDL_MESSAGEBOX_ERROR = 0x00000010, /**< error dialog */
SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */ SDL_MESSAGEBOX_WARNING = 0x00000020, /**< warning dialog */
@@ -48,7 +46,7 @@ typedef enum SDL_MessageBoxFlags
/** /**
* Flags for SDL_MessageBoxButtonData. * Flags for SDL_MessageBoxButtonData.
*/ */
typedef enum SDL_MessageBoxButtonFlags typedef enum
{ {
SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */ SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT = 0x00000001, /**< Marks the default button when return is hit */
SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */ SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT = 0x00000002 /**< Marks the default button when escape is hit */
@@ -57,9 +55,9 @@ typedef enum SDL_MessageBoxButtonFlags
/** /**
* Individual button data. * Individual button data.
*/ */
typedef struct SDL_MessageBoxButtonData typedef struct
{ {
Uint32 flags; /**< SDL_MessageBoxButtonFlags */ Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */ int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
const char * text; /**< The UTF-8 button text */ const char * text; /**< The UTF-8 button text */
} SDL_MessageBoxButtonData; } SDL_MessageBoxButtonData;
@@ -67,12 +65,12 @@ typedef struct SDL_MessageBoxButtonData
/** /**
* RGB value used in a message box color scheme * RGB value used in a message box color scheme
*/ */
typedef struct SDL_MessageBoxColor typedef struct
{ {
Uint8 r, g, b; Uint8 r, g, b;
} SDL_MessageBoxColor; } SDL_MessageBoxColor;
typedef enum SDL_MessageBoxColorType typedef enum
{ {
SDL_MESSAGEBOX_COLOR_BACKGROUND, SDL_MESSAGEBOX_COLOR_BACKGROUND,
SDL_MESSAGEBOX_COLOR_TEXT, SDL_MESSAGEBOX_COLOR_TEXT,
@@ -85,7 +83,7 @@ typedef enum SDL_MessageBoxColorType
/** /**
* A set of colors to use for message box dialogs * A set of colors to use for message box dialogs
*/ */
typedef struct SDL_MessageBoxColorScheme typedef struct
{ {
SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX];
} SDL_MessageBoxColorScheme; } SDL_MessageBoxColorScheme;
@@ -93,9 +91,9 @@ typedef struct SDL_MessageBoxColorScheme
/** /**
* MessageBox structure containing title, text, window, etc. * MessageBox structure containing title, text, window, etc.
*/ */
typedef struct SDL_MessageBoxData typedef struct
{ {
Uint32 flags; /**< SDL_MessageBoxFlags */ Uint32 flags; /**< ::SDL_MessageBoxFlags */
SDL_Window *window; /**< Parent window, can be NULL */ SDL_Window *window; /**< Parent window, can be NULL */
const char *title; /**< UTF-8 title */ const char *title; /**< UTF-8 title */
const char *message; /**< UTF-8 message text */ const char *message; /**< UTF-8 message text */
@@ -103,7 +101,7 @@ typedef struct SDL_MessageBoxData
int numbuttons; int numbuttons;
const SDL_MessageBoxButtonData *buttons; const SDL_MessageBoxButtonData *buttons;
const SDL_MessageBoxColorScheme *colorScheme; /**< SDL_MessageBoxColorScheme, can be NULL to use system settings */ const SDL_MessageBoxColorScheme *colorScheme; /**< ::SDL_MessageBoxColorScheme, can be NULL to use system settings */
} SDL_MessageBoxData; } SDL_MessageBoxData;
/** /**
@@ -130,9 +128,8 @@ typedef struct SDL_MessageBoxData
* to stderr if you can. * to stderr if you can.
* *
* \param messageboxdata the SDL_MessageBoxData structure with title, text and * \param messageboxdata the SDL_MessageBoxData structure with title, text and
* other options. * other options
* \param buttonid the pointer to which user id of hit button should be * \param buttonid the pointer to which user id of hit button should be copied
* copied.
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -171,10 +168,10 @@ extern DECLSPEC int SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *message
* concern, check the return value from this function and fall back to writing * concern, check the return value from this function and fall back to writing
* to stderr if you can. * to stderr if you can.
* *
* \param flags an SDL_MessageBoxFlags value. * \param flags an SDL_MessageBoxFlags value
* \param title UTF-8 title text. * \param title UTF-8 title text
* \param message UTF-8 message text. * \param message UTF-8 message text
* \param window the parent window, or NULL for no parent. * \param window the parent window, or NULL for no parent
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,10 +20,9 @@
*/ */
/** /**
* # CategoryMetal * \file SDL_metal.h
* *
* Header file for functions to creating Metal layers and views on SDL * Header file for functions to creating Metal layers and views on SDL windows.
* windows.
*/ */
#ifndef SDL_metal_h_ #ifndef SDL_metal_h_
@@ -38,9 +37,9 @@ extern "C" {
#endif #endif
/** /**
* A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS). * \brief A handle to a CAMetalLayer-backed NSView (macOS) or UIView (iOS/tvOS).
* *
* This can be cast directly to an NSView or UIView. * \note This can be cast directly to an NSView or UIView.
*/ */
typedef void *SDL_MetalView; typedef void *SDL_MetalView;
@@ -91,9 +90,9 @@ extern DECLSPEC void *SDLCALL SDL_Metal_GetLayer(SDL_MetalView view);
* Get the size of a window's underlying drawable in pixels (for use with * Get the size of a window's underlying drawable in pixels (for use with
* setting viewport, scissor & etc). * setting viewport, scissor & etc).
* *
* \param window SDL_Window from which the drawable size should be queried. * \param window SDL_Window from which the drawable size should be queried
* \param w Pointer to variable for storing the width in pixels, may be NULL. * \param w Pointer to variable for storing the width in pixels, may be NULL
* \param h Pointer to variable for storing the height in pixels, may be NULL. * \param h Pointer to variable for storing the height in pixels, may be NULL
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryMisc * \file SDL_misc.h
* *
* Include file for SDL API functions that don't fit elsewhere. * \brief Include file for SDL API functions that don't fit elsewhere.
*/ */
#ifndef SDL_misc_h_ #ifndef SDL_misc_h_
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryMouse * \file SDL_mouse.h
* *
* Include file for SDL mouse event handling. * Include file for SDL mouse event handling.
*/ */
#ifndef SDL_mouse_h_ #ifndef SDL_mouse_h_
@@ -41,9 +41,9 @@ extern "C" {
typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */ typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */
/** /**
* Cursor types for SDL_CreateSystemCursor(). * \brief Cursor types for SDL_CreateSystemCursor().
*/ */
typedef enum SDL_SystemCursor typedef enum
{ {
SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */ SDL_SYSTEM_CURSOR_ARROW, /**< Arrow */
SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */ SDL_SYSTEM_CURSOR_IBEAM, /**< I-beam */
@@ -61,9 +61,9 @@ typedef enum SDL_SystemCursor
} SDL_SystemCursor; } SDL_SystemCursor;
/** /**
* Scroll direction types for the Scroll event * \brief Scroll direction types for the Scroll event
*/ */
typedef enum SDL_MouseWheelDirection typedef enum
{ {
SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */ SDL_MOUSEWHEEL_NORMAL, /**< The scroll direction is normal */
SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */ SDL_MOUSEWHEEL_FLIPPED /**< The scroll direction is flipped / natural */
@@ -90,9 +90,9 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_GetMouseFocus(void);
* either `x` or `y`. * either `x` or `y`.
* *
* \param x the x coordinate of the mouse cursor position relative to the * \param x the x coordinate of the mouse cursor position relative to the
* focus window. * focus window
* \param y the y coordinate of the mouse cursor position relative to the * \param y the y coordinate of the mouse cursor position relative to the
* focus window. * focus window
* \returns a 32-bit button bitmask of the current button state. * \returns a 32-bit button bitmask of the current button state.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -120,9 +120,9 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetMouseState(int *x, int *y);
* reason to use this function, you probably want SDL_GetMouseState() instead. * reason to use this function, you probably want SDL_GetMouseState() instead.
* *
* \param x filled in with the current X coord relative to the desktop; can be * \param x filled in with the current X coord relative to the desktop; can be
* NULL. * NULL
* \param y filled in with the current Y coord relative to the desktop; can be * \param y filled in with the current Y coord relative to the desktop; can be
* NULL. * NULL
* \returns the current button state as a bitmask which can be tested using * \returns the current button state as a bitmask which can be tested using
* the SDL_BUTTON(X) macros. * the SDL_BUTTON(X) macros.
* *
@@ -141,8 +141,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetGlobalMouseState(int *x, int *y);
* mouse deltas since the last call to SDL_GetRelativeMouseState() or since * mouse deltas since the last call to SDL_GetRelativeMouseState() or since
* event initialization. You can pass NULL for either `x` or `y`. * event initialization. You can pass NULL for either `x` or `y`.
* *
* \param x a pointer filled with the last recorded x coordinate of the mouse. * \param x a pointer filled with the last recorded x coordinate of the mouse
* \param y a pointer filled with the last recorded y coordinate of the mouse. * \param y a pointer filled with the last recorded y coordinate of the mouse
* \returns a 32-bit button bitmask of the relative button state. * \returns a 32-bit button bitmask of the relative button state.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -162,9 +162,9 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
* mouse when used over Microsoft Remote Desktop. * mouse when used over Microsoft Remote Desktop.
* *
* \param window the window to move the mouse into, or NULL for the current * \param window the window to move the mouse into, or NULL for the current
* mouse focus. * mouse focus
* \param x the x coordinate within the window. * \param x the x coordinate within the window
* \param y the y coordinate within the window. * \param y the y coordinate within the window
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -184,8 +184,8 @@ extern DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window,
* Note that this function will appear to succeed, but not actually move the * Note that this function will appear to succeed, but not actually move the
* mouse when used over Microsoft Remote Desktop. * mouse when used over Microsoft Remote Desktop.
* *
* \param x the x coordinate. * \param x the x coordinate
* \param y the y coordinate. * \param y the y coordinate
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -297,14 +297,14 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetRelativeMouseMode(void);
* Also, since SDL 2.0.0, SDL_CreateSystemCursor() is available, which * Also, since SDL 2.0.0, SDL_CreateSystemCursor() is available, which
* provides twelve readily available system cursors to pick from. * provides twelve readily available system cursors to pick from.
* *
* \param data the color value for each pixel of the cursor. * \param data the color value for each pixel of the cursor
* \param mask the mask value for each pixel of the cursor. * \param mask the mask value for each pixel of the cursor
* \param w the width of the cursor. * \param w the width of the cursor
* \param h the height of the cursor. * \param h the height of the cursor
* \param hot_x the X-axis location of the upper left corner of the cursor * \param hot_x the X-axis location of the upper left corner of the cursor
* relative to the actual mouse position. * relative to the actual mouse position
* \param hot_y the Y-axis location of the upper left corner of the cursor * \param hot_y the Y-axis location of the upper left corner of the cursor
* relative to the actual mouse position. * relative to the actual mouse position
* \returns a new cursor with the specified parameters on success or NULL on * \returns a new cursor with the specified parameters on success or NULL on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -322,9 +322,9 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateCursor(const Uint8 * data,
/** /**
* Create a color cursor. * Create a color cursor.
* *
* \param surface an SDL_Surface structure representing the cursor image. * \param surface an SDL_Surface structure representing the cursor image
* \param hot_x the x position of the cursor hot spot. * \param hot_x the x position of the cursor hot spot
* \param hot_y the y position of the cursor hot spot. * \param hot_y the y position of the cursor hot spot
* \returns the new cursor on success or NULL on failure; call SDL_GetError() * \returns the new cursor on success or NULL on failure; call SDL_GetError()
* for more information. * for more information.
* *
@@ -340,7 +340,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateColorCursor(SDL_Surface *surface,
/** /**
* Create a system cursor. * Create a system cursor.
* *
* \param id an SDL_SystemCursor enum value. * \param id an SDL_SystemCursor enum value
* \returns a cursor on success or NULL on failure; call SDL_GetError() for * \returns a cursor on success or NULL on failure; call SDL_GetError() for
* more information. * more information.
* *
@@ -358,7 +358,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor id);
* the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if * the display. SDL_SetCursor(NULL) can be used to force cursor redraw, if
* this is desired for any reason. * this is desired for any reason.
* *
* \param cursor a cursor to make active. * \param cursor a cursor to make active
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -402,7 +402,7 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void);
* Use this function to free cursor resources created with SDL_CreateCursor(), * Use this function to free cursor resources created with SDL_CreateCursor(),
* SDL_CreateColorCursor() or SDL_CreateSystemCursor(). * SDL_CreateColorCursor() or SDL_CreateSystemCursor().
* *
* \param cursor the cursor to free. * \param cursor the cursor to free
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -437,9 +437,9 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
/** /**
* Used as a mask when testing buttons in buttonstate. * Used as a mask when testing buttons in buttonstate.
* *
* - Button 1: Left mouse button * - Button 1: Left mouse button
* - Button 2: Middle mouse button * - Button 2: Middle mouse button
* - Button 3: Right mouse button * - Button 3: Right mouse button
*/ */
#define SDL_BUTTON(X) (1 << ((X)-1)) #define SDL_BUTTON(X) (1 << ((X)-1))
#define SDL_BUTTON_LEFT 1 #define SDL_BUTTON_LEFT 1
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -23,9 +23,9 @@
#define SDL_mutex_h_ #define SDL_mutex_h_
/** /**
* # CategoryMutex * \file SDL_mutex.h
* *
* Functions to provide thread synchronization primitives. * Functions to provide thread synchronization primitives.
*/ */
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
@@ -112,13 +112,13 @@ extern "C" {
#endif #endif
/** /**
* Synchronization functions which can time out return this value if they time * Synchronization functions which can time out return this value
* out. * if they time out.
*/ */
#define SDL_MUTEX_TIMEDOUT 1 #define SDL_MUTEX_TIMEDOUT 1
/** /**
* This is the timeout value which corresponds to never time out. * This is the timeout value which corresponds to never time out.
*/ */
#define SDL_MUTEX_MAXWAIT (~(Uint32)0) #define SDL_MUTEX_MAXWAIT (~(Uint32)0)
@@ -165,7 +165,7 @@ extern DECLSPEC SDL_mutex *SDLCALL SDL_CreateMutex(void);
* unlock it the same number of times before it is actually made available for * unlock it the same number of times before it is actually made available for
* other threads in the system (this is known as a "recursive mutex"). * other threads in the system (this is known as a "recursive mutex").
* *
* \param mutex the mutex to lock. * \param mutex the mutex to lock
* \return 0, or -1 on error. * \return 0, or -1 on error.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -182,7 +182,7 @@ extern DECLSPEC int SDLCALL SDL_LockMutex(SDL_mutex * mutex) SDL_ACQUIRE(mutex);
* This technique is useful if you need exclusive access to a resource but * This technique is useful if you need exclusive access to a resource but
* don't want to wait for it, and will return to it to try again later. * don't want to wait for it, and will return to it to try again later.
* *
* \param mutex the mutex to try to lock. * \param mutex the mutex to try to lock
* \returns 0, `SDL_MUTEX_TIMEDOUT`, or -1 on error; call SDL_GetError() for * \returns 0, `SDL_MUTEX_TIMEDOUT`, or -1 on error; call SDL_GetError() for
* more information. * more information.
* *
@@ -224,7 +224,7 @@ extern DECLSPEC int SDLCALL SDL_UnlockMutex(SDL_mutex * mutex) SDL_RELEASE(mutex
* to destroy a locked mutex, and may result in undefined behavior depending * to destroy a locked mutex, and may result in undefined behavior depending
* on the platform. * on the platform.
* *
* \param mutex the mutex to destroy. * \param mutex the mutex to destroy
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -256,7 +256,7 @@ typedef struct SDL_semaphore SDL_sem;
* is 0. Each post operation will atomically increment the semaphore value and * is 0. Each post operation will atomically increment the semaphore value and
* wake waiting threads and allow them to retry the wait operation. * wake waiting threads and allow them to retry the wait operation.
* *
* \param initial_value the starting value of the semaphore. * \param initial_value the starting value of the semaphore
* \returns a new semaphore or NULL on failure; call SDL_GetError() for more * \returns a new semaphore or NULL on failure; call SDL_GetError() for more
* information. * information.
* *
@@ -277,7 +277,7 @@ extern DECLSPEC SDL_sem *SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
* It is not safe to destroy a semaphore if there are threads currently * It is not safe to destroy a semaphore if there are threads currently
* waiting on it. * waiting on it.
* *
* \param sem the semaphore to destroy. * \param sem the semaphore to destroy
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -301,7 +301,7 @@ extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem * sem);
* This function is the equivalent of calling SDL_SemWaitTimeout() with a time * This function is the equivalent of calling SDL_SemWaitTimeout() with a time
* length of `SDL_MUTEX_MAXWAIT`. * length of `SDL_MUTEX_MAXWAIT`.
* *
* \param sem the semaphore wait on. * \param sem the semaphore wait on
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -325,7 +325,7 @@ extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem * sem);
* the semaphore doesn't have a positive value, the function immediately * the semaphore doesn't have a positive value, the function immediately
* returns SDL_MUTEX_TIMEDOUT. * returns SDL_MUTEX_TIMEDOUT.
* *
* \param sem the semaphore to wait on. * \param sem the semaphore to wait on
* \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait would * \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait would
* block, or a negative error code on failure; call SDL_GetError() * block, or a negative error code on failure; call SDL_GetError()
* for more information. * for more information.
@@ -349,8 +349,8 @@ extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem * sem);
* signal or error, or the specified time has elapsed. If the call is * signal or error, or the specified time has elapsed. If the call is
* successful it will atomically decrement the semaphore value. * successful it will atomically decrement the semaphore value.
* *
* \param sem the semaphore to wait on. * \param sem the semaphore to wait on
* \param timeout the length of the timeout, in milliseconds. * \param timeout the length of the timeout, in milliseconds
* \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait does not * \returns 0 if the wait succeeds, `SDL_MUTEX_TIMEDOUT` if the wait does not
* succeed in the allotted time, or a negative error code on failure; * succeed in the allotted time, or a negative error code on failure;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
@@ -369,7 +369,7 @@ extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout);
/** /**
* Atomically increment a semaphore's value and wake waiting threads. * Atomically increment a semaphore's value and wake waiting threads.
* *
* \param sem the semaphore to increment. * \param sem the semaphore to increment
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -387,7 +387,7 @@ extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem * sem);
/** /**
* Get the current value of a semaphore. * Get the current value of a semaphore.
* *
* \param sem the semaphore to query. * \param sem the semaphore to query
* \returns the current value of the semaphore. * \returns the current value of the semaphore.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -427,7 +427,7 @@ extern DECLSPEC SDL_cond *SDLCALL SDL_CreateCond(void);
/** /**
* Destroy a condition variable. * Destroy a condition variable.
* *
* \param cond the condition variable to destroy. * \param cond the condition variable to destroy
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -442,7 +442,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond * cond);
/** /**
* Restart one of the threads that are waiting on the condition variable. * Restart one of the threads that are waiting on the condition variable.
* *
* \param cond the condition variable to signal. * \param cond the condition variable to signal
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -459,7 +459,7 @@ extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond * cond);
/** /**
* Restart all threads that are waiting on the condition variable. * Restart all threads that are waiting on the condition variable.
* *
* \param cond the condition variable to signal. * \param cond the condition variable to signal
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -486,8 +486,8 @@ extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond * cond);
* This function is the equivalent of calling SDL_CondWaitTimeout() with a * This function is the equivalent of calling SDL_CondWaitTimeout() with a
* time length of `SDL_MUTEX_MAXWAIT`. * time length of `SDL_MUTEX_MAXWAIT`.
* *
* \param cond the condition variable to wait on. * \param cond the condition variable to wait on
* \param mutex the mutex used to coordinate thread access. * \param mutex the mutex used to coordinate thread access
* \returns 0 when it is signaled or a negative error code on failure; call * \returns 0 when it is signaled or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -512,10 +512,10 @@ extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond * cond, SDL_mutex * mutex);
* *
* The mutex must be locked before calling this function. * The mutex must be locked before calling this function.
* *
* \param cond the condition variable to wait on. * \param cond the condition variable to wait on
* \param mutex the mutex used to coordinate thread access. * \param mutex the mutex used to coordinate thread access
* \param ms the maximum time to wait, in milliseconds, or `SDL_MUTEX_MAXWAIT` * \param ms the maximum time to wait, in milliseconds, or `SDL_MUTEX_MAXWAIT`
* to wait indefinitely. * to wait indefinitely
* \returns 0 if the condition variable is signaled, `SDL_MUTEX_TIMEDOUT` if * \returns 0 if the condition variable is signaled, `SDL_MUTEX_TIMEDOUT` if
* the condition is not signaled in the allotted time, or a negative * the condition is not signaled in the allotted time, or a negative
* error code on failure; call SDL_GetError() for more information. * error code on failure; call SDL_GetError() for more information.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,11 +19,17 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* This is a simple file to encapsulate the OpenGL API headers. * \file SDL_opengl.h
* *
* Define NO_SDL_GLEXT if you have your own version of glext.h and want * This is a simple file to encapsulate the OpenGL API headers.
* to disable the version included in SDL_opengl.h. */
/**
* \def NO_SDL_GLEXT
*
* Define this if you have your own version of glext.h and want to disable the
* version included in SDL_opengl.h.
*/ */
#ifndef SDL_opengl_h_ #ifndef SDL_opengl_h_
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,10 +19,11 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* This is a simple file to encapsulate the OpenGL ES 1.X API headers. * \file SDL_opengles.h
*
* This is a simple file to encapsulate the OpenGL ES 1.X API headers.
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#ifdef __IPHONEOS__ #ifdef __IPHONEOS__
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,10 +19,11 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* This is a simple file to encapsulate the OpenGL ES 2.0 API headers. * \file SDL_opengles2.h
*
* This is a simple file to encapsulate the OpenGL ES 2.0 API headers.
*/ */
#include "SDL_config.h" #include "SDL_config.h"
#if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS) #if !defined(_MSC_VER) && !defined(SDL_USE_BUILTIN_OPENGL_DEFINITIONS)
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryPixels * \file SDL_pixels.h
* *
* Header for the enumerated pixel format definitions. * Header for the enumerated pixel format definitions.
*/ */
#ifndef SDL_pixels_h_ #ifndef SDL_pixels_h_
@@ -61,10 +61,7 @@ typedef enum
SDL_PIXELTYPE_ARRAYU16, SDL_PIXELTYPE_ARRAYU16,
SDL_PIXELTYPE_ARRAYU32, SDL_PIXELTYPE_ARRAYU32,
SDL_PIXELTYPE_ARRAYF16, SDL_PIXELTYPE_ARRAYF16,
SDL_PIXELTYPE_ARRAYF32, SDL_PIXELTYPE_ARRAYF32
/* This must be at the end of the list to avoid breaking the existing ABI */
SDL_PIXELTYPE_INDEX2
} SDL_PixelType; } SDL_PixelType;
/** Bitmap pixel order, high bit -> low bit. */ /** Bitmap pixel order, high bit -> low bit. */
@@ -137,7 +134,6 @@ typedef enum
#define SDL_ISPIXELFORMAT_INDEXED(format) \ #define SDL_ISPIXELFORMAT_INDEXED(format) \
(!SDL_ISPIXELFORMAT_FOURCC(format) && \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \
((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \
(SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8)))
@@ -181,12 +177,6 @@ typedef enum
SDL_PIXELFORMAT_INDEX1MSB = SDL_PIXELFORMAT_INDEX1MSB =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0,
1, 0), 1, 0),
SDL_PIXELFORMAT_INDEX2LSB =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_4321, 0,
2, 0),
SDL_PIXELFORMAT_INDEX2MSB =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_1234, 0,
2, 0),
SDL_PIXELFORMAT_INDEX4LSB = SDL_PIXELFORMAT_INDEX4LSB =
SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0, SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0,
4, 0), 4, 0),
@@ -286,19 +276,11 @@ typedef enum
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888,
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_RGBX8888,
SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_XRGB8888,
SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_BGRX8888,
SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_XBGR8888,
#else #else
SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888,
SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888,
SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888,
SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888,
SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_XBGR8888,
SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_BGRX8888,
SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_XRGB8888,
SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_RGBX8888,
#endif #endif
SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */ SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */
@@ -320,10 +302,9 @@ typedef enum
} SDL_PixelFormatEnum; } SDL_PixelFormatEnum;
/** /**
* The bits of this structure can be directly reinterpreted as an * The bits of this structure can be directly reinterpreted as an integer-packed
* integer-packed color which uses the SDL_PIXELFORMAT_RGBA32 format * color which uses the SDL_PIXELFORMAT_RGBA32 format (SDL_PIXELFORMAT_ABGR8888
* (SDL_PIXELFORMAT_ABGR8888 on little-endian systems and * on little-endian systems and SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
* SDL_PIXELFORMAT_RGBA8888 on big-endian systems).
*/ */
typedef struct SDL_Color typedef struct SDL_Color
{ {
@@ -343,30 +324,7 @@ typedef struct SDL_Palette
} SDL_Palette; } SDL_Palette;
/** /**
* A structure that contains pixel format information. * \note Everything in the pixel format structure is read-only.
*
* Everything in the pixel format structure is read-only.
*
* A pixel format has either a palette or masks. If a palette is used `Rmask`,
* `Gmask`, `Bmask`, and `Amask` will be 0.
*
* An SDL_PixelFormat describes the format of the pixel data stored at the
* `pixels` field of an SDL_Surface. Every surface stores an SDL_PixelFormat
* in the `format` field.
*
* If you wish to do pixel level modifications on a surface, then
* understanding how SDL stores its color information is essential.
*
* For information on modern pixel color spaces, see the following Wikipedia
* article: http://en.wikipedia.org/wiki/RGBA_color_space
*
* \sa SDL_ConvertSurface
* \sa SDL_GetRGB
* \sa SDL_GetRGBA
* \sa SDL_MapRGB
* \sa SDL_MapRGBA
* \sa SDL_AllocFormat
* \sa SDL_FreeFormat
*/ */
typedef struct SDL_PixelFormat typedef struct SDL_PixelFormat
{ {
@@ -394,7 +352,7 @@ typedef struct SDL_PixelFormat
/** /**
* Get the human readable name of a pixel format. * Get the human readable name of a pixel format.
* *
* \param format the pixel format to query. * \param format the pixel format to query
* \returns the human readable name of the specified pixel format or * \returns the human readable name of the specified pixel format or
* `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized. * `SDL_PIXELFORMAT_UNKNOWN` if the format isn't recognized.
* *
@@ -405,12 +363,12 @@ extern DECLSPEC const char* SDLCALL SDL_GetPixelFormatName(Uint32 format);
/** /**
* Convert one of the enumerated pixel formats to a bpp value and RGBA masks. * Convert one of the enumerated pixel formats to a bpp value and RGBA masks.
* *
* \param format one of the SDL_PixelFormatEnum values. * \param format one of the SDL_PixelFormatEnum values
* \param bpp a bits per pixel value; usually 15, 16, or 32. * \param bpp a bits per pixel value; usually 15, 16, or 32
* \param Rmask a pointer filled in with the red mask for the format. * \param Rmask a pointer filled in with the red mask for the format
* \param Gmask a pointer filled in with the green mask for the format. * \param Gmask a pointer filled in with the green mask for the format
* \param Bmask a pointer filled in with the blue mask for the format. * \param Bmask a pointer filled in with the blue mask for the format
* \param Amask a pointer filled in with the alpha mask for the format. * \param Amask a pointer filled in with the alpha mask for the format
* \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't * \returns SDL_TRUE on success or SDL_FALSE if the conversion wasn't
* possible; call SDL_GetError() for more information. * possible; call SDL_GetError() for more information.
* *
@@ -431,12 +389,12 @@ extern DECLSPEC SDL_bool SDLCALL SDL_PixelFormatEnumToMasks(Uint32 format,
* This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't * This will return `SDL_PIXELFORMAT_UNKNOWN` if the conversion wasn't
* possible. * possible.
* *
* \param bpp a bits per pixel value; usually 15, 16, or 32. * \param bpp a bits per pixel value; usually 15, 16, or 32
* \param Rmask the red mask for the format. * \param Rmask the red mask for the format
* \param Gmask the green mask for the format. * \param Gmask the green mask for the format
* \param Bmask the blue mask for the format. * \param Bmask the blue mask for the format
* \param Amask the alpha mask for the format. * \param Amask the alpha mask for the format
* \returns one of the SDL_PixelFormatEnum values. * \returns one of the SDL_PixelFormatEnum values
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -455,7 +413,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_MasksToPixelFormatEnum(int bpp,
* allocated), and hence should not be modified, especially the palette. Weird * allocated), and hence should not be modified, especially the palette. Weird
* errors such as `Blit combination not supported` may occur. * errors such as `Blit combination not supported` may occur.
* *
* \param pixel_format one of the SDL_PixelFormatEnum values. * \param pixel_format one of the SDL_PixelFormatEnum values
* \returns the new SDL_PixelFormat structure or NULL on failure; call * \returns the new SDL_PixelFormat structure or NULL on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -468,7 +426,7 @@ extern DECLSPEC SDL_PixelFormat * SDLCALL SDL_AllocFormat(Uint32 pixel_format);
/** /**
* Free an SDL_PixelFormat structure allocated by SDL_AllocFormat(). * Free an SDL_PixelFormat structure allocated by SDL_AllocFormat().
* *
* \param format the SDL_PixelFormat structure to free. * \param format the SDL_PixelFormat structure to free
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -481,7 +439,7 @@ extern DECLSPEC void SDLCALL SDL_FreeFormat(SDL_PixelFormat *format);
* *
* The palette entries are initialized to white. * The palette entries are initialized to white.
* *
* \param ncolors represents the number of color entries in the color palette. * \param ncolors represents the number of color entries in the color palette
* \returns a new SDL_Palette structure on success or NULL on failure (e.g. if * \returns a new SDL_Palette structure on success or NULL on failure (e.g. if
* there wasn't enough memory); call SDL_GetError() for more * there wasn't enough memory); call SDL_GetError() for more
* information. * information.
@@ -495,8 +453,8 @@ extern DECLSPEC SDL_Palette *SDLCALL SDL_AllocPalette(int ncolors);
/** /**
* Set the palette for a pixel format structure. * Set the palette for a pixel format structure.
* *
* \param format the SDL_PixelFormat structure that will use the palette. * \param format the SDL_PixelFormat structure that will use the palette
* \param palette the SDL_Palette structure that will be used. * \param palette the SDL_Palette structure that will be used
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -511,10 +469,10 @@ extern DECLSPEC int SDLCALL SDL_SetPixelFormatPalette(SDL_PixelFormat * format,
/** /**
* Set a range of colors in a palette. * Set a range of colors in a palette.
* *
* \param palette the SDL_Palette structure to modify. * \param palette the SDL_Palette structure to modify
* \param colors an array of SDL_Color structures to copy into the palette. * \param colors an array of SDL_Color structures to copy into the palette
* \param firstcolor the index of the first palette entry to modify. * \param firstcolor the index of the first palette entry to modify
* \param ncolors the number of entries to modify. * \param ncolors the number of entries to modify
* \returns 0 on success or a negative error code if not all of the colors * \returns 0 on success or a negative error code if not all of the colors
* could be set; call SDL_GetError() for more information. * could be set; call SDL_GetError() for more information.
* *
@@ -530,7 +488,7 @@ extern DECLSPEC int SDLCALL SDL_SetPaletteColors(SDL_Palette * palette,
/** /**
* Free a palette created with SDL_AllocPalette(). * Free a palette created with SDL_AllocPalette().
* *
* \param palette the SDL_Palette structure to be freed. * \param palette the SDL_Palette structure to be freed
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -556,11 +514,11 @@ extern DECLSPEC void SDLCALL SDL_FreePalette(SDL_Palette * palette);
* format the return value can be assigned to a Uint16, and similarly a Uint8 * format the return value can be assigned to a Uint16, and similarly a Uint8
* for an 8-bpp format). * for an 8-bpp format).
* *
* \param format an SDL_PixelFormat structure describing the pixel format. * \param format an SDL_PixelFormat structure describing the pixel format
* \param r the red component of the pixel in the range 0-255. * \param r the red component of the pixel in the range 0-255
* \param g the green component of the pixel in the range 0-255. * \param g the green component of the pixel in the range 0-255
* \param b the blue component of the pixel in the range 0-255. * \param b the blue component of the pixel in the range 0-255
* \returns a pixel value. * \returns a pixel value
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -590,12 +548,12 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGB(const SDL_PixelFormat * format,
* for an 8-bpp format). * for an 8-bpp format).
* *
* \param format an SDL_PixelFormat structure describing the format of the * \param format an SDL_PixelFormat structure describing the format of the
* pixel. * pixel
* \param r the red component of the pixel in the range 0-255. * \param r the red component of the pixel in the range 0-255
* \param g the green component of the pixel in the range 0-255. * \param g the green component of the pixel in the range 0-255
* \param b the blue component of the pixel in the range 0-255. * \param b the blue component of the pixel in the range 0-255
* \param a the alpha component of the pixel in the range 0-255. * \param a the alpha component of the pixel in the range 0-255
* \returns a pixel value. * \returns a pixel value
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -615,12 +573,12 @@ extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(const SDL_PixelFormat * format,
* (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, * (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff,
* 0xff, 0xff] not [0xf8, 0xfc, 0xf8]). * 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).
* *
* \param pixel a pixel value. * \param pixel a pixel value
* \param format an SDL_PixelFormat structure describing the format of the * \param format an SDL_PixelFormat structure describing the format of the
* pixel. * pixel
* \param r a pointer filled in with the red component. * \param r a pointer filled in with the red component
* \param g a pointer filled in with the green component. * \param g a pointer filled in with the green component
* \param b a pointer filled in with the blue component. * \param b a pointer filled in with the blue component
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -643,13 +601,13 @@ extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel,
* If the surface has no alpha component, the alpha will be returned as 0xff * If the surface has no alpha component, the alpha will be returned as 0xff
* (100% opaque). * (100% opaque).
* *
* \param pixel a pixel value. * \param pixel a pixel value
* \param format an SDL_PixelFormat structure describing the format of the * \param format an SDL_PixelFormat structure describing the format of the
* pixel. * pixel
* \param r a pointer filled in with the red component. * \param r a pointer filled in with the red component
* \param g a pointer filled in with the green component. * \param g a pointer filled in with the green component
* \param b a pointer filled in with the blue component. * \param b a pointer filled in with the blue component
* \param a a pointer filled in with the alpha component. * \param a a pointer filled in with the alpha component
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -665,8 +623,8 @@ extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel,
/** /**
* Calculate a 256 entry gamma ramp for a gamma value. * Calculate a 256 entry gamma ramp for a gamma value.
* *
* \param gamma a gamma value where 0.0 is black and 1.0 is identity. * \param gamma a gamma value where 0.0 is black and 1.0 is identity
* \param ramp an array of 256 values filled in with the gamma ramp. * \param ramp an array of 256 values filled in with the gamma ramp
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryPlatform * \file SDL_platform.h
* *
* Try to get a standard set of platform defines. * Try to get a standard set of platform defines.
*/ */
#ifndef SDL_platform_h_ #ifndef SDL_platform_h_
@@ -73,13 +73,7 @@
#if defined(__APPLE__) #if defined(__APPLE__)
/* lets us know what version of Mac OS X we're compiling on */ /* lets us know what version of Mac OS X we're compiling on */
#include <AvailabilityMacros.h> #include <AvailabilityMacros.h>
#ifndef __has_extension /* Older compilers don't support this */
#define __has_extension(x) 0
#include <TargetConditionals.h> #include <TargetConditionals.h>
#undef __has_extension
#else
#include <TargetConditionals.h>
#endif
/* Fix building with older SDKs that don't define these /* Fix building with older SDKs that don't define these
See this for more information: See this for more information:
@@ -172,12 +166,6 @@
#define WINAPI_FAMILY_WINRT 0 #define WINAPI_FAMILY_WINRT 0
#endif /* HAVE_WINAPIFAMILY_H */ #endif /* HAVE_WINAPIFAMILY_H */
#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP)
#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
#else
#define SDL_WINAPI_FAMILY_PHONE 0
#endif
#if WINAPI_FAMILY_WINRT #if WINAPI_FAMILY_WINRT
#undef __WINRT__ #undef __WINRT__
#define __WINRT__ 1 #define __WINRT__ 1
@@ -205,10 +193,8 @@
#undef __GDK__ #undef __GDK__
#define __GDK__ 1 #define __GDK__ 1
#endif #endif
#if defined(__PSP__) || defined(__psp__) #if defined(__PSP__)
#ifdef __PSP__
#undef __PSP__ #undef __PSP__
#endif
#define __PSP__ 1 #define __PSP__ 1
#endif #endif
#if defined(PS2) #if defined(PS2)
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -23,9 +23,9 @@
#define SDL_power_h_ #define SDL_power_h_
/** /**
* # CategoryPower * \file SDL_power.h
* *
* Header for the SDL power management routines. * Header for the SDL power management routines.
*/ */
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
@@ -37,9 +37,9 @@ extern "C" {
#endif #endif
/** /**
* The basic state for the system's power supply. * The basic state for the system's power supply.
*/ */
typedef enum SDL_PowerState typedef enum
{ {
SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */ SDL_POWERSTATE_UNKNOWN, /**< cannot determine power status */
SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ SDL_POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */
@@ -66,10 +66,10 @@ typedef enum SDL_PowerState
* *
* \param seconds seconds of battery life left, you can pass a NULL here if * \param seconds seconds of battery life left, you can pass a NULL here if
* you don't care, will return -1 if we can't determine a * you don't care, will return -1 if we can't determine a
* value, or we're not running on a battery. * value, or we're not running on a battery
* \param percent percentage of battery life left, between 0 and 100, you can * \param percent percentage of battery life left, between 0 and 100, you can
* pass a NULL here if you don't care, will return -1 if we * pass a NULL here if you don't care, will return -1 if we
* can't determine a value, or we're not running on a battery. * can't determine a value, or we're not running on a battery
* \returns an SDL_PowerState enum representing the current battery state. * \returns an SDL_PowerState enum representing the current battery state.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,20 +20,9 @@
*/ */
/** /**
* # CategoryQuit * \file SDL_quit.h
* *
* An SDL_QUIT event is generated when the user tries to close the application * Include file for SDL quit event handling.
* window. If it is ignored or filtered out, the window will remain open. If
* it is not ignored or filtered, it is queued normally and the window is
* allowed to close. When the window is closed, screen updates will complete,
* but have no effect.
*
* SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) and
* SIGTERM (system termination request), if handlers do not already exist,
* that generate SDL_QUIT events as well. There is no way to determine the
* cause of an SDL_QUIT event, but setting a signal handler in your
* application will override the default generation of quit events for that
* signal.
*/ */
#ifndef SDL_quit_h_ #ifndef SDL_quit_h_
@@ -42,6 +31,25 @@
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
#include "SDL_error.h" #include "SDL_error.h"
/**
* \file SDL_quit.h
*
* An ::SDL_QUIT event is generated when the user tries to close the application
* window. If it is ignored or filtered out, the window will remain open.
* If it is not ignored or filtered, it is queued normally and the window
* is allowed to close. When the window is closed, screen updates will
* complete, but have no effect.
*
* SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
* and SIGTERM (system termination request), if handlers do not already
* exist, that generate ::SDL_QUIT events as well. There is no way
* to determine the cause of an ::SDL_QUIT event, but setting a signal
* handler in your application will override the default generation of
* quit events for that signal.
*
* \sa SDL_Quit()
*/
/* There are no functions directly affecting the quit event */ /* There are no functions directly affecting the quit event */
#define SDL_QuitRequested() \ #define SDL_QuitRequested() \
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryRect * \file SDL_rect.h
* *
* Header file for SDL_rect definition and management functions. * Header file for SDL_rect definition and management functions.
*/ */
#ifndef SDL_rect_h_ #ifndef SDL_rect_h_
@@ -135,8 +135,8 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEquals(const SDL_Rect *a, const SDL_Rect *b)
* *
* If either pointer is NULL the function will return SDL_FALSE. * If either pointer is NULL the function will return SDL_FALSE.
* *
* \param A an SDL_Rect structure representing the first rectangle. * \param A an SDL_Rect structure representing the first rectangle
* \param B an SDL_Rect structure representing the second rectangle. * \param B an SDL_Rect structure representing the second rectangle
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -151,10 +151,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersection(const SDL_Rect * A,
* *
* If `result` is NULL then this function will return SDL_FALSE. * If `result` is NULL then this function will return SDL_FALSE.
* *
* \param A an SDL_Rect structure representing the first rectangle. * \param A an SDL_Rect structure representing the first rectangle
* \param B an SDL_Rect structure representing the second rectangle. * \param B an SDL_Rect structure representing the second rectangle
* \param result an SDL_Rect structure filled in with the intersection of * \param result an SDL_Rect structure filled in with the intersection of
* rectangles `A` and `B`. * rectangles `A` and `B`
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -168,10 +168,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRect(const SDL_Rect * A,
/** /**
* Calculate the union of two rectangles. * Calculate the union of two rectangles.
* *
* \param A an SDL_Rect structure representing the first rectangle. * \param A an SDL_Rect structure representing the first rectangle
* \param B an SDL_Rect structure representing the second rectangle. * \param B an SDL_Rect structure representing the second rectangle
* \param result an SDL_Rect structure filled in with the union of rectangles * \param result an SDL_Rect structure filled in with the union of rectangles
* `A` and `B`. * `A` and `B`
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
@@ -186,11 +186,11 @@ extern DECLSPEC void SDLCALL SDL_UnionRect(const SDL_Rect * A,
* considered. * considered.
* *
* \param points an array of SDL_Point structures representing points to be * \param points an array of SDL_Point structures representing points to be
* enclosed. * enclosed
* \param count the number of structures in the `points` array. * \param count the number of structures in the `points` array
* \param clip an SDL_Rect used for clipping or NULL to enclose all points. * \param clip an SDL_Rect used for clipping or NULL to enclose all points
* \param result an SDL_Rect structure filled in with the minimal enclosing * \param result an SDL_Rect structure filled in with the minimal enclosing
* rectangle. * rectangle
* \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the
* points were outside of the clipping rectangle. * points were outside of the clipping rectangle.
* *
@@ -210,11 +210,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EnclosePoints(const SDL_Point * points,
* both ends will be clipped to the boundary of the rectangle and the new * both ends will be clipped to the boundary of the rectangle and the new
* coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary.
* *
* \param rect an SDL_Rect structure representing the rectangle to intersect. * \param rect an SDL_Rect structure representing the rectangle to intersect
* \param X1 a pointer to the starting X-coordinate of the line. * \param X1 a pointer to the starting X-coordinate of the line
* \param Y1 a pointer to the starting Y-coordinate of the line. * \param Y1 a pointer to the starting Y-coordinate of the line
* \param X2 a pointer to the ending X-coordinate of the line. * \param X2 a pointer to the ending X-coordinate of the line
* \param Y2 a pointer to the ending Y-coordinate of the line. * \param Y2 a pointer to the ending Y-coordinate of the line
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -274,8 +274,8 @@ SDL_FORCE_INLINE SDL_bool SDL_FRectEquals(const SDL_FRect *a, const SDL_FRect *b
* *
* If either pointer is NULL the function will return SDL_FALSE. * If either pointer is NULL the function will return SDL_FALSE.
* *
* \param A an SDL_FRect structure representing the first rectangle. * \param A an SDL_FRect structure representing the first rectangle
* \param B an SDL_FRect structure representing the second rectangle. * \param B an SDL_FRect structure representing the second rectangle
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.22. * \since This function is available since SDL 2.0.22.
@@ -290,10 +290,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasIntersectionF(const SDL_FRect * A,
* *
* If `result` is NULL then this function will return SDL_FALSE. * If `result` is NULL then this function will return SDL_FALSE.
* *
* \param A an SDL_FRect structure representing the first rectangle. * \param A an SDL_FRect structure representing the first rectangle
* \param B an SDL_FRect structure representing the second rectangle. * \param B an SDL_FRect structure representing the second rectangle
* \param result an SDL_FRect structure filled in with the intersection of * \param result an SDL_FRect structure filled in with the intersection of
* rectangles `A` and `B`. * rectangles `A` and `B`
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.22. * \since This function is available since SDL 2.0.22.
@@ -307,10 +307,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectFRect(const SDL_FRect * A,
/** /**
* Calculate the union of two rectangles with float precision. * Calculate the union of two rectangles with float precision.
* *
* \param A an SDL_FRect structure representing the first rectangle. * \param A an SDL_FRect structure representing the first rectangle
* \param B an SDL_FRect structure representing the second rectangle. * \param B an SDL_FRect structure representing the second rectangle
* \param result an SDL_FRect structure filled in with the union of rectangles * \param result an SDL_FRect structure filled in with the union of rectangles
* `A` and `B`. * `A` and `B`
* *
* \since This function is available since SDL 2.0.22. * \since This function is available since SDL 2.0.22.
*/ */
@@ -326,11 +326,11 @@ extern DECLSPEC void SDLCALL SDL_UnionFRect(const SDL_FRect * A,
* considered. * considered.
* *
* \param points an array of SDL_FPoint structures representing points to be * \param points an array of SDL_FPoint structures representing points to be
* enclosed. * enclosed
* \param count the number of structures in the `points` array. * \param count the number of structures in the `points` array
* \param clip an SDL_FRect used for clipping or NULL to enclose all points. * \param clip an SDL_FRect used for clipping or NULL to enclose all points
* \param result an SDL_FRect structure filled in with the minimal enclosing * \param result an SDL_FRect structure filled in with the minimal enclosing
* rectangle. * rectangle
* \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the
* points were outside of the clipping rectangle. * points were outside of the clipping rectangle.
* *
@@ -351,11 +351,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_EncloseFPoints(const SDL_FPoint * points,
* both ends will be clipped to the boundary of the rectangle and the new * both ends will be clipped to the boundary of the rectangle and the new
* coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary. * coordinates saved in `X1`, `Y1`, `X2`, and/or `Y2` as necessary.
* *
* \param rect an SDL_FRect structure representing the rectangle to intersect. * \param rect an SDL_FRect structure representing the rectangle to intersect
* \param X1 a pointer to the starting X-coordinate of the line. * \param X1 a pointer to the starting X-coordinate of the line
* \param Y1 a pointer to the starting Y-coordinate of the line. * \param Y1 a pointer to the starting Y-coordinate of the line
* \param X2 a pointer to the ending X-coordinate of the line. * \param X2 a pointer to the ending X-coordinate of the line
* \param Y2 a pointer to the ending Y-coordinate of the line. * \param Y2 a pointer to the ending Y-coordinate of the line
* \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.22. * \since This function is available since SDL 2.0.22.
File diff suppressed because it is too large. Load diff
@@ -1,7 +1,7 @@
/* Generated by updaterev.sh, do not edit */ /* Generated by updaterev.sh, do not edit */
#ifdef SDL_VENDOR_INFO #ifdef SDL_VENDOR_INFO
#define SDL_REVISION "SDL-release-2.32.10-0-g5d2495703 (" SDL_VENDOR_INFO ")" #define SDL_REVISION "SDL-release-2.28.5-0-g15ead9a40 (" SDL_VENDOR_INFO ")"
#else #else
#define SDL_REVISION "SDL-release-2.32.10-0-g5d2495703" #define SDL_REVISION "SDL-release-2.28.5-0-g15ead9a40"
#endif #endif
#define SDL_REVISION_NUMBER 0 #define SDL_REVISION_NUMBER 0
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,13 +19,11 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: RWOPS */
/** /**
* # CategoryRWOPS * \file SDL_rwops.h
* *
* This file provides a general interface for SDL to read and write data * This file provides a general interface for SDL to read and write
* streams. It can easily be extended to files, memory, etc. * data streams. It can easily be extended to files, memory, etc.
*/ */
#ifndef SDL_rwops_h_ #ifndef SDL_rwops_h_
@@ -59,7 +57,7 @@ typedef struct SDL_RWops
Sint64 (SDLCALL * size) (struct SDL_RWops * context); Sint64 (SDLCALL * size) (struct SDL_RWops * context);
/** /**
* Seek to `offset` relative to `whence`, one of stdio's whence values: * Seek to \c offset relative to \c whence, one of stdio's whence values:
* RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END * RW_SEEK_SET, RW_SEEK_CUR, RW_SEEK_END
* *
* \return the final offset in the data stream, or -1 on error. * \return the final offset in the data stream, or -1 on error.
@@ -68,8 +66,8 @@ typedef struct SDL_RWops
int whence); int whence);
/** /**
* Read up to `maxnum` objects each of size `size` from the data * Read up to \c maxnum objects each of size \c size from the data
* stream to the area pointed at by `ptr`. * stream to the area pointed at by \c ptr.
* *
* \return the number of objects read, or 0 at error or end of file. * \return the number of objects read, or 0 at error or end of file.
*/ */
@@ -77,8 +75,8 @@ typedef struct SDL_RWops
size_t size, size_t maxnum); size_t size, size_t maxnum);
/** /**
* Write exactly `num` objects each of size `size` from the area * Write exactly \c num objects each of size \c size from the area
* pointed at by `ptr` to data stream. * pointed at by \c ptr to data stream.
* *
* \return the number of objects written, or 0 at error or end of file. * \return the number of objects written, or 0 at error or end of file.
*/ */
@@ -188,7 +186,7 @@ typedef struct SDL_RWops
* *
* Closing the SDL_RWops will close the file handle SDL is holding internally. * Closing the SDL_RWops will close the file handle SDL is holding internally.
* *
* \param file a UTF-8 string representing the filename to open. * \param file a UTF-8 string representing the filename to open
* \param mode an ASCII string representing the mode to be used for opening * \param mode an ASCII string representing the mode to be used for opening
* the file. * the file.
* \returns a pointer to the SDL_RWops structure that is created, or NULL on * \returns a pointer to the SDL_RWops structure that is created, or NULL on
@@ -226,10 +224,10 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(FILE * fp, SDL_bool autoclose);
* `FILE*`, depending on what system headers are available to SDL. It is * `FILE*`, depending on what system headers are available to SDL. It is
* always intended to be the `FILE*` type from the C runtime's stdio.h. * always intended to be the `FILE*` type from the C runtime's stdio.h.
* *
* \param fp the `FILE*` that feeds the SDL_RWops stream. * \param fp the `FILE*` that feeds the SDL_RWops stream
* \param autoclose SDL_TRUE to close the `FILE*` when closing the SDL_RWops, * \param autoclose SDL_TRUE to close the `FILE*` when closing the SDL_RWops,
* SDL_FALSE to leave the `FILE*` open when the RWops is * SDL_FALSE to leave the `FILE*` open when the RWops is
* closed. * closed
* \returns a pointer to the SDL_RWops structure that is created, or NULL on * \returns a pointer to the SDL_RWops structure that is created, or NULL on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -262,8 +260,8 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromFP(void * fp,
* If you need to make sure the RWops never writes to the memory buffer, you * If you need to make sure the RWops never writes to the memory buffer, you
* should use SDL_RWFromConstMem() with a read-only buffer of memory instead. * should use SDL_RWFromConstMem() with a read-only buffer of memory instead.
* *
* \param mem a pointer to a buffer to feed an SDL_RWops stream. * \param mem a pointer to a buffer to feed an SDL_RWops stream
* \param size the buffer size, in bytes. * \param size the buffer size, in bytes
* \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call * \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -297,8 +295,8 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_RWFromMem(void *mem, int size);
* If you need to write to a memory buffer, you should use SDL_RWFromMem() * If you need to write to a memory buffer, you should use SDL_RWFromMem()
* with a writable buffer of memory instead. * with a writable buffer of memory instead.
* *
* \param mem a pointer to a read-only buffer to feed an SDL_RWops stream. * \param mem a pointer to a read-only buffer to feed an SDL_RWops stream
* \param size the buffer size, in bytes. * \param size the buffer size, in bytes
* \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call * \returns a pointer to a new SDL_RWops structure, or NULL if it fails; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -360,7 +358,7 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
* creation of the SDL_RWops is not freed by SDL_FreeRW(); the programmer must * creation of the SDL_RWops is not freed by SDL_FreeRW(); the programmer must
* be responsible for managing that memory in their **close** method. * be responsible for managing that memory in their **close** method.
* *
* \param area the SDL_RWops structure to be freed. * \param area the SDL_RWops structure to be freed
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -368,7 +366,6 @@ extern DECLSPEC SDL_RWops *SDLCALL SDL_AllocRW(void);
*/ */
extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
/* Possible `whence` values for SDL_RWops seeking... */
#define RW_SEEK_SET 0 /**< Seek from the beginning of data */ #define RW_SEEK_SET 0 /**< Seek from the beginning of data */
#define RW_SEEK_CUR 1 /**< Seek relative to current read point */ #define RW_SEEK_CUR 1 /**< Seek relative to current read point */
#define RW_SEEK_END 2 /**< Seek relative to the end of data */ #define RW_SEEK_END 2 /**< Seek relative to the end of data */
@@ -378,7 +375,7 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area);
* *
* Prior to SDL 2.0.10, this function was a macro. * Prior to SDL 2.0.10, this function was a macro.
* *
* \param context the SDL_RWops to get the size of the data stream from. * \param context the SDL_RWops to get the size of the data stream from
* \returns the size of the data stream in the SDL_RWops on success, -1 if * \returns the size of the data stream in the SDL_RWops on success, -1 if
* unknown or a negative error code on failure; call SDL_GetError() * unknown or a negative error code on failure; call SDL_GetError()
* for more information. * for more information.
@@ -405,10 +402,10 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWsize(SDL_RWops *context);
* *
* Prior to SDL 2.0.10, this function was a macro. * Prior to SDL 2.0.10, this function was a macro.
* *
* \param context a pointer to an SDL_RWops structure. * \param context a pointer to an SDL_RWops structure
* \param offset an offset in bytes, relative to **whence** location; can be * \param offset an offset in bytes, relative to **whence** location; can be
* negative. * negative
* \param whence any of `RW_SEEK_SET`, `RW_SEEK_CUR`, `RW_SEEK_END`. * \param whence any of `RW_SEEK_SET`, `RW_SEEK_CUR`, `RW_SEEK_END`
* \returns the final offset in the data stream after the seek or -1 on error. * \returns the final offset in the data stream after the seek or -1 on error.
* *
* \since This function is available since SDL 2.0.10. * \since This function is available since SDL 2.0.10.
@@ -435,7 +432,7 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWseek(SDL_RWops *context,
* Prior to SDL 2.0.10, this function was a macro. * Prior to SDL 2.0.10, this function was a macro.
* *
* \param context a SDL_RWops data stream object from which to get the current * \param context a SDL_RWops data stream object from which to get the current
* offset. * offset
* \returns the current offset in the stream, or -1 if the information can not * \returns the current offset in the stream, or -1 if the information can not
* be determined. * be determined.
* *
@@ -465,10 +462,10 @@ extern DECLSPEC Sint64 SDLCALL SDL_RWtell(SDL_RWops *context);
* *
* Prior to SDL 2.0.10, this function was a macro. * Prior to SDL 2.0.10, this function was a macro.
* *
* \param context a pointer to an SDL_RWops structure. * \param context a pointer to an SDL_RWops structure
* \param ptr a pointer to a buffer to read data into. * \param ptr a pointer to a buffer to read data into
* \param size the size of each object to read, in bytes. * \param size the size of each object to read, in bytes
* \param maxnum the maximum number of objects to be read. * \param maxnum the maximum number of objects to be read
* \returns the number of objects read, or 0 at error or end of file; call * \returns the number of objects read, or 0 at error or end of file; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -499,10 +496,10 @@ extern DECLSPEC size_t SDLCALL SDL_RWread(SDL_RWops *context,
* *
* Prior to SDL 2.0.10, this function was a macro. * Prior to SDL 2.0.10, this function was a macro.
* *
* \param context a pointer to an SDL_RWops structure. * \param context a pointer to an SDL_RWops structure
* \param ptr a pointer to a buffer containing data to write. * \param ptr a pointer to a buffer containing data to write
* \param size the size of an object to write, in bytes. * \param size the size of an object to write, in bytes
* \param num the number of objects to write. * \param num the number of objects to write
* \returns the number of objects written, which will be less than **num** on * \returns the number of objects written, which will be less than **num** on
* error; call SDL_GetError() for more information. * error; call SDL_GetError() for more information.
* *
@@ -533,7 +530,7 @@ extern DECLSPEC size_t SDLCALL SDL_RWwrite(SDL_RWops *context,
* *
* Prior to SDL 2.0.10, this function was a macro. * Prior to SDL 2.0.10, this function was a macro.
* *
* \param context SDL_RWops structure to close. * \param context SDL_RWops structure to close
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -558,9 +555,9 @@ extern DECLSPEC int SDLCALL SDL_RWclose(SDL_RWops *context);
* *
* The data should be freed with SDL_free(). * The data should be freed with SDL_free().
* *
* \param src the SDL_RWops to read all available data from. * \param src the SDL_RWops to read all available data from
* \param datasize if not NULL, will store the number of bytes read. * \param datasize if not NULL, will store the number of bytes read
* \param freesrc if non-zero, calls SDL_RWclose() on `src` before returning. * \param freesrc if non-zero, calls SDL_RWclose() on `src` before returning
* \returns the data, or NULL if there was an error. * \returns the data, or NULL if there was an error.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
@@ -581,8 +578,8 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops *src,
* Prior to SDL 2.0.10, this function was a macro wrapping around * Prior to SDL 2.0.10, this function was a macro wrapping around
* SDL_LoadFile_RW. * SDL_LoadFile_RW.
* *
* \param file the path to read all available data from. * \param file the path to read all available data from
* \param datasize if not NULL, will store the number of bytes read. * \param datasize if not NULL, will store the number of bytes read
* \returns the data, or NULL if there was an error. * \returns the data, or NULL if there was an error.
* *
* \since This function is available since SDL 2.0.10. * \since This function is available since SDL 2.0.10.
@@ -599,7 +596,7 @@ extern DECLSPEC void *SDLCALL SDL_LoadFile(const char *file, size_t *datasize);
/** /**
* Use this function to read a byte from an SDL_RWops. * Use this function to read a byte from an SDL_RWops.
* *
* \param src the SDL_RWops to read from. * \param src the SDL_RWops to read from
* \returns the read byte on success or 0 on failure; call SDL_GetError() for * \returns the read byte on success or 0 on failure; call SDL_GetError() for
* more information. * more information.
* *
@@ -616,7 +613,7 @@ extern DECLSPEC Uint8 SDLCALL SDL_ReadU8(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in * SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order. * the native byte order.
* *
* \param src the stream from which to read data. * \param src the stream from which to read data
* \returns 16 bits of data in the native byte order of the platform. * \returns 16 bits of data in the native byte order of the platform.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -632,7 +629,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in * SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order. * the native byte order.
* *
* \param src the stream from which to read data. * \param src the stream from which to read data
* \returns 16 bits of data in the native byte order of the platform. * \returns 16 bits of data in the native byte order of the platform.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -648,7 +645,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in * SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order. * the native byte order.
* *
* \param src the stream from which to read data. * \param src the stream from which to read data
* \returns 32 bits of data in the native byte order of the platform. * \returns 32 bits of data in the native byte order of the platform.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -664,7 +661,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in * SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order. * the native byte order.
* *
* \param src the stream from which to read data. * \param src the stream from which to read data
* \returns 32 bits of data in the native byte order of the platform. * \returns 32 bits of data in the native byte order of the platform.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -680,7 +677,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in * SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order. * the native byte order.
* *
* \param src the stream from which to read data. * \param src the stream from which to read data
* \returns 64 bits of data in the native byte order of the platform. * \returns 64 bits of data in the native byte order of the platform.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -696,7 +693,7 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops * src);
* SDL byteswaps the data only if necessary, so the data returned will be in * SDL byteswaps the data only if necessary, so the data returned will be in
* the native byte order. * the native byte order.
* *
* \param src the stream from which to read data. * \param src the stream from which to read data
* \returns 64 bits of data in the native byte order of the platform. * \returns 64 bits of data in the native byte order of the platform.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -716,8 +713,8 @@ extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops * src);
/** /**
* Use this function to write a byte to an SDL_RWops. * Use this function to write a byte to an SDL_RWops.
* *
* \param dst the SDL_RWops to write to. * \param dst the SDL_RWops to write to
* \param value the byte value to write. * \param value the byte value to write
* \returns 1 on success or 0 on failure; call SDL_GetError() for more * \returns 1 on success or 0 on failure; call SDL_GetError() for more
* information. * information.
* *
@@ -735,8 +732,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteU8(SDL_RWops * dst, Uint8 value);
* specifies native format, and the data written will be in little-endian * specifies native format, and the data written will be in little-endian
* format. * format.
* *
* \param dst the stream to which data will be written. * \param dst the stream to which data will be written
* \param value the data to be written, in native format. * \param value the data to be written, in native format
* \returns 1 on successful write, 0 on error. * \returns 1 on successful write, 0 on error.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -752,8 +749,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteLE16(SDL_RWops * dst, Uint16 value);
* SDL byteswaps the data only if necessary, so the application always * SDL byteswaps the data only if necessary, so the application always
* specifies native format, and the data written will be in big-endian format. * specifies native format, and the data written will be in big-endian format.
* *
* \param dst the stream to which data will be written. * \param dst the stream to which data will be written
* \param value the data to be written, in native format. * \param value the data to be written, in native format
* \returns 1 on successful write, 0 on error. * \returns 1 on successful write, 0 on error.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -770,8 +767,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE16(SDL_RWops * dst, Uint16 value);
* specifies native format, and the data written will be in little-endian * specifies native format, and the data written will be in little-endian
* format. * format.
* *
* \param dst the stream to which data will be written. * \param dst the stream to which data will be written
* \param value the data to be written, in native format. * \param value the data to be written, in native format
* \returns 1 on successful write, 0 on error. * \returns 1 on successful write, 0 on error.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -787,8 +784,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteLE32(SDL_RWops * dst, Uint32 value);
* SDL byteswaps the data only if necessary, so the application always * SDL byteswaps the data only if necessary, so the application always
* specifies native format, and the data written will be in big-endian format. * specifies native format, and the data written will be in big-endian format.
* *
* \param dst the stream to which data will be written. * \param dst the stream to which data will be written
* \param value the data to be written, in native format. * \param value the data to be written, in native format
* \returns 1 on successful write, 0 on error. * \returns 1 on successful write, 0 on error.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -805,8 +802,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE32(SDL_RWops * dst, Uint32 value);
* specifies native format, and the data written will be in little-endian * specifies native format, and the data written will be in little-endian
* format. * format.
* *
* \param dst the stream to which data will be written. * \param dst the stream to which data will be written
* \param value the data to be written, in native format. * \param value the data to be written, in native format
* \returns 1 on successful write, 0 on error. * \returns 1 on successful write, 0 on error.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -822,8 +819,8 @@ extern DECLSPEC size_t SDLCALL SDL_WriteLE64(SDL_RWops * dst, Uint64 value);
* SDL byteswaps the data only if necessary, so the application always * SDL byteswaps the data only if necessary, so the application always
* specifies native format, and the data written will be in big-endian format. * specifies native format, and the data written will be in big-endian format.
* *
* \param dst the stream to which data will be written. * \param dst the stream to which data will be written
* \param value the data to be written, in native format. * \param value the data to be written, in native format
* \returns 1 on successful write, 0 on error. * \returns 1 on successful write, 0 on error.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryScancode * \file SDL_scancode.h
* *
* Defines keyboard scancodes. * Defines keyboard scancodes.
*/ */
#ifndef SDL_scancode_h_ #ifndef SDL_scancode_h_
@@ -31,16 +31,16 @@
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
/** /**
* The SDL keyboard scancode representation. * \brief The SDL keyboard scancode representation.
* *
* Values of this type are used to represent keyboard keys, among other places * Values of this type are used to represent keyboard keys, among other places
* in the SDL_Keysym::scancode key.keysym.scancode field of the SDL_Event * in the \link SDL_Keysym::scancode key.keysym.scancode \endlink field of the
* structure. * SDL_Event structure.
* *
* The values in this enumeration are based on the USB usage page standard: * The values in this enumeration are based on the USB usage page standard:
* https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf * https://www.usb.org/sites/default/files/documents/hut1_12v2.pdf
*/ */
typedef enum SDL_Scancode typedef enum
{ {
SDL_SCANCODE_UNKNOWN = 0, SDL_SCANCODE_UNKNOWN = 0,
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,10 @@
*/ */
/** /**
* # CategorySensor * \file SDL_sensor.h
*
* Include file for SDL sensor event handling
* *
* Include file for SDL sensor event handling
*/ */
#ifndef SDL_sensor_h_ #ifndef SDL_sensor_h_
@@ -43,7 +44,7 @@ extern "C" {
* \brief SDL_sensor.h * \brief SDL_sensor.h
* *
* In order to use these functions, SDL_Init() must have been called * In order to use these functions, SDL_Init() must have been called
* with the SDL_INIT_SENSOR flag. This causes SDL to scan the system * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system
* for sensors, and load appropriate drivers. * for sensors, and load appropriate drivers.
*/ */
@@ -51,67 +52,21 @@ struct _SDL_Sensor;
typedef struct _SDL_Sensor SDL_Sensor; typedef struct _SDL_Sensor SDL_Sensor;
/** /**
* This is a unique ID for a sensor for the time it is connected to the * This is a unique ID for a sensor for the time it is connected to the system,
* system, and is never reused for the lifetime of the application. * and is never reused for the lifetime of the application.
* *
* The ID value starts at 0 and increments from there. The value -1 is an * The ID value starts at 0 and increments from there. The value -1 is an invalid ID.
* invalid ID.
*/ */
typedef Sint32 SDL_SensorID; typedef Sint32 SDL_SensorID;
/** /* The different sensors defined by SDL
* The different sensors defined by SDL.
* *
* Additional sensors may be available, using platform dependent semantics. * Additional sensors may be available, using platform dependent semantics.
* *
* Here are the additional Android sensors: * Hare are the additional Android sensors:
*
* https://developer.android.com/reference/android/hardware/SensorEvent.html#values * https://developer.android.com/reference/android/hardware/SensorEvent.html#values
*
* Accelerometer sensor notes:
*
* The accelerometer returns the current acceleration in SI meters per second
* squared. This measurement includes the force of gravity, so a device at
* rest will have an value of SDL_STANDARD_GRAVITY away from the center of the
* earth, which is a positive Y value.
*
* - `values[0]`: Acceleration on the x axis
* - `values[1]`: Acceleration on the y axis
* - `values[2]`: Acceleration on the z axis
*
* For phones and tablets held in natural orientation and game controllers
* held in front of you, the axes are defined as follows:
*
* - -X ... +X : left ... right
* - -Y ... +Y : bottom ... top
* - -Z ... +Z : farther ... closer
*
* The accelerometer axis data is not changed when the device is rotated.
*
* Gyroscope sensor notes:
*
* The gyroscope returns the current rate of rotation in radians per second.
* The rotation is positive in the counter-clockwise direction. That is, an
* observer looking from a positive location on one of the axes would see
* positive rotation on that axis when it appeared to be rotating
* counter-clockwise.
*
* - `values[0]`: Angular speed around the x axis (pitch)
* - `values[1]`: Angular speed around the y axis (yaw)
* - `values[2]`: Angular speed around the z axis (roll)
*
* For phones and tablets held in natural orientation and game controllers
* held in front of you, the axes are defined as follows:
*
* - -X ... +X : left ... right
* - -Y ... +Y : bottom ... top
* - -Z ... +Z : farther ... closer
*
* The gyroscope axis data is not changed when the device is rotated.
*
* \sa SDL_GetDisplayOrientation
*/ */
typedef enum SDL_SensorType typedef enum
{ {
SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */ SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */
SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */ SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */
@@ -124,15 +79,53 @@ typedef enum SDL_SensorType
} SDL_SensorType; } SDL_SensorType;
/** /**
* A constant to represent standard gravity for accelerometer sensors. * Accelerometer sensor
* *
* The accelerometer returns the current acceleration in SI meters per second * The accelerometer returns the current acceleration in SI meters per
* squared. This measurement includes the force of gravity, so a device at * second squared. This measurement includes the force of gravity, so
* rest will have an value of SDL_STANDARD_GRAVITY away from the center of the * a device at rest will have an value of SDL_STANDARD_GRAVITY away
* earth, which is a positive Y value. * from the center of the earth, which is a positive Y value.
*
* values[0]: Acceleration on the x axis
* values[1]: Acceleration on the y axis
* values[2]: Acceleration on the z axis
*
* For phones held in portrait mode and game controllers held in front of you,
* the axes are defined as follows:
* -X ... +X : left ... right
* -Y ... +Y : bottom ... top
* -Z ... +Z : farther ... closer
*
* The axis data is not changed when the phone is rotated.
*
* \sa SDL_GetDisplayOrientation()
*/ */
#define SDL_STANDARD_GRAVITY 9.80665f #define SDL_STANDARD_GRAVITY 9.80665f
/**
* Gyroscope sensor
*
* The gyroscope returns the current rate of rotation in radians per second.
* The rotation is positive in the counter-clockwise direction. That is,
* an observer looking from a positive location on one of the axes would
* see positive rotation on that axis when it appeared to be rotating
* counter-clockwise.
*
* values[0]: Angular speed around the x axis (pitch)
* values[1]: Angular speed around the y axis (yaw)
* values[2]: Angular speed around the z axis (roll)
*
* For phones held in portrait mode and game controllers held in front of you,
* the axes are defined as follows:
* -X ... +X : left ... right
* -Y ... +Y : bottom ... top
* -Z ... +Z : farther ... closer
*
* The axis data is not changed when the phone or controller is rotated.
*
* \sa SDL_GetDisplayOrientation()
*/
/* Function prototypes */ /* Function prototypes */
/** /**
@@ -162,7 +155,7 @@ extern DECLSPEC int SDLCALL SDL_NumSensors(void);
/** /**
* Get the implementation dependent name of a sensor. * Get the implementation dependent name of a sensor.
* *
* \param device_index The sensor to obtain name from. * \param device_index The sensor to obtain name from
* \returns the sensor name, or NULL if `device_index` is out of range. * \returns the sensor name, or NULL if `device_index` is out of range.
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
@@ -172,7 +165,7 @@ extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index);
/** /**
* Get the type of a sensor. * Get the type of a sensor.
* *
* \param device_index The sensor to get the type from. * \param device_index The sensor to get the type from
* \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `device_index` is * \returns the SDL_SensorType, or `SDL_SENSOR_INVALID` if `device_index` is
* out of range. * out of range.
* *
@@ -183,7 +176,7 @@ extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index)
/** /**
* Get the platform dependent type of a sensor. * Get the platform dependent type of a sensor.
* *
* \param device_index The sensor to check. * \param device_index The sensor to check
* \returns the sensor platform dependent type, or -1 if `device_index` is out * \returns the sensor platform dependent type, or -1 if `device_index` is out
* of range. * of range.
* *
@@ -194,7 +187,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index)
/** /**
* Get the instance ID of a sensor. * Get the instance ID of a sensor.
* *
* \param device_index The sensor to get instance id from. * \param device_index The sensor to get instance id from
* \returns the sensor instance ID, or -1 if `device_index` is out of range. * \returns the sensor instance ID, or -1 if `device_index` is out of range.
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
@@ -204,7 +197,7 @@ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_in
/** /**
* Open a sensor for use. * Open a sensor for use.
* *
* \param device_index The sensor to open. * \param device_index The sensor to open
* \returns an SDL_Sensor sensor object, or NULL if an error occurred. * \returns an SDL_Sensor sensor object, or NULL if an error occurred.
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
@@ -214,7 +207,7 @@ extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index);
/** /**
* Return the SDL_Sensor associated with an instance id. * Return the SDL_Sensor associated with an instance id.
* *
* \param instance_id The sensor from instance id. * \param instance_id The sensor from instance id
* \returns an SDL_Sensor object. * \returns an SDL_Sensor object.
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
@@ -224,7 +217,7 @@ extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instan
/** /**
* Get the implementation dependent name of a sensor * Get the implementation dependent name of a sensor
* *
* \param sensor The SDL_Sensor object. * \param sensor The SDL_Sensor object
* \returns the sensor name, or NULL if `sensor` is NULL. * \returns the sensor name, or NULL if `sensor` is NULL.
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
@@ -234,7 +227,7 @@ extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor);
/** /**
* Get the type of a sensor. * Get the type of a sensor.
* *
* \param sensor The SDL_Sensor object to inspect. * \param sensor The SDL_Sensor object to inspect
* \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` if `sensor` is * \returns the SDL_SensorType type, or `SDL_SENSOR_INVALID` if `sensor` is
* NULL. * NULL.
* *
@@ -245,7 +238,7 @@ extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor);
/** /**
* Get the platform dependent type of a sensor. * Get the platform dependent type of a sensor.
* *
* \param sensor The SDL_Sensor object to inspect. * \param sensor The SDL_Sensor object to inspect
* \returns the sensor platform dependent type, or -1 if `sensor` is NULL. * \returns the sensor platform dependent type, or -1 if `sensor` is NULL.
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
@@ -255,7 +248,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor);
/** /**
* Get the instance ID of a sensor. * Get the instance ID of a sensor.
* *
* \param sensor The SDL_Sensor object to inspect. * \param sensor The SDL_Sensor object to inspect
* \returns the sensor instance ID, or -1 if `sensor` is NULL. * \returns the sensor instance ID, or -1 if `sensor` is NULL.
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
@@ -267,9 +260,9 @@ extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor)
* *
* The number of values and interpretation of the data is sensor dependent. * The number of values and interpretation of the data is sensor dependent.
* *
* \param sensor The SDL_Sensor object to query. * \param sensor The SDL_Sensor object to query
* \param data A pointer filled with the current sensor state. * \param data A pointer filled with the current sensor state
* \param num_values The number of values to write to data. * \param num_values The number of values to write to data
* \returns 0 or -1 if an error occurred. * \returns 0 or -1 if an error occurred.
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
@@ -282,11 +275,11 @@ extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor *sensor, float *data, i
* *
* The number of values and interpretation of the data is sensor dependent. * The number of values and interpretation of the data is sensor dependent.
* *
* \param sensor The SDL_Sensor object to query. * \param sensor The SDL_Sensor object to query
* \param timestamp A pointer filled with the timestamp in microseconds of the * \param timestamp A pointer filled with the timestamp in microseconds of the
* current sensor reading if available, or 0 if not. * current sensor reading if available, or 0 if not
* \param data A pointer filled with the current sensor state. * \param data A pointer filled with the current sensor state
* \param num_values The number of values to write to data. * \param num_values The number of values to write to data
* \returns 0 or -1 if an error occurred. * \returns 0 or -1 if an error occurred.
* *
* \since This function is available since SDL 2.26.0. * \since This function is available since SDL 2.26.0.
@@ -296,7 +289,7 @@ extern DECLSPEC int SDLCALL SDL_SensorGetDataWithTimestamp(SDL_Sensor *sensor, U
/** /**
* Close a sensor previously opened with SDL_SensorOpen(). * Close a sensor previously opened with SDL_SensorOpen().
* *
* \param sensor The SDL_Sensor object to close. * \param sensor The SDL_Sensor object to close
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
*/ */
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -48,18 +48,18 @@ extern "C" {
* and flags. * and flags.
* *
* \param title The title of the window, in UTF-8 encoding. * \param title The title of the window, in UTF-8 encoding.
* \param x The x position of the window, SDL_WINDOWPOS_CENTERED, or * \param x The x position of the window, ::SDL_WINDOWPOS_CENTERED, or
* SDL_WINDOWPOS_UNDEFINED. * ::SDL_WINDOWPOS_UNDEFINED.
* \param y The y position of the window, SDL_WINDOWPOS_CENTERED, or * \param y The y position of the window, ::SDL_WINDOWPOS_CENTERED, or
* SDL_WINDOWPOS_UNDEFINED. * ::SDL_WINDOWPOS_UNDEFINED.
* \param w The width of the window. * \param w The width of the window.
* \param h The height of the window. * \param h The height of the window.
* \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with * \param flags The flags for the window, a mask of SDL_WINDOW_BORDERLESS with
* any of the following: SDL_WINDOW_OPENGL, * any of the following: ::SDL_WINDOW_OPENGL,
* SDL_WINDOW_INPUT_GRABBED, SDL_WINDOW_HIDDEN, * ::SDL_WINDOW_INPUT_GRABBED, ::SDL_WINDOW_HIDDEN,
* SDL_WINDOW_RESIZABLE, SDL_WINDOW_MAXIMIZED, * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED,
* SDL_WINDOW_MINIMIZED, SDL_WINDOW_BORDERLESS is always set, and * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_BORDERLESS is always set,
* SDL_WINDOW_FULLSCREEN is always unset. * and ::SDL_WINDOW_FULLSCREEN is always unset.
* \return the window created, or NULL if window creation failed. * \return the window created, or NULL if window creation failed.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,12 +19,10 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: StdInc */
/** /**
* # CategoryStdInc * \file SDL_stdinc.h
* *
* This is a general header that includes C language support. * This is a general header that includes C language support.
*/ */
#ifndef SDL_stdinc_h_ #ifndef SDL_stdinc_h_
@@ -109,7 +107,7 @@
# elif defined(__MRC__) # elif defined(__MRC__)
void *alloca(unsigned); void *alloca(unsigned);
# else # else
void *alloca(size_t); char *alloca();
# endif # endif
#endif #endif
@@ -131,19 +129,15 @@ void *alloca(size_t);
#endif #endif
/** /**
* The number of elements in an array. * The number of elements in an array.
*/ */
#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
#define SDL_TABLESIZE(table) SDL_arraysize(table) #define SDL_TABLESIZE(table) SDL_arraysize(table)
/** /**
* Macro useful for building other macros with strings in them * Macro useful for building other macros with strings in them
* *
* e.g: * e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
*
* ```c
* #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")
* ```
*/ */
#define SDL_STRINGIFY_ARG(arg) #arg #define SDL_STRINGIFY_ARG(arg) #arg
@@ -191,61 +185,54 @@ typedef enum
#endif #endif
/** /**
* A signed 8-bit integer type. * \brief A signed 8-bit integer type.
*/ */
typedef int8_t Sint8;
#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */ #define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */
#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */ #define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */
typedef int8_t Sint8;
/** /**
* An unsigned 8-bit integer type. * \brief An unsigned 8-bit integer type.
*/ */
typedef uint8_t Uint8;
#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */ #define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */
#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */ #define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */
typedef uint8_t Uint8;
/** /**
* A signed 16-bit integer type. * \brief A signed 16-bit integer type.
*/ */
typedef int16_t Sint16;
#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */ #define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */
#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */ #define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */
typedef int16_t Sint16;
/** /**
* An unsigned 16-bit integer type. * \brief An unsigned 16-bit integer type.
*/ */
typedef uint16_t Uint16;
#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */ #define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */
#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */ #define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */
typedef uint16_t Uint16;
/** /**
* A signed 32-bit integer type. * \brief A signed 32-bit integer type.
*/ */
typedef int32_t Sint32;
#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */ #define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */
#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */ #define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */
typedef int32_t Sint32;
/** /**
* An unsigned 32-bit integer type. * \brief An unsigned 32-bit integer type.
*/ */
typedef uint32_t Uint32;
#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */ #define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */
#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */ #define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */
typedef uint32_t Uint32;
/** /**
* A signed 64-bit integer type. * \brief A signed 64-bit integer type.
*/ */
typedef int64_t Sint64;
#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */ #define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */
#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */ #define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */
typedef int64_t Sint64;
/** /**
* An unsigned 64-bit integer type. * \brief An unsigned 64-bit integer type.
*/ */
typedef uint64_t Uint64;
#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */ #define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */
#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */ #define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */
typedef uint64_t Uint64;
/* @} *//* Basic data types */ /* @} *//* Basic data types */
@@ -266,44 +253,44 @@ typedef uint64_t Uint64;
* <stdint.h> should define these but this is not true all platforms. * <stdint.h> should define these but this is not true all platforms.
* (for example win32) */ * (for example win32) */
#ifndef SDL_PRIs64 #ifndef SDL_PRIs64
#if defined(__WIN32__) || defined(__GDK__) #ifdef PRIs64
#define SDL_PRIs64 PRIs64
#elif defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIs64 "I64d" #define SDL_PRIs64 "I64d"
#elif defined(PRId64) #elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIs64 PRId64
#elif defined(__LP64__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
#define SDL_PRIs64 "ld" #define SDL_PRIs64 "ld"
#else #else
#define SDL_PRIs64 "lld" #define SDL_PRIs64 "lld"
#endif #endif
#endif #endif
#ifndef SDL_PRIu64 #ifndef SDL_PRIu64
#if defined(__WIN32__) || defined(__GDK__) #ifdef PRIu64
#define SDL_PRIu64 "I64u"
#elif defined(PRIu64)
#define SDL_PRIu64 PRIu64 #define SDL_PRIu64 PRIu64
#elif defined(__LP64__) && !defined(__APPLE__) #elif defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIu64 "I64u"
#elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIu64 "lu" #define SDL_PRIu64 "lu"
#else #else
#define SDL_PRIu64 "llu" #define SDL_PRIu64 "llu"
#endif #endif
#endif #endif
#ifndef SDL_PRIx64 #ifndef SDL_PRIx64
#if defined(__WIN32__) || defined(__GDK__) #ifdef PRIx64
#define SDL_PRIx64 "I64x"
#elif defined(PRIx64)
#define SDL_PRIx64 PRIx64 #define SDL_PRIx64 PRIx64
#elif defined(__LP64__) && !defined(__APPLE__) #elif defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIx64 "I64x"
#elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIx64 "lx" #define SDL_PRIx64 "lx"
#else #else
#define SDL_PRIx64 "llx" #define SDL_PRIx64 "llx"
#endif #endif
#endif #endif
#ifndef SDL_PRIX64 #ifndef SDL_PRIX64
#if defined(__WIN32__) || defined(__GDK__) #ifdef PRIX64
#define SDL_PRIX64 "I64X"
#elif defined(PRIX64)
#define SDL_PRIX64 PRIX64 #define SDL_PRIX64 PRIX64
#elif defined(__LP64__) && !defined(__APPLE__) #elif defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIX64 "I64X"
#elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIX64 "lX" #define SDL_PRIX64 "lX"
#else #else
#define SDL_PRIX64 "llX" #define SDL_PRIX64 "llX"
@@ -349,9 +336,7 @@ typedef uint64_t Uint64;
#define SDL_PRINTF_FORMAT_STRING #define SDL_PRINTF_FORMAT_STRING
#define SDL_SCANF_FORMAT_STRING #define SDL_SCANF_FORMAT_STRING
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) #define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber )
#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) #define SDL_SCANF_VARARG_FUNC( fmtargnumber )
#define SDL_SCANF_VARARG_FUNCV( fmtargnumber )
#else #else
#if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */ #if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */
#include <sal.h> #include <sal.h>
@@ -377,25 +362,18 @@ typedef uint64_t Uint64;
#endif #endif
#if defined(__GNUC__) #if defined(__GNUC__)
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 ))) #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 )))
#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __printf__, fmtargnumber, 0 )))
#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 ))) #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 )))
#define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __scanf__, fmtargnumber, 0 )))
#else #else
#define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) #define SDL_PRINTF_VARARG_FUNC( fmtargnumber )
#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber )
#define SDL_SCANF_VARARG_FUNC( fmtargnumber ) #define SDL_SCANF_VARARG_FUNC( fmtargnumber )
#define SDL_SCANF_VARARG_FUNCV( fmtargnumber )
#endif #endif
#endif /* SDL_DISABLE_ANALYZE_MACROS */ #endif /* SDL_DISABLE_ANALYZE_MACROS */
#ifndef SDL_COMPILE_TIME_ASSERT #ifndef SDL_COMPILE_TIME_ASSERT
#if defined(__cplusplus) #if defined(__cplusplus)
/* Keep C++ case alone: Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode. */
#if (__cplusplus >= 201103L) #if (__cplusplus >= 201103L)
#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x) #define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
#endif #endif
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x) #define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x)
#endif #endif
@@ -428,8 +406,8 @@ SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
/** \cond */ /** \cond */
#ifndef DOXYGEN_SHOULD_IGNORE_THIS #ifndef DOXYGEN_SHOULD_IGNORE_THIS
#if !defined(__VITA__) && !defined(__3DS__) #if !defined(__ANDROID__) && !defined(__VITA__) && !defined(__3DS__)
/* TODO: include/SDL_stdinc.h:422: error: size of array 'SDL_dummy_enum' is negative */ /* TODO: include/SDL_stdinc.h:174: error: size of array 'SDL_dummy_enum' is negative */
typedef enum typedef enum
{ {
DUMMY_ENUM_VALUE DUMMY_ENUM_VALUE
@@ -504,9 +482,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void);
extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); extern DECLSPEC char *SDLCALL SDL_getenv(const char *name);
extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite);
typedef int (SDLCALL *SDL_CompareCallback)(const void *, const void *); extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *));
extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, SDL_CompareCallback compare); extern DECLSPEC void * SDLCALL SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *));
extern DECLSPEC void * SDLCALL SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, SDL_CompareCallback compare);
extern DECLSPEC int SDLCALL SDL_abs(int x); extern DECLSPEC int SDLCALL SDL_abs(int x);
@@ -535,7 +512,6 @@ extern DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t le
extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len); extern DECLSPEC void *SDLCALL SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len);
/* Some safe(r) macros for zero'ing structures... */
#define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x))) #define SDL_zero(x) SDL_memset(&(x), 0, sizeof((x)))
#define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x))) #define SDL_zerop(x) SDL_memset((x), 0, sizeof(*(x)))
#define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x))) #define SDL_zeroa(x) SDL_memset((x), 0, sizeof((x)))
@@ -627,11 +603,11 @@ extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len); extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len);
extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2); extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2);
extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, va_list ap) SDL_SCANF_VARARG_FUNCV(2); extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap);
extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3); extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3);
extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap);
extern DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); extern DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2); extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, const char *fmt, va_list ap);
#ifndef HAVE_M_PI #ifndef HAVE_M_PI
#ifndef M_PI #ifndef M_PI
@@ -712,8 +688,8 @@ extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf,
size_t * outbytesleft); size_t * outbytesleft);
/** /**
* This function converts a buffer or string between encodings in one pass, * This function converts a buffer or string between encodings in one pass, returning a
* returning a string that must be freed with SDL_free() or NULL on error. * string that must be freed with SDL_free() or NULL on error.
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
@@ -721,11 +697,9 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
const char *fromcode, const char *fromcode,
const char *inbuf, const char *inbuf,
size_t inbytesleft); size_t inbytesleft);
/* Some helper macros for common cases... */
#define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1)
#define SDL_iconv_wchar_utf8(S) SDL_iconv_string("UTF-8", "WCHAR_T", (char *)S, (SDL_wcslen(S)+1)*sizeof(wchar_t)) #define SDL_iconv_wchar_utf8(S) SDL_iconv_string("UTF-8", "WCHAR_T", (char *)S, (SDL_wcslen(S)+1)*sizeof(wchar_t))
/* force builds using Clang's static analysis tools to use literal C runtime /* force builds using Clang's static analysis tools to use literal C runtime
@@ -750,13 +724,6 @@ size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t size);
size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size); size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
#endif #endif
#ifndef _WIN32
/* strdup is not ANSI but POSIX, and its prototype might be hidden... */
/* not for windows: might conflict with string.h where strdup may have
* dllimport attribute: https://github.com/libsdl-org/SDL/issues/12948 */
char *strdup(const char *str);
#endif
/* Starting LLVM 16, the analyser errors out if these functions do not have /* Starting LLVM 16, the analyser errors out if these functions do not have
their prototype defined (clang-diagnostic-implicit-function-declaration) */ their prototype defined (clang-diagnostic-implicit-function-declaration) */
#include <stdlib.h> #include <stdlib.h>
@@ -802,9 +769,8 @@ SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_B
} }
/** /**
* If a * b would overflow, return -1. * If a * b would overflow, return -1. Otherwise store a * b via ret
* * and return 0.
* Otherwise store a * b via ret and return 0.
* *
* \since This function is available since SDL 2.24.0. * \since This function is available since SDL 2.24.0.
*/ */
@@ -833,9 +799,8 @@ SDL_FORCE_INLINE int _SDL_size_mul_overflow_builtin (size_t a,
#endif #endif
/** /**
* If a + b would overflow, return -1. * If a + b would overflow, return -1. Otherwise store a + b via ret
* * and return 0.
* Otherwise store a + b via ret and return 0.
* *
* \since This function is available since SDL 2.24.0. * \since This function is available since SDL 2.24.0.
*/ */
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategorySurface * \file SDL_surface.h
* *
* Header file for SDL_Surface definition and management functions. * Header file for ::SDL_Surface definition and management functions.
*/ */
#ifndef SDL_surface_h_ #ifndef SDL_surface_h_
@@ -43,7 +43,7 @@ extern "C" {
/** /**
* \name Surface flags * \name Surface flags
* *
* These are the currently supported flags for the SDL_Surface. * These are the currently supported flags for the ::SDL_Surface.
* *
* \internal * \internal
* Used internally (read-only). * Used internally (read-only).
@@ -57,17 +57,17 @@ extern "C" {
/* @} *//* Surface flags */ /* @} *//* Surface flags */
/** /**
* Evaluates to true if the surface needs to be locked before access. * Evaluates to true if the surface needs to be locked before access.
*/ */
#define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0) #define SDL_MUSTLOCK(S) (((S)->flags & SDL_RLEACCEL) != 0)
typedef struct SDL_BlitMap SDL_BlitMap; /* this is an opaque type. */ typedef struct SDL_BlitMap SDL_BlitMap; /* this is an opaque type. */
/** /**
* A collection of pixels used in software blitting. * \brief A collection of pixels used in software blitting.
* *
* This structure should be treated as read-only, except for `pixels`, which, * \note This structure should be treated as read-only, except for \c pixels,
* if not NULL, contains the raw pixel data for the surface. * which, if not NULL, contains the raw pixel data for the surface.
*/ */
typedef struct SDL_Surface typedef struct SDL_Surface
{ {
@@ -97,15 +97,15 @@ typedef struct SDL_Surface
} SDL_Surface; } SDL_Surface;
/** /**
* The type of function used for surface blitting functions. * \brief The type of function used for surface blitting functions.
*/ */
typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
struct SDL_Surface * dst, SDL_Rect * dstrect); struct SDL_Surface * dst, SDL_Rect * dstrect);
/** /**
* The formula used for converting between YUV and RGB * \brief The formula used for converting between YUV and RGB
*/ */
typedef enum SDL_YUV_CONVERSION_MODE typedef enum
{ {
SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */ SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */
SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */ SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */
@@ -140,14 +140,14 @@ typedef enum SDL_YUV_CONVERSION_MODE
* You can change this by calling SDL_SetSurfaceBlendMode() and selecting a * You can change this by calling SDL_SetSurfaceBlendMode() and selecting a
* different `blendMode`. * different `blendMode`.
* *
* \param flags the flags are unused and should be set to 0. * \param flags the flags are unused and should be set to 0
* \param width the width of the surface. * \param width the width of the surface
* \param height the height of the surface. * \param height the height of the surface
* \param depth the depth of the surface in bits. * \param depth the depth of the surface in bits
* \param Rmask the red mask for the pixels. * \param Rmask the red mask for the pixels
* \param Gmask the green mask for the pixels. * \param Gmask the green mask for the pixels
* \param Bmask the blue mask for the pixels. * \param Bmask the blue mask for the pixels
* \param Amask the alpha mask for the pixels. * \param Amask the alpha mask for the pixels
* \returns the new SDL_Surface structure that is created or NULL if it fails; * \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -171,10 +171,10 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
* of providing pixel color masks, you provide it with a predefined format * of providing pixel color masks, you provide it with a predefined format
* from SDL_PixelFormatEnum. * from SDL_PixelFormatEnum.
* *
* \param flags the flags are unused and should be set to 0. * \param flags the flags are unused and should be set to 0
* \param width the width of the surface. * \param width the width of the surface
* \param height the height of the surface. * \param height the height of the surface
* \param depth the depth of the surface in bits. * \param depth the depth of the surface in bits
* \param format the SDL_PixelFormatEnum for the new surface's pixel format. * \param format the SDL_PixelFormatEnum for the new surface's pixel format.
* \returns the new SDL_Surface structure that is created or NULL if it fails; * \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
@@ -198,15 +198,15 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
* No copy is made of the pixel data. Pixel data is not managed automatically; * No copy is made of the pixel data. Pixel data is not managed automatically;
* you must free the surface before you free the pixel data. * you must free the surface before you free the pixel data.
* *
* \param pixels a pointer to existing pixel data. * \param pixels a pointer to existing pixel data
* \param width the width of the surface. * \param width the width of the surface
* \param height the height of the surface. * \param height the height of the surface
* \param depth the depth of the surface in bits. * \param depth the depth of the surface in bits
* \param pitch the pitch of the surface in bytes. * \param pitch the pitch of the surface in bytes
* \param Rmask the red mask for the pixels. * \param Rmask the red mask for the pixels
* \param Gmask the green mask for the pixels. * \param Gmask the green mask for the pixels
* \param Bmask the blue mask for the pixels. * \param Bmask the blue mask for the pixels
* \param Amask the alpha mask for the pixels. * \param Amask the alpha mask for the pixels
* \returns the new SDL_Surface structure that is created or NULL if it fails; * \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -214,7 +214,6 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
* *
* \sa SDL_CreateRGBSurface * \sa SDL_CreateRGBSurface
* \sa SDL_CreateRGBSurfaceWithFormat * \sa SDL_CreateRGBSurfaceWithFormat
* \sa SDL_CreateRGBSurfaceWithFormatFrom
* \sa SDL_FreeSurface * \sa SDL_FreeSurface
*/ */
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
@@ -240,11 +239,11 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
* No copy is made of the pixel data. Pixel data is not managed automatically; * No copy is made of the pixel data. Pixel data is not managed automatically;
* you must free the surface before you free the pixel data. * you must free the surface before you free the pixel data.
* *
* \param pixels a pointer to existing pixel data. * \param pixels a pointer to existing pixel data
* \param width the width of the surface. * \param width the width of the surface
* \param height the height of the surface. * \param height the height of the surface
* \param depth the depth of the surface in bits. * \param depth the depth of the surface in bits
* \param pitch the pitch of the surface in bytes. * \param pitch the pitch of the surface in bytes
* \param format the SDL_PixelFormatEnum for the new surface's pixel format. * \param format the SDL_PixelFormatEnum for the new surface's pixel format.
* \returns the new SDL_Surface structure that is created or NULL if it fails; * \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
@@ -279,8 +278,8 @@ extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface);
* *
* A single palette can be shared with many surfaces. * A single palette can be shared with many surfaces.
* *
* \param surface the SDL_Surface structure to update. * \param surface the SDL_Surface structure to update
* \param palette the SDL_Palette structure to use. * \param palette the SDL_Palette structure to use
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -301,7 +300,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfacePalette(SDL_Surface * surface,
* 0, then you can read and write to the surface at any time, and the pixel * 0, then you can read and write to the surface at any time, and the pixel
* format of the surface will not change. * format of the surface will not change.
* *
* \param surface the SDL_Surface structure to be locked. * \param surface the SDL_Surface structure to be locked
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -315,7 +314,7 @@ extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface * surface);
/** /**
* Release a surface after directly accessing the pixels. * Release a surface after directly accessing the pixels.
* *
* \param surface the SDL_Surface structure to be unlocked. * \param surface the SDL_Surface structure to be unlocked
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -330,11 +329,11 @@ extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface * surface);
* result in a memory leak. * result in a memory leak.
* *
* src is an open SDL_RWops buffer, typically loaded with SDL_RWFromFile. * src is an open SDL_RWops buffer, typically loaded with SDL_RWFromFile.
* Alternatively, you might also use the macro SDL_LoadBMP to load a bitmap * Alternitavely, you might also use the macro SDL_LoadBMP to load a bitmap
* from a file, convert it to an SDL_Surface and then close the file. * from a file, convert it to an SDL_Surface and then close the file.
* *
* \param src the data stream for the surface. * \param src the data stream for the surface
* \param freesrc non-zero to close the stream after being read. * \param freesrc non-zero to close the stream after being read
* \returns a pointer to a new SDL_Surface structure or NULL if there was an * \returns a pointer to a new SDL_Surface structure or NULL if there was an
* error; call SDL_GetError() for more information. * error; call SDL_GetError() for more information.
* *
@@ -364,9 +363,9 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src,
* surface before they are saved. YUV and paletted 1-bit and 4-bit formats are * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are
* not supported. * not supported.
* *
* \param surface the SDL_Surface structure containing the image to be saved. * \param surface the SDL_Surface structure containing the image to be saved
* \param dst a data stream to save to. * \param dst a data stream to save to
* \param freedst non-zero to close the stream after being written. * \param freedst non-zero to close the stream after being written
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -379,9 +378,9 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
(SDL_Surface * surface, SDL_RWops * dst, int freedst); (SDL_Surface * surface, SDL_RWops * dst, int freedst);
/** /**
* Save a surface to a file. * Save a surface to a file.
* *
* Convenience macro. * Convenience macro.
*/ */
#define SDL_SaveBMP(surface, file) \ #define SDL_SaveBMP(surface, file) \
SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
@@ -392,8 +391,8 @@ extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
* If RLE is enabled, color key and alpha blending blits are much faster, but * If RLE is enabled, color key and alpha blending blits are much faster, but
* the surface must be locked before directly accessing the pixels. * the surface must be locked before directly accessing the pixels.
* *
* \param surface the SDL_Surface structure to optimize. * \param surface the SDL_Surface structure to optimize
* \param flag 0 to disable, non-zero to enable RLE acceleration. * \param flag 0 to disable, non-zero to enable RLE acceleration
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -411,7 +410,7 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface,
* *
* It is safe to pass a NULL `surface` here; it will return SDL_FALSE. * It is safe to pass a NULL `surface` here; it will return SDL_FALSE.
* *
* \param surface the SDL_Surface structure to query. * \param surface the SDL_Surface structure to query
* \returns SDL_TRUE if the surface is RLE enabled, SDL_FALSE otherwise. * \returns SDL_TRUE if the surface is RLE enabled, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.14. * \since This function is available since SDL 2.0.14.
@@ -433,9 +432,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasSurfaceRLE(SDL_Surface * surface);
* RLE acceleration can substantially speed up blitting of images with large * RLE acceleration can substantially speed up blitting of images with large
* horizontal runs of transparent pixels. See SDL_SetSurfaceRLE() for details. * horizontal runs of transparent pixels. See SDL_SetSurfaceRLE() for details.
* *
* \param surface the SDL_Surface structure to update. * \param surface the SDL_Surface structure to update
* \param flag SDL_TRUE to enable color key, SDL_FALSE to disable color key. * \param flag SDL_TRUE to enable color key, SDL_FALSE to disable color key
* \param key the transparent pixel. * \param key the transparent pixel
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -452,7 +451,7 @@ extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface,
* *
* It is safe to pass a NULL `surface` here; it will return SDL_FALSE. * It is safe to pass a NULL `surface` here; it will return SDL_FALSE.
* *
* \param surface the SDL_Surface structure to query. * \param surface the SDL_Surface structure to query
* \return SDL_TRUE if the surface has a color key, SDL_FALSE otherwise. * \return SDL_TRUE if the surface has a color key, SDL_FALSE otherwise.
* *
* \since This function is available since SDL 2.0.9. * \since This function is available since SDL 2.0.9.
@@ -470,8 +469,8 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface);
* *
* If the surface doesn't have color key enabled this function returns -1. * If the surface doesn't have color key enabled this function returns -1.
* *
* \param surface the SDL_Surface structure to query. * \param surface the SDL_Surface structure to query
* \param key a pointer filled in with the transparent pixel. * \param key a pointer filled in with the transparent pixel
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -492,10 +491,10 @@ extern DECLSPEC int SDLCALL SDL_GetColorKey(SDL_Surface * surface,
* *
* `srcC = srcC * (color / 255)` * `srcC = srcC * (color / 255)`
* *
* \param surface the SDL_Surface structure to update. * \param surface the SDL_Surface structure to update
* \param r the red color value multiplied into blit operations. * \param r the red color value multiplied into blit operations
* \param g the green color value multiplied into blit operations. * \param g the green color value multiplied into blit operations
* \param b the blue color value multiplied into blit operations. * \param b the blue color value multiplied into blit operations
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -511,10 +510,10 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceColorMod(SDL_Surface * surface,
/** /**
* Get the additional color value multiplied into blit operations. * Get the additional color value multiplied into blit operations.
* *
* \param surface the SDL_Surface structure to query. * \param surface the SDL_Surface structure to query
* \param r a pointer filled in with the current red color value. * \param r a pointer filled in with the current red color value
* \param g a pointer filled in with the current green color value. * \param g a pointer filled in with the current green color value
* \param b a pointer filled in with the current blue color value. * \param b a pointer filled in with the current blue color value
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -535,8 +534,8 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceColorMod(SDL_Surface * surface,
* *
* `srcA = srcA * (alpha / 255)` * `srcA = srcA * (alpha / 255)`
* *
* \param surface the SDL_Surface structure to update. * \param surface the SDL_Surface structure to update
* \param alpha the alpha value multiplied into blit operations. * \param alpha the alpha value multiplied into blit operations
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -551,8 +550,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface * surface,
/** /**
* Get the additional alpha value used in blit operations. * Get the additional alpha value used in blit operations.
* *
* \param surface the SDL_Surface structure to query. * \param surface the SDL_Surface structure to query
* \param alpha a pointer filled in with the current alpha value. * \param alpha a pointer filled in with the current alpha value
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -571,8 +570,8 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface * surface,
* existing data, the blendmode of the SOURCE surface should be set to * existing data, the blendmode of the SOURCE surface should be set to
* `SDL_BLENDMODE_NONE`. * `SDL_BLENDMODE_NONE`.
* *
* \param surface the SDL_Surface structure to update. * \param surface the SDL_Surface structure to update
* \param blendMode the SDL_BlendMode to use for blit blending. * \param blendMode the SDL_BlendMode to use for blit blending
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -586,8 +585,8 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface * surface,
/** /**
* Get the blend mode used for blit operations. * Get the blend mode used for blit operations.
* *
* \param surface the SDL_Surface structure to query. * \param surface the SDL_Surface structure to query
* \param blendMode a pointer filled in with the current SDL_BlendMode. * \param blendMode a pointer filled in with the current SDL_BlendMode
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -607,9 +606,9 @@ extern DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface * surface,
* Note that blits are automatically clipped to the edges of the source and * Note that blits are automatically clipped to the edges of the source and
* destination surfaces. * destination surfaces.
* *
* \param surface the SDL_Surface structure to be clipped. * \param surface the SDL_Surface structure to be clipped
* \param rect the SDL_Rect structure representing the clipping rectangle, or * \param rect the SDL_Rect structure representing the clipping rectangle, or
* NULL to disable clipping. * NULL to disable clipping
* \returns SDL_TRUE if the rectangle intersects the surface, otherwise * \returns SDL_TRUE if the rectangle intersects the surface, otherwise
* SDL_FALSE and blits will be completely clipped. * SDL_FALSE and blits will be completely clipped.
* *
@@ -628,9 +627,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface,
* rectangle is drawn into. * rectangle is drawn into.
* *
* \param surface the SDL_Surface structure representing the surface to be * \param surface the SDL_Surface structure representing the surface to be
* clipped. * clipped
* \param rect an SDL_Rect structure filled in with the clipping rectangle for * \param rect an SDL_Rect structure filled in with the clipping rectangle for
* the surface. * the surface
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -659,11 +658,11 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface)
* surface. The new, optimized surface can then be used as the source for * surface. The new, optimized surface can then be used as the source for
* future blits, making them faster. * future blits, making them faster.
* *
* \param src the existing SDL_Surface structure to convert. * \param src the existing SDL_Surface structure to convert
* \param fmt the SDL_PixelFormat structure that the new surface is optimized * \param fmt the SDL_PixelFormat structure that the new surface is optimized
* for. * for
* \param flags the flags are unused and should be set to 0; this is a * \param flags the flags are unused and should be set to 0; this is a
* leftover from SDL 1.2's API. * leftover from SDL 1.2's API
* \returns the new SDL_Surface structure that is created or NULL if it fails; * \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -684,11 +683,11 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
* it might be easier to call but it doesn't have access to palette * it might be easier to call but it doesn't have access to palette
* information for the destination surface, in case that would be important. * information for the destination surface, in case that would be important.
* *
* \param src the existing SDL_Surface structure to convert. * \param src the existing SDL_Surface structure to convert
* \param pixel_format the SDL_PixelFormatEnum that the new surface is * \param pixel_format the SDL_PixelFormatEnum that the new surface is
* optimized for. * optimized for
* \param flags the flags are unused and should be set to 0; this is a * \param flags the flags are unused and should be set to 0; this is a
* leftover from SDL 1.2's API. * leftover from SDL 1.2's API
* \returns the new SDL_Surface structure that is created or NULL if it fails; * \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information. * call SDL_GetError() for more information.
* *
@@ -704,14 +703,14 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
/** /**
* Copy a block of pixels of one format to another format. * Copy a block of pixels of one format to another format.
* *
* \param width the width of the block to copy, in pixels. * \param width the width of the block to copy, in pixels
* \param height the height of the block to copy, in pixels. * \param height the height of the block to copy, in pixels
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format. * \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
* \param src a pointer to the source pixels. * \param src a pointer to the source pixels
* \param src_pitch the pitch of the source pixels, in bytes. * \param src_pitch the pitch of the source pixels, in bytes
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format. * \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
* \param dst a pointer to be filled in with new pixel data. * \param dst a pointer to be filled in with new pixel data
* \param dst_pitch the pitch of the destination pixels, in bytes. * \param dst_pitch the pitch of the destination pixels, in bytes
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -730,14 +729,14 @@ extern DECLSPEC int SDLCALL SDL_ConvertPixels(int width, int height,
* *
* This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888. * This function is currently only implemented for SDL_PIXELFORMAT_ARGB8888.
* *
* \param width the width of the block to convert, in pixels. * \param width the width of the block to convert, in pixels
* \param height the height of the block to convert, in pixels. * \param height the height of the block to convert, in pixels
* \param src_format an SDL_PixelFormatEnum value of the `src` pixels format. * \param src_format an SDL_PixelFormatEnum value of the `src` pixels format
* \param src a pointer to the source pixels. * \param src a pointer to the source pixels
* \param src_pitch the pitch of the source pixels, in bytes. * \param src_pitch the pitch of the source pixels, in bytes
* \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format. * \param dst_format an SDL_PixelFormatEnum value of the `dst` pixels format
* \param dst a pointer to be filled in with premultiplied pixel data. * \param dst a pointer to be filled in with premultiplied pixel data
* \param dst_pitch the pitch of the destination pixels, in bytes. * \param dst_pitch the pitch of the destination pixels, in bytes
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -761,10 +760,10 @@ extern DECLSPEC int SDLCALL SDL_PremultiplyAlpha(int width, int height,
* SDL_SetClipRect()), then this function will fill based on the intersection * SDL_SetClipRect()), then this function will fill based on the intersection
* of the clip rectangle and `rect`. * of the clip rectangle and `rect`.
* *
* \param dst the SDL_Surface structure that is the drawing target. * \param dst the SDL_Surface structure that is the drawing target
* \param rect the SDL_Rect structure representing the rectangle to fill, or * \param rect the SDL_Rect structure representing the rectangle to fill, or
* NULL to fill the entire surface. * NULL to fill the entire surface
* \param color the color to fill with. * \param color the color to fill with
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -787,10 +786,10 @@ extern DECLSPEC int SDLCALL SDL_FillRect
* SDL_SetClipRect()), then this function will fill based on the intersection * SDL_SetClipRect()), then this function will fill based on the intersection
* of the clip rectangle and `rect`. * of the clip rectangle and `rect`.
* *
* \param dst the SDL_Surface structure that is the drawing target. * \param dst the SDL_Surface structure that is the drawing target
* \param rects an array of SDL_Rect representing the rectangles to fill. * \param rects an array of SDL_Rects representing the rectangles to fill.
* \param count the number of rectangles in the array. * \param count the number of rectangles in the array
* \param color the color to fill with. * \param color the color to fill with
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -802,64 +801,62 @@ extern DECLSPEC int SDLCALL SDL_FillRects
(SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color); (SDL_Surface * dst, const SDL_Rect * rects, int count, Uint32 color);
/* !!! FIXME: merge this documentation with the wiki */ /* !!! FIXME: merge this documentation with the wiki */
/** /**
* Performs a fast blit from the source surface to the destination surface. * Performs a fast blit from the source surface to the destination surface.
* *
* This assumes that the source and destination rectangles are the same size. * This assumes that the source and destination rectangles are
* If either `srcrect` or `dstrect` are NULL, the entire surface (`src` or * the same size. If either \c srcrect or \c dstrect are NULL, the entire
* `dst`) is copied. The final blit rectangle is saved in `dstrect` after * surface (\c src or \c dst) is copied. The final blit rectangles are saved
* all clipping is performed. * in \c srcrect and \c dstrect after all clipping is performed.
* *
* The blit function should not be called on a locked surface. * \returns 0 if the blit is successful, otherwise it returns -1.
* *
* The blit semantics for surfaces with and without blending and colorkey are * The blit function should not be called on a locked surface.
* defined as follows:
* *
* ``` * The blit semantics for surfaces with and without blending and colorkey
* RGBA->RGB: * are defined as follows:
* Source surface blend mode set to SDL_BLENDMODE_BLEND: * \verbatim
* alpha-blend (using the source alpha-channel and per-surface alpha) RGBA->RGB:
* SDL_SRCCOLORKEY ignored. Source surface blend mode set to SDL_BLENDMODE_BLEND:
* Source surface blend mode set to SDL_BLENDMODE_NONE: alpha-blend (using the source alpha-channel and per-surface alpha)
* copy RGB. SDL_SRCCOLORKEY ignored.
* if SDL_SRCCOLORKEY set, only copy the pixels matching the Source surface blend mode set to SDL_BLENDMODE_NONE:
* RGB values of the source color key, ignoring alpha in the copy RGB.
* comparison. if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source color key, ignoring alpha in the
comparison.
RGB->RGBA:
Source surface blend mode set to SDL_BLENDMODE_BLEND:
alpha-blend (using the source per-surface alpha)
Source surface blend mode set to SDL_BLENDMODE_NONE:
copy RGB, set destination alpha to source per-surface alpha value.
both:
if SDL_SRCCOLORKEY set, only copy the pixels matching the
source color key.
RGBA->RGBA:
Source surface blend mode set to SDL_BLENDMODE_BLEND:
alpha-blend (using the source alpha-channel and per-surface alpha)
SDL_SRCCOLORKEY ignored.
Source surface blend mode set to SDL_BLENDMODE_NONE:
copy all of RGBA to the destination.
if SDL_SRCCOLORKEY set, only copy the pixels matching the
RGB values of the source color key, ignoring alpha in the
comparison.
RGB->RGB:
Source surface blend mode set to SDL_BLENDMODE_BLEND:
alpha-blend (using the source per-surface alpha)
Source surface blend mode set to SDL_BLENDMODE_NONE:
copy RGB.
both:
if SDL_SRCCOLORKEY set, only copy the pixels matching the
source color key.
\endverbatim
* *
* RGB->RGBA: * You should call SDL_BlitSurface() unless you know exactly how SDL
* Source surface blend mode set to SDL_BLENDMODE_BLEND: * blitting works internally and how to use the other blit functions.
* alpha-blend (using the source per-surface alpha)
* Source surface blend mode set to SDL_BLENDMODE_NONE:
* copy RGB, set destination alpha to source per-surface alpha value.
* both:
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* source color key.
*
* RGBA->RGBA:
* Source surface blend mode set to SDL_BLENDMODE_BLEND:
* alpha-blend (using the source alpha-channel and per-surface alpha)
* SDL_SRCCOLORKEY ignored.
* Source surface blend mode set to SDL_BLENDMODE_NONE:
* copy all of RGBA to the destination.
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* RGB values of the source color key, ignoring alpha in the
* comparison.
*
* RGB->RGB:
* Source surface blend mode set to SDL_BLENDMODE_BLEND:
* alpha-blend (using the source per-surface alpha)
* Source surface blend mode set to SDL_BLENDMODE_NONE:
* copy RGB.
* both:
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* source color key.
* ```
*
* You should call SDL_BlitSurface() unless you know exactly how SDL blitting
* works internally and how to use the other blit functions.
*
* \returns 0 if the blit is successful, otherwise it returns -1.
*/ */
#define SDL_BlitSurface SDL_UpperBlit #define SDL_BlitSurface SDL_UpperBlit
@@ -886,12 +883,12 @@ extern DECLSPEC int SDLCALL SDL_UpperBlit
* Unless you know what you're doing, you should be using SDL_BlitSurface() * Unless you know what you're doing, you should be using SDL_BlitSurface()
* instead. * instead.
* *
* \param src the SDL_Surface structure to be copied from. * \param src the SDL_Surface structure to be copied from
* \param srcrect the SDL_Rect structure representing the rectangle to be * \param srcrect the SDL_Rect structure representing the rectangle to be
* copied, or NULL to copy the entire surface. * copied, or NULL to copy the entire surface
* \param dst the SDL_Surface structure that is the blit target. * \param dst the SDL_Surface structure that is the blit target
* \param dstrect the SDL_Rect structure representing the rectangle that is * \param dstrect the SDL_Rect structure representing the rectangle that is
* copied into. * copied into
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -928,6 +925,8 @@ extern DECLSPEC int SDLCALL SDL_SoftStretchLinear(SDL_Surface * src,
const SDL_Rect * dstrect); const SDL_Rect * dstrect);
#define SDL_BlitScaled SDL_UpperBlitScaled
/** /**
* Perform a scaled surface copy to a destination surface. * Perform a scaled surface copy to a destination surface.
* *
@@ -942,21 +941,18 @@ extern DECLSPEC int SDLCALL SDL_UpperBlitScaled
(SDL_Surface * src, const SDL_Rect * srcrect, (SDL_Surface * src, const SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect); SDL_Surface * dst, SDL_Rect * dstrect);
#define SDL_BlitScaled SDL_UpperBlitScaled
/** /**
* Perform low-level surface scaled blitting only. * Perform low-level surface scaled blitting only.
* *
* This is a semi-private function and it performs low-level surface blitting, * This is a semi-private function and it performs low-level surface blitting,
* assuming the input rectangles have already been clipped. * assuming the input rectangles have already been clipped.
* *
* \param src the SDL_Surface structure to be copied from. * \param src the SDL_Surface structure to be copied from
* \param srcrect the SDL_Rect structure representing the rectangle to be * \param srcrect the SDL_Rect structure representing the rectangle to be
* copied. * copied
* \param dst the SDL_Surface structure that is the blit target. * \param dst the SDL_Surface structure that is the blit target
* \param dstrect the SDL_Rect structure representing the rectangle that is * \param dstrect the SDL_Rect structure representing the rectangle that is
* copied into. * copied into
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategorySystem * \file SDL_system.h
* *
* Include file for platform specific SDL API functions * Include file for platform specific SDL API functions
*/ */
#ifndef SDL_system_h_ #ifndef SDL_system_h_
@@ -49,7 +49,7 @@ typedef void (SDLCALL * SDL_WindowsMessageHook)(void *userdata, void *hWnd, unsi
* Set a callback for every Windows message, run before TranslateMessage(). * Set a callback for every Windows message, run before TranslateMessage().
* *
* \param callback The SDL_WindowsMessageHook function to call. * \param callback The SDL_WindowsMessageHook function to call.
* \param userdata a pointer to pass to every iteration of `callback`. * \param userdata a pointer to pass to every iteration of `callback`
* *
* \since This function is available since SDL 2.0.4. * \since This function is available since SDL 2.0.4.
*/ */
@@ -66,7 +66,7 @@ extern DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook ca
* controls on which monitor a full screen application will appear. * controls on which monitor a full screen application will appear.
* *
* \param displayIndex the display index for which to get the D3D9 adapter * \param displayIndex the display index for which to get the D3D9 adapter
* index. * index
* \returns the D3D9 adapter index on success or a negative error code on * \returns the D3D9 adapter index on success or a negative error code on
* failure; call SDL_GetError() for more information. * failure; call SDL_GetError() for more information.
* *
@@ -82,7 +82,7 @@ typedef struct IDirect3DDevice9 IDirect3DDevice9;
* Once you are done using the device, you should release it to avoid a * Once you are done using the device, you should release it to avoid a
* resource leak. * resource leak.
* *
* \param renderer the renderer from which to get the associated D3D device. * \param renderer the renderer from which to get the associated D3D device
* \returns the D3D9 device associated with given renderer or NULL if it is * \returns the D3D9 device associated with given renderer or NULL if it is
* not a D3D9 renderer; call SDL_GetError() for more information. * not a D3D9 renderer; call SDL_GetError() for more information.
* *
@@ -98,7 +98,7 @@ typedef struct ID3D11Device ID3D11Device;
* Once you are done using the device, you should release it to avoid a * Once you are done using the device, you should release it to avoid a
* resource leak. * resource leak.
* *
* \param renderer the renderer from which to get the associated D3D11 device. * \param renderer the renderer from which to get the associated D3D11 device
* \returns the D3D11 device associated with given renderer or NULL if it is * \returns the D3D11 device associated with given renderer or NULL if it is
* not a D3D11 renderer; call SDL_GetError() for more information. * not a D3D11 renderer; call SDL_GetError() for more information.
* *
@@ -118,7 +118,7 @@ typedef struct ID3D12Device ID3D12Device;
* Once you are done using the device, you should release it to avoid a * Once you are done using the device, you should release it to avoid a
* resource leak. * resource leak.
* *
* \param renderer the renderer from which to get the associated D3D12 device. * \param renderer the renderer from which to get the associated D3D12 device
* \returns the D3D12 device associated with given renderer or NULL if it is * \returns the D3D12 device associated with given renderer or NULL if it is
* not a D3D12 renderer; call SDL_GetError() for more information. * not a D3D12 renderer; call SDL_GetError() for more information.
* *
@@ -140,9 +140,9 @@ extern DECLSPEC ID3D12Device* SDLCALL SDL_RenderGetD3D12Device(SDL_Renderer* ren
* Before SDL 2.0.4 this function did not return a value. Since SDL 2.0.4 it * Before SDL 2.0.4 this function did not return a value. Since SDL 2.0.4 it
* returns an SDL_bool. * returns an SDL_bool.
* *
* \param displayIndex the display index for which to get both indices. * \param displayIndex the display index for which to get both indices
* \param adapterIndex a pointer to be filled in with the adapter index. * \param adapterIndex a pointer to be filled in with the adapter index
* \param outputIndex a pointer to be filled in with the output index. * \param outputIndex a pointer to be filled in with the output index
* \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError()
* for more information. * for more information.
* *
@@ -176,7 +176,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int prio
* \param threadID The Unix thread ID to change priority of. * \param threadID The Unix thread ID to change priority of.
* \param sdlPriority The new SDL_ThreadPriority value. * \param sdlPriority The new SDL_ThreadPriority value.
* \param schedPolicy The new scheduling policy (SCHED_FIFO, SCHED_RR, * \param schedPolicy The new scheduling policy (SCHED_FIFO, SCHED_RR,
* SCHED_OTHER, etc...). * SCHED_OTHER, etc...)
* \returns 0 on success, or -1 on error. * \returns 0 on success, or -1 on error.
* *
* \since This function is available since SDL 2.0.18. * \since This function is available since SDL 2.0.18.
@@ -188,7 +188,7 @@ extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID,
/* Platform specific functions for iOS */ /* Platform specific functions for iOS */
#ifdef __IPHONEOS__ #ifdef __IPHONEOS__
typedef void (SDLCALL *SDL_iOSAnimationCallback)(void*); #define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
/** /**
* Use this function to set the animation callback on Apple iOS. * Use this function to set the animation callback on Apple iOS.
@@ -210,9 +210,9 @@ typedef void (SDLCALL *SDL_iOSAnimationCallback)(void*);
* This functions is also accessible using the macro * This functions is also accessible using the macro
* SDL_iOSSetAnimationCallback() since SDL 2.0.4. * SDL_iOSSetAnimationCallback() since SDL 2.0.4.
* *
* \param window the window for which the animation callback should be set. * \param window the window for which the animation callback should be set
* \param interval the number of frames after which **callback** will be * \param interval the number of frames after which **callback** will be
* called. * called
* \param callback the function to call for every frame. * \param callback the function to call for every frame.
* \param callbackParam a pointer that is passed to `callback`. * \param callbackParam a pointer that is passed to `callback`.
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
@@ -222,10 +222,9 @@ typedef void (SDLCALL *SDL_iOSAnimationCallback)(void*);
* *
* \sa SDL_iPhoneSetEventPump * \sa SDL_iPhoneSetEventPump
*/ */
extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam); extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (SDLCALL *callback)(void*), void *callbackParam);
#define SDL_iOSSetAnimationCallback(window, interval, callback, callbackParam) SDL_iPhoneSetAnimationCallback(window, interval, callback, callbackParam)
#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
/** /**
* Use this function to enable or disable the SDL event pump on Apple iOS. * Use this function to enable or disable the SDL event pump on Apple iOS.
@@ -235,7 +234,7 @@ extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window,
* This functions is also accessible using the macro SDL_iOSSetEventPump() * This functions is also accessible using the macro SDL_iOSSetEventPump()
* since SDL 2.0.4. * since SDL 2.0.4.
* *
* \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it. * \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
@@ -243,9 +242,6 @@ extern DECLSPEC int SDLCALL SDL_iPhoneSetAnimationCallback(SDL_Window * window,
*/ */
extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled);
#define SDL_iOSSetEventPump(enabled) SDL_iPhoneSetEventPump(enabled)
/* end of iOS-specific functions. */
#endif /* __IPHONEOS__ */ #endif /* __IPHONEOS__ */
@@ -360,9 +356,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void);
extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void); extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void);
/** /**
* See the official Android developer guide for more information: See the official Android developer guide for more information:
* http://developer.android.com/guide/topics/data/data-storage.html http://developer.android.com/guide/topics/data/data-storage.html
*/ */
#define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01 #define SDL_ANDROID_EXTERNAL_STORAGE_READ 0x01
#define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02 #define SDL_ANDROID_EXTERNAL_STORAGE_WRITE 0x02
@@ -445,11 +441,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AndroidRequestPermission(const char *permis
* *
* https://developer.android.com/reference/android/view/Gravity * https://developer.android.com/reference/android/view/Gravity
* *
* \param message text message to be shown. * \param message text message to be shown
* \param duration 0=short, 1=long. * \param duration 0=short, 1=long
* \param gravity where the notification should appear on the screen. * \param gravity where the notification should appear on the screen.
* \param xoffset set this parameter only when gravity >=0. * \param xoffset set this parameter only when gravity >=0
* \param yoffset set this parameter only when gravity >=0. * \param yoffset set this parameter only when gravity >=0
* \returns 0 if success, -1 if any error occurs. * \returns 0 if success, -1 if any error occurs.
* *
* \since This function is available since SDL 2.0.16. * \since This function is available since SDL 2.0.16.
@@ -461,8 +457,8 @@ extern DECLSPEC int SDLCALL SDL_AndroidShowToast(const char* message, int durati
* *
* Override "boolean onUnhandledMessage(Message msg)" to handle the message. * Override "boolean onUnhandledMessage(Message msg)" to handle the message.
* *
* \param command user command that must be greater or equal to 0x8000. * \param command user command that must be greater or equal to 0x8000
* \param param user parameter. * \param param user parameter
* *
* \since This function is available since SDL 2.0.22. * \since This function is available since SDL 2.0.22.
*/ */
@@ -474,9 +470,9 @@ extern DECLSPEC int SDLCALL SDL_AndroidSendMessage(Uint32 command, int param);
#ifdef __WINRT__ #ifdef __WINRT__
/** /**
* WinRT / Windows Phone path types * \brief WinRT / Windows Phone path types
*/ */
typedef enum SDL_WinRT_Path typedef enum
{ {
/** \brief The installed app's root directory. /** \brief The installed app's root directory.
Files here are likely to be read-only. */ Files here are likely to be read-only. */
@@ -498,9 +494,9 @@ typedef enum SDL_WinRT_Path
/** /**
* WinRT Device Family * \brief WinRT Device Family
*/ */
typedef enum SDL_WinRT_DeviceFamily typedef enum
{ {
/** \brief Unknown family */ /** \brief Unknown family */
SDL_WINRT_DEVICEFAMILY_UNKNOWN, SDL_WINRT_DEVICEFAMILY_UNKNOWN,
@@ -528,7 +524,7 @@ typedef enum SDL_WinRT_DeviceFamily
* *
* https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx * https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
* *
* \param pathType the type of path to retrieve, one of SDL_WinRT_Path. * \param pathType the type of path to retrieve, one of SDL_WinRT_Path
* \returns a UCS-2 string (16-bit, wide-char) containing the path, or NULL if * \returns a UCS-2 string (16-bit, wide-char) containing the path, or NULL if
* the path is not available for any reason; call SDL_GetError() for * the path is not available for any reason; call SDL_GetError() for
* more information. * more information.
@@ -551,7 +547,7 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path
* *
* https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx * https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
* *
* \param pathType the type of path to retrieve, one of SDL_WinRT_Path. * \param pathType the type of path to retrieve, one of SDL_WinRT_Path
* \returns a UTF-8 string (8-bit, multi-byte) containing the path, or NULL if * \returns a UTF-8 string (8-bit, multi-byte) containing the path, or NULL if
* the path is not available for any reason; call SDL_GetError() for * the path is not available for any reason; call SDL_GetError() for
* more information. * more information.
@@ -597,8 +593,7 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void
/* Functions used only by GDK */ /* Functions used only by GDK */
#if defined(__GDK__) #if defined(__GDK__)
typedef struct XTaskQueueObject *XTaskQueueHandle; typedef struct XTaskQueueObject * XTaskQueueHandle;
typedef struct XUser *XUserHandle;
/** /**
* Gets a reference to the global async task queue handle for GDK, * Gets a reference to the global async task queue handle for GDK,
@@ -615,20 +610,6 @@ typedef struct XUser *XUserHandle;
*/ */
extern DECLSPEC int SDLCALL SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue); extern DECLSPEC int SDLCALL SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue);
/**
* Gets a reference to the default user handle for GDK.
*
* This is effectively a synchronous version of XUserAddAsync, which always
* prefers the default user and allows a sign-in UI.
*
* \param outUserHandle a pointer to be filled in with the default user
* handle.
* \returns 0 if success, -1 if any error occurs.
*
* \since This function is available since SDL 2.28.0.
*/
extern DECLSPEC int SDLCALL SDL_GDKGetDefaultUser(XUserHandle * outUserHandle);
#endif #endif
/* Ends C function definitions when using C++ */ /* Ends C function definitions when using C++ */
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,17 +19,10 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* WIKI CATEGORY: SYSWM */ /**
* \file SDL_syswm.h
/*
* # CategorySYSWM
* *
* Include file for SDL custom system window manager hooks. * Include file for SDL custom system window manager hooks.
*
* Your application has access to a special type of event SDL_SYSWMEVENT,
* which contains window-manager specific information and arrives whenever
* an unhandled window event occurs. This event is ignored by default, but
* you can enable it with SDL_EventState().
*/ */
#ifndef SDL_syswm_h_ #ifndef SDL_syswm_h_
@@ -40,6 +33,14 @@
#include "SDL_video.h" #include "SDL_video.h"
#include "SDL_version.h" #include "SDL_version.h"
/**
* \brief SDL_syswm.h
*
* Your application has access to a special type of event ::SDL_SYSWMEVENT,
* which contains window-manager specific information and arrives whenever
* an unhandled window event occurs. This event is ignored by default, but
* you can enable it with SDL_EventState().
*/
struct SDL_SysWMinfo; struct SDL_SysWMinfo;
#if !defined(SDL_PROTOTYPES_ONLY) #if !defined(SDL_PROTOTYPES_ONLY)
@@ -128,11 +129,10 @@ extern "C" {
#endif #endif
#if !defined(SDL_PROTOTYPES_ONLY) #if !defined(SDL_PROTOTYPES_ONLY)
/** /**
* These are the various supported windowing subsystems * These are the various supported windowing subsystems
*/ */
typedef enum SDL_SYSWM_TYPE typedef enum
{ {
SDL_SYSWM_UNKNOWN, SDL_SYSWM_UNKNOWN,
SDL_SYSWM_WINDOWS, SDL_SYSWM_WINDOWS,
@@ -152,7 +152,7 @@ typedef enum SDL_SYSWM_TYPE
} SDL_SYSWM_TYPE; } SDL_SYSWM_TYPE;
/** /**
* The custom event structure. * The custom event structure.
*/ */
struct SDL_SysWMmsg struct SDL_SysWMmsg
{ {
@@ -218,10 +218,10 @@ struct SDL_SysWMmsg
}; };
/** /**
* The custom window manager information structure. * The custom window manager information structure.
* *
* When this structure is returned, it holds information about which low level * When this structure is returned, it holds information about which
* system it is using, and will be one of SDL_SYSWM_TYPE. * low level system it is using, and will be one of SDL_SYSWM_TYPE.
*/ */
struct SDL_SysWMinfo struct SDL_SysWMinfo
{ {
@@ -363,8 +363,8 @@ typedef struct SDL_SysWMinfo SDL_SysWMinfo;
* `SDL_VERSION(&info.version)`, and then this function will fill in the rest * `SDL_VERSION(&info.version)`, and then this function will fill in the rest
* of the structure with information about the given window. * of the structure with information about the given window.
* *
* \param window the window about which information is being requested. * \param window the window about which information is being requested
* \param info an SDL_SysWMinfo structure filled in with window information. * \param info an SDL_SysWMinfo structure filled in with window information
* \returns SDL_TRUE if the function is implemented and the `version` member * \returns SDL_TRUE if the function is implemented and the `version` member
* of the `info` struct is valid, or SDL_FALSE if the information * of the `info` struct is valid, or SDL_FALSE if the information
* could not be retrieved; call SDL_GetError() for more information. * could not be retrieved; call SDL_GetError() for more information.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test.h * \file SDL_test.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_assert.h * \file SDL_test_assert.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -42,17 +42,17 @@
extern "C" { extern "C" {
#endif #endif
/* /**
* \brief Fails the assert. * \brief Fails the assert.
*/ */
#define ASSERT_FAIL 0 #define ASSERT_FAIL 0
/* /**
* \brief Passes the assert. * \brief Passes the assert.
*/ */
#define ASSERT_PASS 1 #define ASSERT_PASS 1
/* /**
* \brief Assert that logs and break execution flow on failures. * \brief Assert that logs and break execution flow on failures.
* *
* \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
@@ -60,7 +60,7 @@ extern "C" {
*/ */
void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
/* /**
* \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. * \brief Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters.
* *
* \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0).
@@ -70,25 +70,25 @@ void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *as
*/ */
int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2);
/* /**
* \brief Explicitly pass without checking an assertion condition. Updates assertion counter. * \brief Explicitly pass without checking an assertion condition. Updates assertion counter.
* *
* \param assertDescription Message to log with the assert describing it. * \param assertDescription Message to log with the assert describing it.
*/ */
void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1); void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1);
/* /**
* \brief Resets the assert summary counters to zero. * \brief Resets the assert summary counters to zero.
*/ */
void SDLTest_ResetAssertSummary(void); void SDLTest_ResetAssertSummary(void);
/* /**
* \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR.
*/ */
void SDLTest_LogAssertSummary(void); void SDLTest_LogAssertSummary(void);
/* /**
* \brief Converts the current assert summary state to a test result. * \brief Converts the current assert summary state to a test result.
* *
* \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_common.h * \file SDL_test_common.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -129,7 +129,7 @@ extern "C" {
/* Function prototypes */ /* Function prototypes */
/* /**
* \brief Parse command line parameters and create common state. * \brief Parse command line parameters and create common state.
* *
* \param argv Array of command line parameters * \param argv Array of command line parameters
@@ -139,7 +139,7 @@ extern "C" {
*/ */
SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags); SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
/* /**
* \brief Process one common argument. * \brief Process one common argument.
* *
* \param state The common state describing the test window to create. * \param state The common state describing the test window to create.
@@ -150,7 +150,7 @@ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags);
int SDLTest_CommonArg(SDLTest_CommonState * state, int index); int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
/* /**
* \brief Logs command line usage info. * \brief Logs command line usage info.
* *
* This logs the appropriate command line options for the subsystems in use * This logs the appropriate command line options for the subsystems in use
@@ -164,7 +164,7 @@ int SDLTest_CommonArg(SDLTest_CommonState * state, int index);
*/ */
void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options); void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, const char **options);
/* /**
* \brief Returns common usage information * \brief Returns common usage information
* *
* You should (probably) be using SDLTest_CommonLogUsage() instead, but this * You should (probably) be using SDLTest_CommonLogUsage() instead, but this
@@ -177,7 +177,7 @@ void SDLTest_CommonLogUsage(SDLTest_CommonState * state, const char *argv0, cons
*/ */
const char *SDLTest_CommonUsage(SDLTest_CommonState * state); const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
/* /**
* \brief Open test window. * \brief Open test window.
* *
* \param state The common state describing the test window to create. * \param state The common state describing the test window to create.
@@ -186,7 +186,7 @@ const char *SDLTest_CommonUsage(SDLTest_CommonState * state);
*/ */
SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state); SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
/* /**
* \brief Easy argument handling when test app doesn't need any custom args. * \brief Easy argument handling when test app doesn't need any custom args.
* *
* \param state The common state describing the test window to create. * \param state The common state describing the test window to create.
@@ -197,7 +197,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state);
*/ */
SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc, char **argv); SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc, char **argv);
/* /**
* \brief Common event handler for test windows. * \brief Common event handler for test windows.
* *
* \param state The common state used to create test window. * \param state The common state used to create test window.
@@ -207,7 +207,7 @@ SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState * state, const int argc,
*/ */
void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done); void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done);
/* /**
* \brief Close test window. * \brief Close test window.
* *
* \param state The common state used to create test window. * \param state The common state used to create test window.
@@ -215,7 +215,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *do
*/ */
void SDLTest_CommonQuit(SDLTest_CommonState * state); void SDLTest_CommonQuit(SDLTest_CommonState * state);
/* /**
* \brief Draws various window information (position, size, etc.) to the renderer. * \brief Draws various window information (position, size, etc.) to the renderer.
* *
* \param renderer The renderer to draw to. * \param renderer The renderer to draw to.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_compare.h * \file SDL_test_compare.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -46,7 +46,7 @@
extern "C" { extern "C" {
#endif #endif
/* /**
* \brief Compares a surface and with reference image data for equality * \brief Compares a surface and with reference image data for equality
* *
* \param surface Surface used in comparison * \param surface Surface used in comparison
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_crc32.h * \file SDL_test_crc32.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -60,7 +60,7 @@ extern "C" {
#define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */ #define CRC32_POLY 0xEDB88320 /* Perl String::CRC32 compatible */
#endif #endif
/* /**
* Data structure for CRC32 (checksum) computation * Data structure for CRC32 (checksum) computation
*/ */
typedef struct { typedef struct {
@@ -69,7 +69,7 @@ extern "C" {
/* ---------- Function Prototypes ------------- */ /* ---------- Function Prototypes ------------- */
/* /**
* \brief Initialize the CRC context * \brief Initialize the CRC context
* *
* Note: The function initializes the crc table required for all crc calculations. * Note: The function initializes the crc table required for all crc calculations.
@@ -82,7 +82,7 @@ extern "C" {
int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext); int SDLTest_Crc32Init(SDLTest_Crc32Context * crcContext);
/* /**
* \brief calculate a crc32 from a data block * \brief calculate a crc32 from a data block
* *
* \param crcContext pointer to context variable * \param crcContext pointer to context variable
@@ -101,7 +101,7 @@ int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32);
int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32);
/* /**
* \brief clean up CRC context * \brief clean up CRC context
* *
* \param crcContext pointer to context variable * \param crcContext pointer to context variable
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_font.h * \file SDL_test_font.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -41,7 +41,7 @@ extern "C" {
#define FONT_CHARACTER_SIZE 8 #define FONT_CHARACTER_SIZE 8
#define FONT_LINE_HEIGHT (FONT_CHARACTER_SIZE + 2) #define FONT_LINE_HEIGHT (FONT_CHARACTER_SIZE + 2)
/* /**
* \brief Draw a string in the currently set font. * \brief Draw a string in the currently set font.
* *
* \param renderer The renderer to draw on. * \param renderer The renderer to draw on.
@@ -53,7 +53,7 @@ extern "C" {
*/ */
int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c); int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c);
/* /**
* \brief Draw a UTF-8 string in the currently set font. * \brief Draw a UTF-8 string in the currently set font.
* *
* The font currently only supports characters in the Basic Latin and Latin-1 Supplement sets. * The font currently only supports characters in the Basic Latin and Latin-1 Supplement sets.
@@ -67,7 +67,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c);
*/ */
int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s); int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s);
/* /**
* \brief Data used for multi-line text output * \brief Data used for multi-line text output
*/ */
typedef struct SDLTest_TextWindow typedef struct SDLTest_TextWindow
@@ -78,7 +78,7 @@ typedef struct SDLTest_TextWindow
char **lines; char **lines;
} SDLTest_TextWindow; } SDLTest_TextWindow;
/* /**
* \brief Create a multi-line text output window * \brief Create a multi-line text output window
* *
* \param x The X coordinate of the upper left corner of the window. * \param x The X coordinate of the upper left corner of the window.
@@ -92,7 +92,7 @@ typedef struct SDLTest_TextWindow
*/ */
SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h); SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h);
/* /**
* \brief Display a multi-line text output window * \brief Display a multi-line text output window
* *
* This function should be called every frame to display the text * This function should be called every frame to display the text
@@ -104,7 +104,7 @@ SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h);
*/ */
void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer); void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer);
/* /**
* \brief Add text to a multi-line text output window * \brief Add text to a multi-line text output window
* *
* Adds UTF-8 text to the end of the current text. The newline character starts a * Adds UTF-8 text to the end of the current text. The newline character starts a
@@ -119,7 +119,7 @@ void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *render
*/ */
void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2);
/* /**
* \brief Add text to a multi-line text output window * \brief Add text to a multi-line text output window
* *
* Adds UTF-8 text to the end of the current text. The newline character starts a * Adds UTF-8 text to the end of the current text. The newline character starts a
@@ -134,7 +134,7 @@ void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_ST
*/ */
void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len); void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len);
/* /**
* \brief Clear the text in a multi-line text output window * \brief Clear the text in a multi-line text output window
* *
* \param textwin The text output window * \param textwin The text output window
@@ -143,7 +143,7 @@ void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char
*/ */
void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin); void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin);
/* /**
* \brief Free the storage associated with a multi-line text output window * \brief Free the storage associated with a multi-line text output window
* *
* \param textwin The text output window * \param textwin The text output window
@@ -152,7 +152,7 @@ void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin);
*/ */
void SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin); void SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin);
/* /**
* \brief Cleanup textures used by font drawing functions. * \brief Cleanup textures used by font drawing functions.
*/ */
void SDLTest_CleanupTextDrawing(void); void SDLTest_CleanupTextDrawing(void);
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_fuzzer.h * \file SDL_test_fuzzer.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -48,13 +48,13 @@ extern "C" {
*/ */
/* /**
* \file * \file
* Note: The fuzzer implementation uses a static instance of random context * Note: The fuzzer implementation uses a static instance of random context
* internally which makes it thread-UNsafe. * internally which makes it thread-UNsafe.
*/ */
/* /**
* Initializes the fuzzer for a test * Initializes the fuzzer for a test
* *
* \param execKey Execution "Key" that initializes the random number generator uniquely for the test. * \param execKey Execution "Key" that initializes the random number generator uniquely for the test.
@@ -63,14 +63,14 @@ extern "C" {
void SDLTest_FuzzerInit(Uint64 execKey); void SDLTest_FuzzerInit(Uint64 execKey);
/* /**
* Returns a random Uint8 * Returns a random Uint8
* *
* \returns a generated integer * \returns a generated integer
*/ */
Uint8 SDLTest_RandomUint8(void); Uint8 SDLTest_RandomUint8(void);
/* /**
* Returns a random Sint8 * Returns a random Sint8
* *
* \returns a generated signed integer * \returns a generated signed integer
@@ -78,14 +78,14 @@ Uint8 SDLTest_RandomUint8(void);
Sint8 SDLTest_RandomSint8(void); Sint8 SDLTest_RandomSint8(void);
/* /**
* Returns a random Uint16 * Returns a random Uint16
* *
* \returns a generated integer * \returns a generated integer
*/ */
Uint16 SDLTest_RandomUint16(void); Uint16 SDLTest_RandomUint16(void);
/* /**
* Returns a random Sint16 * Returns a random Sint16
* *
* \returns a generated signed integer * \returns a generated signed integer
@@ -93,7 +93,7 @@ Uint16 SDLTest_RandomUint16(void);
Sint16 SDLTest_RandomSint16(void); Sint16 SDLTest_RandomSint16(void);
/* /**
* Returns a random integer * Returns a random integer
* *
* \returns a generated integer * \returns a generated integer
@@ -101,14 +101,14 @@ Sint16 SDLTest_RandomSint16(void);
Sint32 SDLTest_RandomSint32(void); Sint32 SDLTest_RandomSint32(void);
/* /**
* Returns a random positive integer * Returns a random positive integer
* *
* \returns a generated integer * \returns a generated integer
*/ */
Uint32 SDLTest_RandomUint32(void); Uint32 SDLTest_RandomUint32(void);
/* /**
* Returns random Uint64. * Returns random Uint64.
* *
* \returns a generated integer * \returns a generated integer
@@ -116,36 +116,36 @@ Uint32 SDLTest_RandomUint32(void);
Uint64 SDLTest_RandomUint64(void); Uint64 SDLTest_RandomUint64(void);
/* /**
* Returns random Sint64. * Returns random Sint64.
* *
* \returns a generated signed integer * \returns a generated signed integer
*/ */
Sint64 SDLTest_RandomSint64(void); Sint64 SDLTest_RandomSint64(void);
/* /**
* \returns a random float in range [0.0 - 1.0] * \returns a random float in range [0.0 - 1.0]
*/ */
float SDLTest_RandomUnitFloat(void); float SDLTest_RandomUnitFloat(void);
/* /**
* \returns a random double in range [0.0 - 1.0] * \returns a random double in range [0.0 - 1.0]
*/ */
double SDLTest_RandomUnitDouble(void); double SDLTest_RandomUnitDouble(void);
/* /**
* \returns a random float. * \returns a random float.
* *
*/ */
float SDLTest_RandomFloat(void); float SDLTest_RandomFloat(void);
/* /**
* \returns a random double. * \returns a random double.
* *
*/ */
double SDLTest_RandomDouble(void); double SDLTest_RandomDouble(void);
/* /**
* Returns a random boundary value for Uint8 within the given boundaries. * Returns a random boundary value for Uint8 within the given boundaries.
* Boundaries are inclusive, see the usage examples below. If validDomain * Boundaries are inclusive, see the usage examples below. If validDomain
* is true, the function will only return valid boundaries, otherwise non-valid * is true, the function will only return valid boundaries, otherwise non-valid
@@ -166,7 +166,7 @@ double SDLTest_RandomDouble(void);
*/ */
Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain); Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain);
/* /**
* Returns a random boundary value for Uint16 within the given boundaries. * Returns a random boundary value for Uint16 within the given boundaries.
* Boundaries are inclusive, see the usage examples below. If validDomain * Boundaries are inclusive, see the usage examples below. If validDomain
* is true, the function will only return valid boundaries, otherwise non-valid * is true, the function will only return valid boundaries, otherwise non-valid
@@ -187,7 +187,7 @@ Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_boo
*/ */
Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain); Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain);
/* /**
* Returns a random boundary value for Uint32 within the given boundaries. * Returns a random boundary value for Uint32 within the given boundaries.
* Boundaries are inclusive, see the usage examples below. If validDomain * Boundaries are inclusive, see the usage examples below. If validDomain
* is true, the function will only return valid boundaries, otherwise non-valid * is true, the function will only return valid boundaries, otherwise non-valid
@@ -208,7 +208,7 @@ Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL
*/ */
Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain); Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain);
/* /**
* Returns a random boundary value for Uint64 within the given boundaries. * Returns a random boundary value for Uint64 within the given boundaries.
* Boundaries are inclusive, see the usage examples below. If validDomain * Boundaries are inclusive, see the usage examples below. If validDomain
* is true, the function will only return valid boundaries, otherwise non-valid * is true, the function will only return valid boundaries, otherwise non-valid
@@ -229,7 +229,7 @@ Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL
*/ */
Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain); Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain);
/* /**
* Returns a random boundary value for Sint8 within the given boundaries. * Returns a random boundary value for Sint8 within the given boundaries.
* Boundaries are inclusive, see the usage examples below. If validDomain * Boundaries are inclusive, see the usage examples below. If validDomain
* is true, the function will only return valid boundaries, otherwise non-valid * is true, the function will only return valid boundaries, otherwise non-valid
@@ -251,7 +251,7 @@ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL
Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain); Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain);
/* /**
* Returns a random boundary value for Sint16 within the given boundaries. * Returns a random boundary value for Sint16 within the given boundaries.
* Boundaries are inclusive, see the usage examples below. If validDomain * Boundaries are inclusive, see the usage examples below. If validDomain
* is true, the function will only return valid boundaries, otherwise non-valid * is true, the function will only return valid boundaries, otherwise non-valid
@@ -272,7 +272,7 @@ Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_boo
*/ */
Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain); Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain);
/* /**
* Returns a random boundary value for Sint32 within the given boundaries. * Returns a random boundary value for Sint32 within the given boundaries.
* Boundaries are inclusive, see the usage examples below. If validDomain * Boundaries are inclusive, see the usage examples below. If validDomain
* is true, the function will only return valid boundaries, otherwise non-valid * is true, the function will only return valid boundaries, otherwise non-valid
@@ -293,7 +293,7 @@ Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL
*/ */
Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain); Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain);
/* /**
* Returns a random boundary value for Sint64 within the given boundaries. * Returns a random boundary value for Sint64 within the given boundaries.
* Boundaries are inclusive, see the usage examples below. If validDomain * Boundaries are inclusive, see the usage examples below. If validDomain
* is true, the function will only return valid boundaries, otherwise non-valid * is true, the function will only return valid boundaries, otherwise non-valid
@@ -315,7 +315,7 @@ Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL
Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain); Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain);
/* /**
* Returns integer in range [min, max] (inclusive). * Returns integer in range [min, max] (inclusive).
* Min and max values can be negative values. * Min and max values can be negative values.
* If Max in smaller than min, then the values are swapped. * If Max in smaller than min, then the values are swapped.
@@ -329,7 +329,7 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL
Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
/* /**
* Generates random null-terminated string. The minimum length for * Generates random null-terminated string. The minimum length for
* the string is 1 character, maximum length for the string is 255 * the string is 1 character, maximum length for the string is 255
* characters and it can contain ASCII characters from 32 to 126. * characters and it can contain ASCII characters from 32 to 126.
@@ -341,7 +341,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max);
char * SDLTest_RandomAsciiString(void); char * SDLTest_RandomAsciiString(void);
/* /**
* Generates random null-terminated string. The maximum length for * Generates random null-terminated string. The maximum length for
* the string is defined by the maxLength parameter. * the string is defined by the maxLength parameter.
* String can contain ASCII characters from 32 to 126. * String can contain ASCII characters from 32 to 126.
@@ -355,7 +355,7 @@ char * SDLTest_RandomAsciiString(void);
char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength); char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
/* /**
* Generates random null-terminated string. The length for * Generates random null-terminated string. The length for
* the string is defined by the size parameter. * the string is defined by the size parameter.
* String can contain ASCII characters from 32 to 126. * String can contain ASCII characters from 32 to 126.
@@ -368,8 +368,7 @@ char * SDLTest_RandomAsciiStringWithMaximumLength(int maxLength);
*/ */
char * SDLTest_RandomAsciiStringOfSize(int size); char * SDLTest_RandomAsciiStringOfSize(int size);
/**
/*
* Get the invocation count for the fuzzer since last ...FuzzerInit. * Get the invocation count for the fuzzer since last ...FuzzerInit.
* *
* \returns the invocation count. * \returns the invocation count.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_harness.h * \file SDL_test_harness.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -69,7 +69,7 @@ typedef int (*SDLTest_TestCaseFp)(void *arg);
/* !< Function pointer to a test case teardown function (run after every test) */ /* !< Function pointer to a test case teardown function (run after every test) */
typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); typedef void (*SDLTest_TestCaseTearDownFp)(void *arg);
/* /**
* Holds information about a single test case. * Holds information about a single test case.
*/ */
typedef struct SDLTest_TestCaseReference { typedef struct SDLTest_TestCaseReference {
@@ -83,7 +83,7 @@ typedef struct SDLTest_TestCaseReference {
int enabled; int enabled;
} SDLTest_TestCaseReference; } SDLTest_TestCaseReference;
/* /**
* Holds information about a test suite (multiple test cases). * Holds information about a test suite (multiple test cases).
*/ */
typedef struct SDLTest_TestSuiteReference { typedef struct SDLTest_TestSuiteReference {
@@ -98,7 +98,7 @@ typedef struct SDLTest_TestSuiteReference {
} SDLTest_TestSuiteReference; } SDLTest_TestSuiteReference;
/* /**
* \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z). * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z).
* *
* Note: The returned string needs to be deallocated by the caller. * Note: The returned string needs to be deallocated by the caller.
@@ -109,7 +109,7 @@ typedef struct SDLTest_TestSuiteReference {
*/ */
char *SDLTest_GenerateRunSeed(const int length); char *SDLTest_GenerateRunSeed(const int length);
/* /**
* \brief Execute a test suite using the given run seed and execution key. * \brief Execute a test suite using the given run seed and execution key.
* *
* \param testSuites Suites containing the test case. * \param testSuites Suites containing the test case.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_images.h * \file SDL_test_images.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -44,7 +44,7 @@
extern "C" { extern "C" {
#endif #endif
/* /**
*Type for test images. *Type for test images.
*/ */
typedef struct SDLTest_SurfaceImage_s { typedef struct SDLTest_SurfaceImage_s {
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_log.h * \file SDL_test_log.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -42,14 +42,14 @@
extern "C" { extern "C" {
#endif #endif
/* /**
* \brief Prints given message with a timestamp in the TEST category and INFO priority. * \brief Prints given message with a timestamp in the TEST category and INFO priority.
* *
* \param fmt Message to be logged * \param fmt Message to be logged
*/ */
void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1);
/* /**
* \brief Prints given message with a timestamp in the TEST category and the ERROR priority. * \brief Prints given message with a timestamp in the TEST category and the ERROR priority.
* *
* \param fmt Message to be logged * \param fmt Message to be logged
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_md5.h * \file SDL_test_md5.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -77,7 +77,7 @@ extern "C" {
/* ---------- Function Prototypes ------------- */ /* ---------- Function Prototypes ------------- */
/* /**
* \brief initialize the context * \brief initialize the context
* *
* \param mdContext pointer to context variable * \param mdContext pointer to context variable
@@ -89,7 +89,7 @@ extern "C" {
void SDLTest_Md5Init(SDLTest_Md5Context * mdContext); void SDLTest_Md5Init(SDLTest_Md5Context * mdContext);
/* /**
* \brief update digest from variable length data * \brief update digest from variable length data
* *
* \param mdContext pointer to context variable * \param mdContext pointer to context variable
@@ -105,7 +105,7 @@ extern "C" {
unsigned int inLen); unsigned int inLen);
/* /**
* \brief complete digest computation * \brief complete digest computation
* *
* \param mdContext pointer to context variable * \param mdContext pointer to context variable
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_memory.h * \file SDL_test_memory.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -37,14 +37,14 @@ extern "C" {
#endif #endif
/* /**
* \brief Start tracking SDL memory allocations * \brief Start tracking SDL memory allocations
* *
* \note This should be called before any other SDL functions for complete tracking coverage * \note This should be called before any other SDL functions for complete tracking coverage
*/ */
int SDLTest_TrackAllocations(void); int SDLTest_TrackAllocations(void);
/* /**
* \brief Print a log of any outstanding allocations * \brief Print a log of any outstanding allocations
* *
* \note This can be called after SDL_Quit() * \note This can be called after SDL_Quit()
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,7 +19,7 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* /**
* \file SDL_test_random.h * \file SDL_test_random.h
* *
* Include file for SDL test framework. * Include file for SDL test framework.
@@ -67,7 +67,7 @@ extern "C" {
/* --- Function prototypes */ /* --- Function prototypes */
/* /**
* \brief Initialize random number generator with two integers. * \brief Initialize random number generator with two integers.
* *
* Note: The random sequence of numbers returned by ...Random() is the * Note: The random sequence of numbers returned by ...Random() is the
@@ -81,7 +81,7 @@ extern "C" {
void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi, void SDLTest_RandomInit(SDLTest_RandomContext * rndContext, unsigned int xi,
unsigned int ci); unsigned int ci);
/* /**
* \brief Initialize random number generator based on current system time. * \brief Initialize random number generator based on current system time.
* *
* \param rndContext pointer to context structure * \param rndContext pointer to context structure
@@ -90,7 +90,7 @@ extern "C" {
void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext); void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext);
/* /**
* \brief Initialize random number generator based on current system time. * \brief Initialize random number generator based on current system time.
* *
* Note: ...RandomInit() or ...RandomInitTime() must have been called * Note: ...RandomInit() or ...RandomInitTime() must have been called
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -23,9 +23,9 @@
#define SDL_thread_h_ #define SDL_thread_h_
/** /**
* # CategoryThread * \file SDL_thread.h
* *
* Header for the SDL thread management routines. * Header for the SDL thread management routines.
*/ */
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
@@ -63,18 +63,16 @@ typedef unsigned long SDL_threadID;
typedef unsigned int SDL_TLSID; typedef unsigned int SDL_TLSID;
/** /**
* The SDL thread priority. * The SDL thread priority.
* *
* SDL will make system changes as necessary in order to apply the thread * SDL will make system changes as necessary in order to apply the thread priority.
* priority. Code which attempts to control thread state related to priority * Code which attempts to control thread state related to priority should be aware
* should be aware that calling SDL_SetThreadPriority may alter such state. * that calling SDL_SetThreadPriority may alter such state.
* SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of this * SDL_HINT_THREAD_PRIORITY_POLICY can be used to control aspects of this behavior.
* behavior.
* *
* On many systems you require special privileges to set high or time critical * \note On many systems you require special privileges to set high or time critical priority.
* priority.
*/ */
typedef enum SDL_ThreadPriority { typedef enum {
SDL_THREAD_PRIORITY_LOW, SDL_THREAD_PRIORITY_LOW,
SDL_THREAD_PRIORITY_NORMAL, SDL_THREAD_PRIORITY_NORMAL,
SDL_THREAD_PRIORITY_HIGH, SDL_THREAD_PRIORITY_HIGH,
@@ -84,7 +82,7 @@ typedef enum SDL_ThreadPriority {
/** /**
* The function passed to SDL_CreateThread(). * The function passed to SDL_CreateThread().
* *
* \param data what was passed as `data` to SDL_CreateThread(). * \param data what was passed as `data` to SDL_CreateThread()
* \returns a value that can be reported through SDL_WaitThread(). * \returns a value that can be reported through SDL_WaitThread().
*/ */
typedef int (SDLCALL * SDL_ThreadFunction) (void *data); typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
@@ -194,9 +192,9 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const siz
* SDL_CreateThreadWithStackSize(fn, name, 0, data); * SDL_CreateThreadWithStackSize(fn, name, 0, data);
* ``` * ```
* *
* \param fn the SDL_ThreadFunction function to call in the new thread. * \param fn the SDL_ThreadFunction function to call in the new thread
* \param name the name of the thread. * \param name the name of the thread
* \param data a pointer that is passed to `fn`. * \param data a pointer that is passed to `fn`
* \returns an opaque pointer to the new thread object on success, NULL if the * \returns an opaque pointer to the new thread object on success, NULL if the
* new thread could not be created; call SDL_GetError() for more * new thread could not be created; call SDL_GetError() for more
* information. * information.
@@ -240,10 +238,10 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data);
* function, but for backwards compatibility, this is currently a separate * function, but for backwards compatibility, this is currently a separate
* function. * function.
* *
* \param fn the SDL_ThreadFunction function to call in the new thread. * \param fn the SDL_ThreadFunction function to call in the new thread
* \param name the name of the thread. * \param name the name of the thread
* \param stacksize the size, in bytes, to allocate for the new thread stack. * \param stacksize the size, in bytes, to allocate for the new thread stack.
* \param data a pointer that is passed to `fn`. * \param data a pointer that is passed to `fn`
* \returns an opaque pointer to the new thread object on success, NULL if the * \returns an opaque pointer to the new thread object on success, NULL if the
* new thread could not be created; call SDL_GetError() for more * new thread could not be created; call SDL_GetError() for more
* information. * information.
@@ -263,7 +261,7 @@ SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const siz
* This is internal memory, not to be freed by the caller, and remains valid * This is internal memory, not to be freed by the caller, and remains valid
* until the specified thread is cleaned up by SDL_WaitThread(). * until the specified thread is cleaned up by SDL_WaitThread().
* *
* \param thread the thread to query. * \param thread the thread to query
* \returns a pointer to a UTF-8 string that names the specified thread, or * \returns a pointer to a UTF-8 string that names the specified thread, or
* NULL if it doesn't have a name. * NULL if it doesn't have a name.
* *
@@ -298,7 +296,7 @@ extern DECLSPEC SDL_threadID SDLCALL SDL_ThreadID(void);
* If SDL is running on a platform that does not support threads the return * If SDL is running on a platform that does not support threads the return
* value will always be zero. * value will always be zero.
* *
* \param thread the thread to query. * \param thread the thread to query
* \returns the ID of the specified thread, or the ID of the current thread if * \returns the ID of the specified thread, or the ID of the current thread if
* `thread` is NULL. * `thread` is NULL.
* *
@@ -315,7 +313,7 @@ extern DECLSPEC SDL_threadID SDLCALL SDL_GetThreadID(SDL_Thread * thread);
* promote the thread to a higher priority) at all, and some require you to be * promote the thread to a higher priority) at all, and some require you to be
* an administrator account. Be prepared for this to fail. * an administrator account. Be prepared for this to fail.
* *
* \param priority the SDL_ThreadPriority to set. * \param priority the SDL_ThreadPriority to set
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -346,7 +344,7 @@ extern DECLSPEC int SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority);
* afterward. * afterward.
* *
* \param thread the SDL_Thread pointer that was returned from the * \param thread the SDL_Thread pointer that was returned from the
* SDL_CreateThread() call that started this thread. * SDL_CreateThread() call that started this thread
* \param status pointer to an integer that will receive the value returned * \param status pointer to an integer that will receive the value returned
* from the thread function by its 'return', or NULL to not * from the thread function by its 'return', or NULL to not
* receive such value back. * receive such value back.
@@ -385,7 +383,7 @@ extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread * thread, int *status);
* It is safe to pass NULL to this function; it is a no-op. * It is safe to pass NULL to this function; it is a no-op.
* *
* \param thread the SDL_Thread pointer that was returned from the * \param thread the SDL_Thread pointer that was returned from the
* SDL_CreateThread() call that started this thread. * SDL_CreateThread() call that started this thread
* *
* \since This function is available since SDL 2.0.2. * \since This function is available since SDL 2.0.2.
* *
@@ -412,7 +410,7 @@ extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void);
/** /**
* Get the current thread's value associated with a thread local storage ID. * Get the current thread's value associated with a thread local storage ID.
* *
* \param id the thread local storage ID. * \param id the thread local storage ID
* \returns the value associated with the ID for the current thread or NULL if * \returns the value associated with the ID for the current thread or NULL if
* no value has been set; call SDL_GetError() for more information. * no value has been set; call SDL_GetError() for more information.
* *
@@ -423,8 +421,6 @@ extern DECLSPEC SDL_TLSID SDLCALL SDL_TLSCreate(void);
*/ */
extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id); extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id);
typedef void (SDLCALL *SDL_TLSDestructorCallback)(void*);
/** /**
* Set the current thread's value associated with a thread local storage ID. * Set the current thread's value associated with a thread local storage ID.
* *
@@ -436,10 +432,10 @@ typedef void (SDLCALL *SDL_TLSDestructorCallback)(void*);
* *
* where its parameter `value` is what was passed as `value` to SDL_TLSSet(). * where its parameter `value` is what was passed as `value` to SDL_TLSSet().
* *
* \param id the thread local storage ID. * \param id the thread local storage ID
* \param value the value to associate with the ID for the current thread. * \param value the value to associate with the ID for the current thread
* \param destructor a function called when the thread exits, to free the * \param destructor a function called when the thread exits, to free the
* value. * value
* \returns 0 on success or a negative error code on failure; call * \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
@@ -448,7 +444,7 @@ typedef void (SDLCALL *SDL_TLSDestructorCallback)(void*);
* \sa SDL_TLSCreate * \sa SDL_TLSCreate
* \sa SDL_TLSGet * \sa SDL_TLSGet
*/ */
extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, SDL_TLSDestructorCallback destructor); extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*));
/** /**
* Cleanup all TLS data for this thread. * Cleanup all TLS data for this thread.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -23,9 +23,9 @@
#define SDL_timer_h_ #define SDL_timer_h_
/** /**
* # CategoryTimer * \file SDL_timer.h
* *
* Header for the SDL time management routines. * Header for the SDL time management routines.
*/ */
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
@@ -89,8 +89,8 @@ extern DECLSPEC Uint64 SDLCALL SDL_GetTicks64(void);
* days, but should _not_ be used with SDL_GetTicks64(), which does not have * days, but should _not_ be used with SDL_GetTicks64(), which does not have
* that problem. * that problem.
* *
* For example, with SDL_GetTicks(), if you want to wait 100 ms, you could do * For example, with SDL_GetTicks(), if you want to wait 100 ms, you could
* this: * do this:
* *
* ```c * ```c
* const Uint32 timeout = SDL_GetTicks() + 100; * const Uint32 timeout = SDL_GetTicks() + 100;
@@ -99,9 +99,9 @@ extern DECLSPEC Uint64 SDLCALL SDL_GetTicks64(void);
* } * }
* ``` * ```
* *
* Note that this does not handle tick differences greater than 2^31 so take * Note that this does not handle tick differences greater
* care when using the above kind of code with large timeout delays (tens of * than 2^31 so take care when using the above kind of code
* days). * with large timeout delays (tens of days).
*/ */
#define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0) #define SDL_TICKS_PASSED(A, B) ((Sint32)((B) - (A)) <= 0)
@@ -140,7 +140,7 @@ extern DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void);
* waits at least the specified time, but possibly longer due to OS * waits at least the specified time, but possibly longer due to OS
* scheduling. * scheduling.
* *
* \param ms the number of milliseconds to delay. * \param ms the number of milliseconds to delay
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
*/ */
@@ -149,10 +149,10 @@ extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
/** /**
* Function prototype for the timer callback function. * Function prototype for the timer callback function.
* *
* The callback function is passed the current timer interval and returns the * The callback function is passed the current timer interval and returns
* next timer interval. If the returned value is the same as the one passed * the next timer interval. If the returned value is the same as the one
* in, the periodic alarm continues, otherwise a new alarm is scheduled. If * passed in, the periodic alarm continues, otherwise a new alarm is
* the callback returns 0, the periodic alarm is cancelled. * scheduled. If the callback returns 0, the periodic alarm is cancelled.
*/ */
typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param); typedef Uint32 (SDLCALL * SDL_TimerCallback) (Uint32 interval, void *param);
@@ -182,10 +182,10 @@ typedef int SDL_TimerID;
* time with SDL_GetTicks() or SDL_GetPerformanceCounter() in case your * time with SDL_GetTicks() or SDL_GetPerformanceCounter() in case your
* callback needs to adjust for variances. * callback needs to adjust for variances.
* *
* \param interval the timer delay, in milliseconds, passed to `callback`. * \param interval the timer delay, in milliseconds, passed to `callback`
* \param callback the SDL_TimerCallback function to call when the specified * \param callback the SDL_TimerCallback function to call when the specified
* `interval` elapses. * `interval` elapses
* \param param a pointer that is passed to `callback`. * \param param a pointer that is passed to `callback`
* \returns a timer ID or 0 if an error occurs; call SDL_GetError() for more * \returns a timer ID or 0 if an error occurs; call SDL_GetError() for more
* information. * information.
* *
@@ -200,7 +200,7 @@ extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval,
/** /**
* Remove a timer created with SDL_AddTimer(). * Remove a timer created with SDL_AddTimer().
* *
* \param id the ID of the timer to remove. * \param id the ID of the timer to remove
* \returns SDL_TRUE if the timer is removed or SDL_FALSE if the timer wasn't * \returns SDL_TRUE if the timer is removed or SDL_FALSE if the timer wasn't
* found. * found.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryTouch * \file SDL_touch.h
* *
* Include file for SDL touch event handling. * Include file for SDL touch event handling.
*/ */
#ifndef SDL_touch_h_ #ifndef SDL_touch_h_
@@ -85,7 +85,7 @@ extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
/** /**
* Get the touch ID with the given index. * Get the touch ID with the given index.
* *
* \param index the touch device index. * \param index the touch device index
* \returns the touch ID with the given index on success or 0 if the index is * \returns the touch ID with the given index on success or 0 if the index is
* invalid; call SDL_GetError() for more information. * invalid; call SDL_GetError() for more information.
* *
@@ -113,7 +113,7 @@ extern DECLSPEC SDL_TouchDeviceType SDLCALL SDL_GetTouchDeviceType(SDL_TouchID t
/** /**
* Get the number of active fingers for a given touch device. * Get the number of active fingers for a given touch device.
* *
* \param touchID the ID of a touch device. * \param touchID the ID of a touch device
* \returns the number of active fingers for a given touch device on success * \returns the number of active fingers for a given touch device on success
* or 0 on failure; call SDL_GetError() for more information. * or 0 on failure; call SDL_GetError() for more information.
* *
@@ -128,8 +128,8 @@ extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
* *
* The returned resource is owned by SDL and should not be deallocated. * The returned resource is owned by SDL and should not be deallocated.
* *
* \param touchID the ID of the requested touch device. * \param touchID the ID of the requested touch device
* \param index the index of the requested finger. * \param index the index of the requested finger
* \returns a pointer to the SDL_Finger object or NULL if no object at the * \returns a pointer to the SDL_Finger object or NULL if no object at the
* given ID and index could be found. * given ID and index could be found.
* *
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -19,6 +19,11 @@
3. This notice may not be removed or altered from any source distribution. 3. This notice may not be removed or altered from any source distribution.
*/ */
/* DEPRECATED */ /**
* \file SDL_types.h
*
* \deprecated
*/
/* DEPRECATED */
#include "SDL_stdinc.h" #include "SDL_stdinc.h"
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages warranty. In no event will the authors be held liable for any damages
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryVersion * \file SDL_version.h
* *
* This header defines the current SDL version. * This header defines the current SDL version.
*/ */
#ifndef SDL_version_h_ #ifndef SDL_version_h_
@@ -40,9 +40,10 @@ extern "C" {
* Information about the version of SDL in use. * Information about the version of SDL in use.
* *
* Represents the library's version as three levels: major revision * Represents the library's version as three levels: major revision
* (increments with massive changes, additions, and enhancements), minor * (increments with massive changes, additions, and enhancements),
* revision (increments with backwards-compatible changes to the major * minor revision (increments with backwards-compatible changes to the
* revision), and patchlevel (increments with fixes to the minor revision). * major revision), and patchlevel (increments with fixes to the minor
* revision).
* *
* \sa SDL_VERSION * \sa SDL_VERSION
* \sa SDL_GetVersion * \sa SDL_GetVersion
@@ -57,17 +58,18 @@ typedef struct SDL_version
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/ */
#define SDL_MAJOR_VERSION 2 #define SDL_MAJOR_VERSION 2
#define SDL_MINOR_VERSION 32 #define SDL_MINOR_VERSION 28
#define SDL_PATCHLEVEL 10 #define SDL_PATCHLEVEL 5
/** /**
* Macro to determine SDL version program was compiled against. * Macro to determine SDL version program was compiled against.
* *
* This macro fills in a SDL_version structure with the version of the library * This macro fills in a SDL_version structure with the version of the
* you compiled against. This is determined by what header the compiler uses. * library you compiled against. This is determined by what header the
* Note that if you dynamically linked the library, you might have a slightly * compiler uses. Note that if you dynamically linked the library, you might
* newer or older version at runtime. That version can be determined with * have a slightly newer or older version at runtime. That version can be
* SDL_GetVersion(), which, unlike SDL_VERSION(), is not a macro. * determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
* is not a macro.
* *
* \param x A pointer to a SDL_version struct to initialize. * \param x A pointer to a SDL_version struct to initialize.
* *
@@ -83,40 +85,37 @@ typedef struct SDL_version
/* TODO: Remove this whole block in SDL 3 */ /* TODO: Remove this whole block in SDL 3 */
#if SDL_MAJOR_VERSION < 3 #if SDL_MAJOR_VERSION < 3
/** /**
* This macro turns the version numbers into a numeric value: * This macro turns the version numbers into a numeric value:
* \verbatim
(1,2,3) -> (1203)
\endverbatim
* *
* ``` * This assumes that there will never be more than 100 patchlevels.
* (1,2,3) -> (1203)
* ```
* *
* This assumes that there will never be more than 100 patchlevels. * In versions higher than 2.9.0, the minor version overflows into
* * the thousands digit: for example, 2.23.0 is encoded as 4300,
* In versions higher than 2.9.0, the minor version overflows into the * and 2.255.99 would be encoded as 25799.
* thousands digit: for example, 2.23.0 is encoded as 4300, and 2.255.99 would * This macro will not be available in SDL 3.x.
* be encoded as 25799.
*
* This macro will not be available in SDL 3.x.
*/ */
#define SDL_VERSIONNUM(X, Y, Z) \ #define SDL_VERSIONNUM(X, Y, Z) \
((X)*1000 + (Y)*100 + (Z)) ((X)*1000 + (Y)*100 + (Z))
/** /**
* This is the version number macro for the current SDL version. * This is the version number macro for the current SDL version.
* *
* In versions higher than 2.9.0, the minor version overflows into the * In versions higher than 2.9.0, the minor version overflows into
* thousands digit: for example, 2.23.0 is encoded as 4300. This macro will * the thousands digit: for example, 2.23.0 is encoded as 4300.
* not be available in SDL 3.x. * This macro will not be available in SDL 3.x.
* *
* Deprecated, use SDL_VERSION_ATLEAST or SDL_VERSION instead. * Deprecated, use SDL_VERSION_ATLEAST or SDL_VERSION instead.
*/ */
#define SDL_COMPILEDVERSION \ #define SDL_COMPILEDVERSION \
SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
#endif /* SDL_MAJOR_VERSION < 3 */ #endif /* SDL_MAJOR_VERSION < 3 */
/** /**
* This macro will evaluate to true if compiled with SDL at least X.Y.Z. * This macro will evaluate to true if compiled with SDL at least X.Y.Z.
*/ */
#define SDL_VERSION_ATLEAST(X, Y, Z) \ #define SDL_VERSION_ATLEAST(X, Y, Z) \
((SDL_MAJOR_VERSION >= X) && \ ((SDL_MAJOR_VERSION >= X) && \
@@ -133,7 +132,7 @@ typedef struct SDL_version
* *
* This function may be called safely at any time, even before SDL_Init(). * This function may be called safely at any time, even before SDL_Init().
* *
* \param ver the SDL_version structure that contains the version information. * \param ver the SDL_version structure that contains the version information
* *
* \since This function is available since SDL 2.0.0. * \since This function is available since SDL 2.0.0.
* *
File diff suppressed because it is too large. Load diff
@@ -20,9 +20,9 @@
*/ */
/** /**
* # CategoryVulkan * \file SDL_vulkan.h
* *
* Header file for functions to creating Vulkan surfaces on SDL windows. * Header file for functions to creating Vulkan surfaces on SDL windows.
*/ */
#ifndef SDL_vulkan_h_ #ifndef SDL_vulkan_h_
@@ -52,10 +52,6 @@ extern "C" {
VK_DEFINE_HANDLE(VkInstance) VK_DEFINE_HANDLE(VkInstance)
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
/* Make sure to undef to avoid issues in case of later vulkan include */
#undef VK_DEFINE_HANDLE
#undef VK_DEFINE_NON_DISPATCHABLE_HANDLE
#endif /* !NO_SDL_VULKAN_TYPEDEFS */ #endif /* !NO_SDL_VULKAN_TYPEDEFS */
typedef VkInstance SDL_vulkanInstance; typedef VkInstance SDL_vulkanInstance;
@@ -101,13 +97,13 @@ typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */
* supported. Either do not link to the Vulkan loader or link to a dynamic * supported. Either do not link to the Vulkan loader or link to a dynamic
* library version. * library version.
* *
* \param path The platform dependent Vulkan loader library name or NULL. * \param path The platform dependent Vulkan loader library name or NULL
* \returns 0 on success or -1 if the library couldn't be loaded; call * \returns 0 on success or -1 if the library couldn't be loaded; call
* SDL_GetError() for more information. * SDL_GetError() for more information.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
* *
* \sa SDL_Vulkan_GetVkGetInstanceProcAddr * \sa SDL_Vulkan_GetVkInstanceProcAddr
* \sa SDL_Vulkan_UnloadLibrary * \sa SDL_Vulkan_UnloadLibrary
*/ */
extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path); extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path);
@@ -150,11 +146,11 @@ extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void);
* however, this parameter will likely be removed in future releases * however, this parameter will likely be removed in future releases
* *
* \param window A window for which the required Vulkan instance extensions * \param window A window for which the required Vulkan instance extensions
* should be retrieved (will be deprecated in a future release). * should be retrieved (will be deprecated in a future release)
* \param pCount A pointer to an unsigned int corresponding to the number of * \param pCount A pointer to an unsigned int corresponding to the number of
* extensions to be returned. * extensions to be returned
* \param pNames NULL or a pointer to an array to be filled with required * \param pNames NULL or a pointer to an array to be filled with required
* Vulkan instance extensions. * Vulkan instance extensions
* \returns SDL_TRUE on success, SDL_FALSE on error. * \returns SDL_TRUE on success, SDL_FALSE on error.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
@@ -172,10 +168,10 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions(SDL_Window *wi
* `instance` must have been created with extensions returned by * `instance` must have been created with extensions returned by
* SDL_Vulkan_GetInstanceExtensions() enabled. * SDL_Vulkan_GetInstanceExtensions() enabled.
* *
* \param window The window to which to attach the Vulkan surface. * \param window The window to which to attach the Vulkan surface
* \param instance The Vulkan instance handle. * \param instance The Vulkan instance handle
* \param surface A pointer to a VkSurfaceKHR handle to output the newly * \param surface A pointer to a VkSurfaceKHR handle to output the newly
* created surface. * created surface
* \returns SDL_TRUE on success, SDL_FALSE on error. * \returns SDL_TRUE on success, SDL_FALSE on error.
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
@@ -195,9 +191,9 @@ extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window,
* platform with high-DPI support (Apple calls this "Retina"), and not * platform with high-DPI support (Apple calls this "Retina"), and not
* disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint. * disabled by the `SDL_HINT_VIDEO_HIGHDPI_DISABLED` hint.
* *
* \param window an SDL_Window for which the size is to be queried. * \param window an SDL_Window for which the size is to be queried
* \param w Pointer to the variable to write the width to or NULL. * \param w Pointer to the variable to write the width to or NULL
* \param h Pointer to the variable to write the height to or NULL. * \param h Pointer to the variable to write the height to or NULL
* *
* \since This function is available since SDL 2.0.6. * \since This function is available since SDL 2.0.6.
* *
Loaded 100 of 578 files, more files were not shown because too many files have changed in this diff. Show more