Compare commits

..
159 Commits
Author SHA1 Message Date
Alug 3b07022379 remove spritecliphack shader and readd fickle fix
the shader aint working out that well so just do this for now
2024-06-22 20:43:27 +02:00
Alug a4fce0b3b1 add shader for shadows to also fix sprite shadows in pal render 2024-06-03 16:19:41 +02:00
Alug 79ad1f8d51 readd sprite shadows and give dropshadows their own cvar 2024-06-03 15:46:30 +02:00
Alug 73aef11554 make shadow hack less noticable lul 2024-06-03 15:24:59 +02:00
Alug 318916abc9 Merge branch 'Saturn-Next' into nomobjshadows 2024-06-03 15:24:54 +02:00
Alug 1ab7a2acf4 add toggle for beta intermission screen + smol cleanup 2024-06-03 15:13:46 +02:00
Alug f977af6a80 fix le dispoffset 2024-06-03 15:13:39 +02:00
indev cae40928ad Use Z_Calloc to allocate wadfile_t to avoid having uninitialized fields 2024-06-03 00:18:11 +03:00
Alug ee2ec01eb9 use shader to prevent sprite floor clipping
from durr lul
2024-06-02 22:16:09 +02:00
Alug 164a9d604a conflict moment 2024-06-02 22:15:58 +02:00
Alug 7696b115ae add maxinterpdist to shadows 2024-06-02 22:15:28 +02:00
Alug b8ecaf336c fix ogl shadows for the 500th time 2024-06-02 22:15:25 +02:00
Alug 1ea8ebf84c o 2024-06-02 22:15:23 +02:00
Alug 9f70fe5373 fix ogl whiteshadows 2024-06-02 22:15:20 +02:00
Alug 9695ede7c2 reenable shadow skewing in software 2024-06-02 22:15:17 +02:00
Alug a5cd72d5db smth smth shader 2024-06-02 22:15:14 +02:00
Alug f87e282981 readd shadowscale since some things need manual scale 2024-06-02 22:15:11 +02:00
Alug 4b15972543 make software shadows more opague 2024-06-02 22:15:09 +02:00
Alug d5753bb15a smol fix and dont colormap software shadows either 2024-06-02 22:15:06 +02:00
Alug a92e5b3f7b dont colourmap shadows
todo software renderer ugh
2024-06-02 22:14:56 +02:00
Alug 72d2357560 use shader to prevent sprite floor clipping
from durr lul
2024-06-02 22:14:53 +02:00
Alug d306b560b1 dont rotate shadows with sprite rotation off
theres prob a better way to get an interpolated floorz but this works
also adds a small offset to not let stuff clip into the ground
2024-06-02 22:14:42 +02:00
Alug 4d331d9c9f change shadowscale a little 2024-06-02 22:13:47 +02:00
indev 932f6d83f7 Allow all mobjs to have shadow 2024-06-02 22:13:45 +02:00
Alug d57783aa3a port neat render based shadows
what an absolute arsepain
shearing in software is disabled cause it is inverted for whatever reason
also if someone ever wants to reeimplement lua spawnshadows idk go ahead kek
2024-06-02 22:13:41 +02:00
Alug 1d79854d3b Merge branch 'Saturn-Next' into nomobjshadows 2024-06-02 22:13:30 +02:00
Alug bf75644144 make r_fps if else hell a bit more bearable to look at
lol lmao
2024-06-02 22:12:39 +02:00
Alug 38633a8516 stuffs 2024-06-01 17:03:39 +02:00
Alug 957159d485 forgor to remove that 2024-06-01 16:31:55 +02:00
Alug 8052eb1c3a fix papersprites in software (hopefully)
lul
2024-06-01 16:30:03 +02:00
Alug 37a394ebaa flexible array stuff for columnofs
hopefully this fixes some crashes or smth
2024-06-01 16:29:55 +02:00
Alug b01a2836ea cleanup some super old stuff that did nothing
lul
2024-06-01 16:29:40 +02:00
Alug dc03359f3a theres no value 3 oops
i shouldnt do stuff after waking up at 4 in the morning lol
2024-05-30 19:59:14 +02:00
indev 6269c7c827 Use tmp variable for searchWad since envstr doesn't get changed 2024-05-30 19:32:18 +03:00
indev 040ddb1f40 Revert "Revert "Don't traverse the entire HOME directory to find wads""
This reverts commit 443905ffb3.
2024-05-30 19:23:14 +03:00
Alug faa5dbd0e7 split sprite draw loops
so crap doesent constantly check for papersprites on all sprites
2024-05-28 23:53:28 +02:00
Alug 37d3e2ae1a scale sprite draw distance with mapobjscale 2024-05-28 23:52:13 +02:00
Alug 455bbe47c2 smth smth encore magic numbers idk 2024-05-28 22:55:43 +02:00
Alug 4847e4e3cb that should be there lul 2024-05-28 22:55:40 +02:00
Alug 67aa71170f when not using screentextures draw kart bg on intermission screen 2024-05-28 00:52:52 +02:00
Alug ddddc7a898 draw a black screen instead of "nothing" during wipes on disabled screentextures
should resolve the intense flashing that can occur
2024-05-28 00:52:48 +02:00
indev 7c17f3a93c Merge pull request #130 from GenericHeroGuy/lua-hudinterpolate-redux
Lua HUD interpolation
2024-05-25 19:09:02 +03:00
GenericHeroGuy 05a5651260 Finishing touches
Some cleanup, also interpolate drawfill size
(dunno why it wasn't before)
2024-05-25 17:05:08 +02:00
Alug 8774b14fdf move some cvars to be registerrerd latur in ogl 2024-05-25 14:52:58 +02:00
Alug 518ac3ca28 Turn of FBO downsampling when you turn off screen textures
fbo downsampling needs those and if theyre disabled youre essentially seeing nothing at all lol
2024-05-25 14:44:03 +02:00
Alug 157c95a785 super smol optimization to R_DrawRepeatMaskedColumn
only maths once not twice lul
2024-05-25 14:44:00 +02:00
GenericHeroGuy 142c01f516 Update docs for interpLatch 2024-05-25 14:09:20 +02:00
GenericHeroGuy a17a5387ff Rename interpString to interpLatch 2024-05-25 14:08:52 +02:00
Alug d794de3e83 Cull BSP behind a raised floor or lowered ceiling that covers the entire screen
https://git.do.srb2.org/KartKrew/RingRacers/-/commit/7b8a564f69688515319ccd425f2b88ffe8b7b120
2024-05-25 02:21:04 +02:00
Alug 837746c0a9 declare outside of lööp also add const in r_ 2024-05-25 02:14:20 +02:00
Alug 9f692c1f6a change names to be less basic 2024-05-23 23:28:54 +02:00
Alug 8de340edbe allow gamepad dpad to hold scroll shit in menu aaa
absolute arsepain cant wait to see this breaking kek
2024-05-23 23:28:47 +02:00
GenericHeroGuy 9cd1233c32 Dust this crap off a bit 2024-05-23 16:47:29 +02:00
GenericHeroGuy 3f6575e41f Merge branch 'Saturn-Next' into lua-hudinterpolate-redux 2024-05-23 15:44:46 +02:00
Alug f939b02fd3 Merge branch 'Saturn' into Saturn-Next 2024-05-21 21:01:11 +02:00
Alug 73d0154b6c encore flipcam support 2024-05-21 21:00:33 +02:00
Alug cda7475058 unhack the animated votescreen a little
also make it pause when the game is paused like it was intended originally
2024-05-20 18:42:03 +02:00
Alug 33a31d0ad8 this should be here aswell i suppose 2024-05-20 13:31:13 +02:00
Alug 8dafc2d3d9 Merge pull request #129 from Indev450/Saturn-Next
Saturn v6.2
2024-05-20 13:21:16 +02:00
Alug 5f36557a18 change version string stuff per define lul 2024-05-19 21:31:05 +02:00
Alug 9b4e64011b make this a scroll menu
tbh not gonna bother with moving stuff depending on renderer
2024-05-19 18:43:12 +02:00
Alug 3ca313c14d Merge pull request #125 from Indev450/fborender
Use FBO to allow downsampling in Opengl
2024-05-19 18:20:01 +02:00
Alug 6fcea2f98e RefreshOGLSDLSurface
to make it a little more clearer this is ogl only
2024-05-18 23:52:05 +02:00
Alug c605906408 some stuffs 2024-05-18 23:49:36 +02:00
Alug de6511abe0 dont compile with that with NOHW 2024-05-18 23:40:28 +02:00
Alug c966b5defb forgor 2024-05-18 23:38:04 +02:00
Alug 3c8c273e51 add ogl version check + grey out in menu + turn it off when not avilible 2024-05-18 23:34:27 +02:00
Alug eaeb2575f7 add stuff to experimental menu 2024-05-18 23:22:30 +02:00
Alug 978cc57889 Add NOSCREENFBO compiler flag to be able to build without fbo support 2024-05-18 22:57:25 +02:00
Alug 6db73bfd63 Merge branch 'Saturn-Next' into fborender 2024-05-18 22:33:41 +02:00
Alug af5c3e4201 revert this thing 2024-05-15 17:56:58 +02:00
Alug 39e6668e20 change version 2024-05-15 17:51:11 +02:00
Alug 1ab63613a9 forgor this crap 2024-05-15 16:54:27 +02:00
Alug 57e72db1f8 support gcc14 ig 2024-05-15 16:46:59 +02:00
Alug d1d00d7ec6 shut up compiler 2024-05-05 22:00:22 +02:00
Alug 169e7cd462 Render precip through blockmap instead of during BSP
from RR
2024-05-05 21:54:00 +02:00
Alug e19f6f6656 fix some interpolation issues
minus P_spec change since that aint netsafe
2024-05-05 20:52:06 +02:00
Alug 13249f7ad4 fix potential crash in ogl vissprite sorting 2024-05-05 20:50:36 +02:00
Alug 22166ceccb fix precip overflow 2024-05-05 20:50:32 +02:00
Alug 75ed11a8b6 simplify SOFTLIGHT alot
also should make sure it gets applied everywhere lul
2024-04-29 10:12:58 +02:00
Alug 641cd6b8db use bigfloat for driftgauge offset too 2024-04-27 20:32:52 +02:00
Alug 62fa60e399 fix rare precip crash 2024-04-27 20:03:38 +02:00
Alug 17a6c4191d Merge pull request #128 from Indev450/it-cv-bigfloat
Add IT_CV_BIGFLOAT to use bigger increment for some CV_FLOAT cvars (a…
2024-04-27 20:01:57 +02:00
Alug 3acdcb09f1 inline those 2024-04-24 11:02:25 +02:00
GenericHeroGuy 1abf6a4ce1 Add interpolation docs to LUASTUFF 2024-04-23 21:24:47 +02:00
Alug 836890968c Revert "Merge pull request #121 from Indev450/texload"
This reverts commit b6a5c5b720, reversing
changes made to bcf2b3bab2.
2024-04-23 09:06:51 +02:00
Alug 7110de4b5b Merge branch 'Saturn' into Saturn-Next 2024-04-22 05:25:52 +02:00
Alug b4dfebac58 fix some visual issues with fofs 2024-04-22 05:25:46 +02:00
Alug 38d5ee5ae7 a 2024-04-20 22:54:03 +02:00
Alug d0c50006bc some stuff from ceepeepeecheck 2024-04-20 22:54:00 +02:00
Alug 443905ffb3 Revert "Don't traverse the entire HOME directory to find wads"
This reverts commit 1f019ed277.
2024-04-20 11:42:21 +02:00
indev 2147951a16 Add IT_CV_BIGFLOAT to use bigger increment for some CV_FLOAT cvars (added only to fov atm) 2024-04-20 11:41:17 +03:00
indev ea0cc41d04 For MIN/MAX value of cvar, convert it to float before saving for CV_FLOAT variables 2024-04-20 10:30:34 +03:00
Alug b6a5c5b720 Merge pull request #121 from Indev450/texload
Do not reload every texture when adding a wad
2024-04-20 01:33:50 +02:00
Alug bcf2b3bab2 disable palette rendering if screentextures aint enabled 2024-04-19 06:23:12 +02:00
Alug a238b19c75 z 2024-04-19 06:22:48 +02:00
Alug 9317ccd0be more things
-Fix a division by zero in BCZ2 Metal Sonic's routine
-Fix a bug where adding the same mod multiple times counted towards the mod limit
and other thigns
2024-04-19 06:22:44 +02:00
Alug 463dccab8b some smol fixes 2024-04-19 06:22:22 +02:00
Alug 2ccf91fbfc Make FixedRem less laggy by just using the modulo operator. 2024-04-19 06:22:20 +02:00
indev 36e06e5d6b Fix possible buffer overflow in 'va' function 2024-04-13 21:55:22 +03:00
Alug 6f293945fd add qs22j to cmakelist 2024-04-13 18:40:14 +02:00
Alug 45d73a2ad6 add qs22j to cmakelist 2024-04-13 18:40:00 +02:00
GenericHeroGuy 995777c676 Exclude string mode flags from olditem search 2024-04-12 22:36:23 +02:00
Alug dacfe376e1 smth smth paranthesis 2024-04-12 21:55:53 +02:00
GenericHeroGuy 60e42472e3 Do string coordinate calcs on all functions (and fix) 2024-04-12 21:00:54 +02:00
Alug c92ef4d757 fix software crash
Zzz...
2024-04-12 20:41:25 +02:00
indev 7cd6a031cd Fix compilation warning regarding calloc and sizeof 2024-04-11 19:12:14 +03:00
indev af265d017d Fix potential negative array index in V_ThinStringWidth 2024-04-11 18:55:55 +03:00
Alug 9e104a8632 ok dont use this at all then 2024-04-10 18:18:47 +02:00
Alug 4a1523da57 Zzz... 2024-04-10 18:15:29 +02:00
Alug 6a3987c8f7 fix ifdefs 2024-04-10 17:57:55 +02:00
Alug 1df6c4d4da move this to first init too 2024-04-10 17:47:37 +02:00
Alug 3cab29085a Merge branch 'Saturn-Next' into fborender 2024-04-10 17:46:40 +02:00
Alug 1391e556d6 that wasnt the onchange im sleepy 2024-04-10 17:40:43 +02:00
Alug 94340e6634 forgor to remove those Zzz... 2024-04-10 17:32:13 +02:00
Alug 64f10c36fa should throw that into onchange oops 2024-04-10 17:29:16 +02:00
Alug 955f73d9e8 throw stuff into own function, also check on game start 2024-04-10 17:24:46 +02:00
Alug 40c356395a simplify this crap 2024-04-10 07:02:18 +02:00
indev bce914df6e Don't call menu drawer in wipes on dedicated servers 2024-04-06 01:47:27 +03:00
indev aac74cf93a Don't call menu drawer in wipes on dedicated servers 2024-04-06 01:31:43 +03:00
indev e0d0120337 Merge branch 'Saturn-Next' into Saturn 2024-04-05 20:56:49 +03:00
Alug 87cf75ef84 this can be completely removed actually 2024-04-05 16:31:17 +02:00
Alug 5f237d9e13 (maybe?) fix a checkheap crash 2024-04-05 16:24:27 +02:00
Alug 23050394ac retain old behaviour for raising gamma
or if you dont use any colour correction stuff
basically checks if anything has changed and if the gamma is below 0
otherwise it will apply colour cubus
2024-04-05 01:10:49 +02:00
Alug dbc47e8656 Revert "disable colourcube cause of visual discrepentcies (temporary)"
This reverts commit ed418d5dcf.
2024-04-05 00:27:14 +02:00
GenericHeroGuy 18e0485f39 Make this less insufferable
* Zero is now a valid tag for v.interpolate
* Reset lerp coordinates when v.interpString is called again
* Leaving string mode enabled on exit no longer breaks other scripts
* Fix fadeScreen having an uninitialized ID
2024-04-04 23:39:23 +02:00
Alug d675795014 version change again or else i forger 2024-04-04 20:52:13 +02:00
Alug ed418d5dcf disable colourcube cause of visual discrepentcies (temporary) 2024-04-04 18:59:45 +02:00
Alug d6fb76b833 fix tint equation
idk what happen there but it looked pretty diff on a few maps
2024-04-04 17:38:15 +02:00
Alug ced45061f8 clean this up a bit 2024-04-04 03:53:11 +02:00
Alug 52c6a52a2f fix some smol leaks 2024-04-04 03:53:00 +02:00
GenericHeroGuy aeb5ae994e Subpixel interpolation for strings and drawfill 2024-04-04 00:27:47 +02:00
Alug b2c34906ff try and fix some compile issues 2024-04-03 19:24:51 +02:00
Alug c8f6878c26 try and fix some compile issues 2024-04-03 19:24:44 +02:00
Alug 6d8c375cf5 Fix 3D model crash 2024-04-03 00:28:56 +02:00
Alug c093aa3c73 k then 2024-04-02 22:17:40 +02:00
Alug fc27ed0443 Add option for wipes only in screentex toggle
since the toggle was changed to actually disable ALL screentex functions
2024-04-02 22:14:10 +02:00
GenericHeroGuy b2f9a29eb0 Lua HUD interpolation 2024-04-02 21:00:23 +02:00
Alug bd2fe5b9be use SDL_PeepEvents again
grrrrrrr
2024-04-02 19:19:56 +02:00
Alug 07e50c40a3 forgor those lul 2024-04-02 19:10:51 +02:00
Alug 94248eaea2 use functions for keyshift crap
lmao why tf wasnt this done anyways but copy and pasted 500 times
2024-04-02 16:38:07 +02:00
Alug ebc467f212 more fixup for native layout 2024-04-02 16:14:22 +02:00
Alug 29acff6722 make this less fragile 2024-04-02 15:19:25 +02:00
Alug be71dd66ac Merge branch 'Saturn' into Saturn-Next 2024-04-02 03:48:17 +02:00
Alug 8a1ad4a2de limit to ASCII
also forgor to add stuff to h
2024-04-02 03:48:03 +02:00
Alug 3370d1631e FIXUP native keyboard layout
cleanup GetTypedChar
fix issues with capslock and shift
2024-04-02 03:36:22 +02:00
GenericHeroGuy 5f69bfcf22 Split game drawlist per displayplayer 2024-04-02 03:22:24 +02:00
Alug 21cb42309e Downgrade SDL2 to v2.28.5
v2.3.0 broke some things in 32bit builds Zzz...
2024-04-02 00:22:33 +02:00
GenericHeroGuy 9442a463d4 Shrink drawlists, take 2
Approximately 2/3rds smaller
2024-04-01 23:24:09 +02:00
Alug d7a1cc6702 Read only header bytes when creating textures list 2024-03-27 21:31:56 +01:00
Alug a779191feb beter 2024-03-27 18:45:59 +01:00
Alug 23cc0dfc3a add some comments cause i WILL forger what this crap even does 2024-03-27 18:44:32 +01:00
Alug c7a258f32f clean up 2024-03-27 18:34:58 +01:00
Alug a28f025d40 Stuff from displaycrap branch to detect downsampling automatically 2024-03-27 18:33:29 +01:00
Alug 91a3b288ef conflict moment 2024-03-27 18:08:09 +01:00
Alug 200d971d35 Toggle to render to screenFBO
fixes downsampling from higher resolutions
TODO: make this activate automatically if game detects it runs at higher res than desktop res
2024-03-27 18:05:48 +01:00
indev 54ee3f2961 R_LoadTexturesPwad: don't do anything wad has no textures 2024-03-26 20:40:11 +03:00
Alug c3a71b60b0 Do not reload every texture when adding a wad
https://git.do.srb2.org/STJr/SRB2/-/merge_requests/1725?commit_id=37add34b9c729b21e624e22d64159073c9258e25
2024-03-26 14:12:05 +01:00
Alug 205bfc0262 Split R_LoadTextures 2024-03-26 14:11:49 +01:00
376 changed files with 62562 additions and 10309 deletions

No files matched your search

+64
View File
@@ -52,6 +52,70 @@ Returns the displayplayer's HUD color.
Returns true if colorization is enabled, false otherwise. Returns true if colorization is enabled, false otherwise.
## v.interpolate(true)
Enables HUD interpolation. Each call to a drawing function will have its coordinates interpolated
by assigning an unique ID to every call.
For example, three successive calls to `v.draw` will each have their own ID and interpolation offsets.
Pass `true` to enable interpolation, `false` to disable.
Alternatively, pass a number to enable interpolation with the specified tag.
Tags allow HUD items drawn by the same call to a drawing function to be differentiated.
Valid tags range from 0-255.
For example, when iterating players, use a unique tag for each player to avoid artifacting:
```lua
for p in players.iterate do
-- enable interpolation, using player numbers as the tag
-- every draw will have different interp offsets per player
v.interpolate(#p)
-- doesn't matter for unconditional draws like this one...
v.draw(...)
-- but it does matter if there's a condition!
-- without tags, this patch would warp between players
-- whenever their `someVar` changes
if p.someVar then v.draw(...) end
end
-- don't want interpolation anymore? then disable it
v.interpolate(false)
```
NOTE: The default tag for `true` is 0.
## v.interpLatch(true)
Enables interpolation offset latching. The next call to a drawing function will have its lerp offsets
saved and reused for all following draw calls. Disable with `false` when done.
Interpolation cannot easily "snap" between two points; latching can help overcome this by manually
setting the lerp offsets.
```lua
v.interpolate(true)
-- X coordinate for the HUD item
-- every so often, this will wrap around to zero
local x = (leveltime*4) % 256
-- draw an interpolated patch, but... when X rolls back to zero,
-- the patch will slide all the way across the screen!
v.draw(x, 100, ...)
-- this is where interpLatch comes into play
-- enable latching, then draw an invisible patch,
-- moving at the same speed as the visible patch
-- the exact coordinates don't matter, it just has to move at the right speed
v.interpLatch(true)
v.draw(leveltime*4, 0, v.cachePatch("K_TRNULL"))
-- now we can draw the patch again, and when X becomes zero,
-- it'll snap right back without sliding across the screen
v.draw(x, 150, ...)
-- don't forget to turn off latching!
v.interpLatch(false)
```
When using a custom string drawer, enable this mode to avoid interpolation artifacting when the string changes.
## 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
+16 -16
View File
@@ -1,16 +1,16 @@
Bugs are now managed in the SDL issue tracker, here: Bugs are now managed in the SDL issue tracker, here:
https://github.com/libsdl-org/SDL/issues https://github.com/libsdl-org/SDL/issues
You may report bugs there, and search to see if a given issue has already You may report bugs there, and search to see if a given issue has already
been reported, discussed, and maybe even fixed. been reported, discussed, and maybe even fixed.
You may also find help at the SDL forums/mailing list: You may also find help at the SDL forums/mailing list:
https://discourse.libsdl.org/ https://discourse.libsdl.org/
Bug reports are welcome here, but we really appreciate if you use the issue Bug reports are welcome here, but we really appreciate if you use the issue
tracker, as bugs discussed on the mailing list may be forgotten or missed. tracker, as bugs discussed on the mailing list may be forgotten or missed.
+20 -20
View File
@@ -1,20 +1,20 @@
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org> Copyright (C) 1997-2020 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
arising from the use of this software. arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not 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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be 2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software. misrepresented as being the original software.
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.
+53 -53
View File
@@ -1,53 +1,53 @@
Simple DirectMedia Layer CREDITS Simple DirectMedia Layer CREDITS
Thanks to everyone who made this possible, including: Thanks to everyone who made this possible, including:
* Cliff Matthews, for giving me a reason to start this project. :) * Cliff Matthews, for giving me a reason to start this project. :)
-- Executor rocks! *grin* -- Executor rocks! *grin*
* Ryan Gordon for helping everybody out and keeping the dream alive. :) * Ryan Gordon for helping everybody out and keeping the dream alive. :)
* Gabriel Jacobo for his work on the Android port and generally helping out all around. * Gabriel Jacobo for his work on the Android port and generally helping out all around.
* Philipp Wiesemann for his attention to detail reviewing the entire SDL code base and proposes patches. * Philipp Wiesemann for his attention to detail reviewing the entire SDL code base and proposes patches.
* Andreas Schiffler for his dedication to unit tests, Visual Studio projects, and managing the Google Summer of Code. * Andreas Schiffler for his dedication to unit tests, Visual Studio projects, and managing the Google Summer of Code.
* Mike Sartain for incorporating SDL into Team Fortress 2 and cheering me on at Valve. * Mike Sartain for incorporating SDL into Team Fortress 2 and cheering me on at Valve.
* Alfred Reynolds for the game controller API and general (in)sanity * Alfred Reynolds for the game controller API and general (in)sanity
* Jørgen Tjernø for numerous magical Mac OS X fixes. * Jørgen Tjernø for numerous magical Mac OS X fixes.
* Pierre-Loup Griffais for his deep knowledge of OpenGL drivers. * Pierre-Loup Griffais for his deep knowledge of OpenGL drivers.
* Julian Winter for the SDL 2.0 website. * Julian Winter for the SDL 2.0 website.
* Sheena Smith for many months of great work on the SDL wiki creating the API documentation and style guides. * Sheena Smith for many months of great work on the SDL wiki creating the API documentation and style guides.
* Paul Hunkin for his port of SDL to Android during the Google Summer of Code 2010. * Paul Hunkin for his port of SDL to Android during the Google Summer of Code 2010.
* Eli Gottlieb for his work on shaped windows during the Google Summer of Code 2010. * Eli Gottlieb for his work on shaped windows during the Google Summer of Code 2010.
* Jim Grandpre for his work on multi-touch and gesture recognition during * Jim Grandpre for his work on multi-touch and gesture recognition during
the Google Summer of Code 2010. the Google Summer of Code 2010.
* Edgar "bobbens" Simo for his force feedback API development during the * Edgar "bobbens" Simo for his force feedback API development during the
Google Summer of Code 2008. Google Summer of Code 2008.
* Aaron Wishnick for his work on audio resampling and pitch shifting during * Aaron Wishnick for his work on audio resampling and pitch shifting during
the Google Summer of Code 2008. the Google Summer of Code 2008.
* Holmes Futrell for his port of SDL to the iPhone and iPod Touch during the * Holmes Futrell for his port of SDL to the iPhone and iPod Touch during the
Google Summer of Code 2008. Google Summer of Code 2008.
* Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation. * Jon Atkins for SDL_image, SDL_mixer and SDL_net documentation.
* Everybody at Loki Software, Inc. for their great contributions! * Everybody at Loki Software, Inc. for their great contributions!
And a big hand to everyone else who has contributed over the years. And a big hand to everyone else who has contributed over the years.
THANKS! :) THANKS! :)
-- Sam Lantinga <slouken@libsdl.org> -- Sam Lantinga <slouken@libsdl.org>
+18 -18
View File
@@ -1,18 +1,18 @@
The 32-bit files are in i686-w64-mingw32 The 32-bit files are in i686-w64-mingw32
The 64-bit files are in x86_64-w64-mingw32 The 64-bit files are in x86_64-w64-mingw32
To install SDL for native development: To install SDL for native development:
make native make native
To install SDL for cross-compiling development: To install SDL for cross-compiling development:
make cross make cross
Look at the example programs in ./test, and check out online documentation: Look at the example programs in ./test, and check out online documentation:
http://wiki.libsdl.org/ http://wiki.libsdl.org/
Join the SDL developer mailing list if you want to join the community: Join the SDL developer mailing list if you want to join the community:
http://www.libsdl.org/mailing-list.php http://www.libsdl.org/mailing-list.php
That's it! That's it!
Sam Lantinga <slouken@libsdl.org> Sam Lantinga <slouken@libsdl.org>
+13 -13
View File
@@ -1,13 +1,13 @@
Please distribute this file with the SDL runtime environment: Please distribute this file with the SDL runtime environment:
The Simple DirectMedia Layer (SDL for short) is a cross-platform library The Simple DirectMedia Layer (SDL for short) is a cross-platform library
designed to make it easy to write multi-media software, such as games designed to make it easy to write multi-media software, such as games
and emulators. and emulators.
The Simple DirectMedia Layer library source code is available from: The Simple DirectMedia Layer library source code is available from:
https://www.libsdl.org/ https://www.libsdl.org/
This library is distributed under the terms of the zlib license: This library is distributed under the terms of the zlib license:
http://www.zlib.net/zlib_license.html http://www.zlib.net/zlib_license.html
+21 -21
View File
@@ -1,21 +1,21 @@
Simple DirectMedia Layer Simple DirectMedia Layer
(SDL) (SDL)
Version 2.0 Version 2.0
--- ---
https://www.libsdl.org/ https://www.libsdl.org/
Simple DirectMedia Layer is a cross-platform development library designed Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and Direct3D. It is used by video playback software, hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games. and many Humble Bundle games.
More extensive documentation is available in the docs directory, starting More extensive documentation is available in the docs directory, starting
with README.md with README.md
Enjoy! Enjoy!
Sam Lantinga (slouken@libsdl.org) Sam Lantinga (slouken@libsdl.org)
+15 -15
View File
@@ -1,15 +1,15 @@
# SDL Development Libaries # SDL Development Libaries
Download both the VC and MinGW packages and extract them here. Download both the VC and MinGW packages and extract them here.
https://www.libsdl.org/download-2.0.php https://www.libsdl.org/download-2.0.php
## VC Package ## VC Package
* include * include
* lib * lib
## MinGW Package ## MinGW Package
* i686-w64-mingw32 * i686-w64-mingw32
* x86_64-w64-mingw32 * x86_64-w64-mingw32
+870 -889
View File
File diff suppressed because it is too large. Load diff
+97 -97
View File
@@ -1,97 +1,97 @@
# Contributing to SDL # Contributing to SDL
We appreciate your interest in contributing to SDL, this document will describe how to report bugs, contribute code or ideas or edit documentation. We appreciate your interest in contributing to SDL, this document will describe how to report bugs, contribute code or ideas or edit documentation.
**Table Of Contents** **Table Of Contents**
- [Filing a GitHub issue](#filing-a-github-issue) - [Filing a GitHub issue](#filing-a-github-issue)
- [Reporting a bug](#reporting-a-bug) - [Reporting a bug](#reporting-a-bug)
- [Suggesting enhancements](#suggesting-enhancements) - [Suggesting enhancements](#suggesting-enhancements)
- [Contributing code](#contributing-code) - [Contributing code](#contributing-code)
- [Forking the project](#forking-the-project) - [Forking the project](#forking-the-project)
- [Following the style guide](#following-the-style-guide) - [Following the style guide](#following-the-style-guide)
- [Running the tests](#running-the-tests) - [Running the tests](#running-the-tests)
- [Opening a pull request](#opening-a-pull-request) - [Opening a pull request](#opening-a-pull-request)
- [Contributing to the documentation](#contributing-to-the-documentation) - [Contributing to the documentation](#contributing-to-the-documentation)
- [Editing a function documentation](#editing-a-function-documentation) - [Editing a function documentation](#editing-a-function-documentation)
- [Editing the wiki](#editing-the-wiki) - [Editing the wiki](#editing-the-wiki)
## Filing a GitHub issue ## Filing a GitHub issue
### Reporting a bug ### Reporting a bug
If you think you have found a bug and would like to report it, here are the steps you should take: If you think you have found a bug and would like to report it, here are the steps you should take:
- Before opening a new issue, ensure your bug has not already been reported on the [GitHub Issues page](https://github.com/libsdl-org/SDL/issues). - Before opening a new issue, ensure your bug has not already been reported on the [GitHub Issues page](https://github.com/libsdl-org/SDL/issues).
- On the issue tracker, click on [New Issue](https://github.com/libsdl-org/SDL/issues/new). - On the issue tracker, click on [New Issue](https://github.com/libsdl-org/SDL/issues/new).
- Include details about your environment, such as your Operating System and SDL version. - Include details about your environment, such as your Operating System and SDL version.
- If possible, provide a small example that reproduces your bug. - If possible, provide a small example that reproduces your bug.
### Suggesting enhancements ### Suggesting enhancements
If you want to suggest changes for the project, here are the steps you should take: If you want to suggest changes for the project, here are the steps you should take:
- Check if the suggestion has already been made on: - Check if the suggestion has already been made on:
- the [issue tracker](https://github.com/libsdl-org/SDL/issues); - the [issue tracker](https://github.com/libsdl-org/SDL/issues);
- the [discourse forum](https://discourse.libsdl.org/); - the [discourse forum](https://discourse.libsdl.org/);
- or if a [pull request](https://github.com/libsdl-org/SDL/pulls) already exists. - or if a [pull request](https://github.com/libsdl-org/SDL/pulls) already exists.
- On the issue tracker, click on [New Issue](https://github.com/libsdl-org/SDL/issues/new). - On the issue tracker, click on [New Issue](https://github.com/libsdl-org/SDL/issues/new).
- Describe what change you would like to happen. - Describe what change you would like to happen.
## Contributing code ## Contributing code
This section will cover how the process of forking the project, making a change and opening a pull request. This section will cover how the process of forking the project, making a change and opening a pull request.
### Forking the project ### Forking the project
The first step consists in making a fork of the project, this is only necessary for the first contribution. The first step consists in making a fork of the project, this is only necessary for the first contribution.
Head over to https://github.com/libsdl-org/SDL and click on the `Fork` button in the top right corner of your screen, you may leave the fields unchanged and click `Create Fork`. Head over to https://github.com/libsdl-org/SDL and click on the `Fork` button in the top right corner of your screen, you may leave the fields unchanged and click `Create Fork`.
You will be redirected to your fork of the repository, click the green `Code` button and copy the git clone link. You will be redirected to your fork of the repository, click the green `Code` button and copy the git clone link.
If you had already forked the repository, you may update it from the web page using the `Fetch upstream` button. If you had already forked the repository, you may update it from the web page using the `Fetch upstream` button.
### Following the style guide ### Following the style guide
Code formatting is done using a custom `.clang-format` file, you can learn more about how to run it [here](https://clang.llvm.org/docs/ClangFormat.html). Code formatting is done using a custom `.clang-format` file, you can learn more about how to run it [here](https://clang.llvm.org/docs/ClangFormat.html).
Some legacy code may not be formatted, as such avoid formatting the whole file at once and only format around your changes. Some legacy code may not be formatted, as such avoid formatting the whole file at once and only format around your changes.
For your commit message to be properly displayed on GitHub, it should contain: For your commit message to be properly displayed on GitHub, it should contain:
- A short description of the commit of 50 characters or less on the first line. - A short description of the commit of 50 characters or less on the first line.
- If necessary, add a blank line followed by a long description, each line should be 72 characters or less. - If necessary, add a blank line followed by a long description, each line should be 72 characters or less.
For example: For example:
``` ```
Fix crash in SDL_FooBar. Fix crash in SDL_FooBar.
This addresses the issue #123456 by making sure Foo was successful This addresses the issue #123456 by making sure Foo was successful
before calling Bar. before calling Bar.
``` ```
### Running the tests ### Running the tests
Tests allow you to verify if your changes did not break any behaviour, here are the steps to follow: Tests allow you to verify if your changes did not break any behaviour, here are the steps to follow:
- Before pushing, run the `testautomation` suite on your machine, there should be no more failing tests after your change than before. - Before pushing, run the `testautomation` suite on your machine, there should be no more failing tests after your change than before.
- After pushing to your fork, Continuous Integration (GitHub Actions) will ensure compilation and tests still pass on other systems. - After pushing to your fork, Continuous Integration (GitHub Actions) will ensure compilation and tests still pass on other systems.
### Opening a pull request ### Opening a pull request
- Head over to your fork's GitHub page. - Head over to your fork's GitHub page.
- Click on the `Contribute` button and `Open Pull Request`. - Click on the `Contribute` button and `Open Pull Request`.
- Fill out the pull request template. - Fill out the pull request template.
- If any changes are requested, you can add new commits to your fork and they will be automatically added to the pull request. - If any changes are requested, you can add new commits to your fork and they will be automatically added to the pull request.
## Contributing to the documentation ## Contributing to the documentation
### Editing a function documentation ### Editing a function documentation
The wiki documentation for API functions is synchronised from the headers' doxygen comments. As such, all modifications to syntax; function parameters; return value; version; related functions should be done in the header directly. The wiki documentation for API functions is synchronised from the headers' doxygen comments. As such, all modifications to syntax; function parameters; return value; version; related functions should be done in the header directly.
### Editing the wiki ### Editing the wiki
Other changes to the wiki should done directly from https://wiki.libsdl.org/ Other changes to the wiki should done directly from https://wiki.libsdl.org/
+483 -483
View File
@@ -1,483 +1,483 @@
Android Android
================================================================================ ================================================================================
Matt Styles wrote a tutorial on building SDL for Android with Visual Studio: Matt Styles wrote a tutorial on building SDL for Android with Visual Studio:
http://trederia.blogspot.de/2017/03/building-sdl2-for-android-with-visual.html http://trederia.blogspot.de/2017/03/building-sdl2-for-android-with-visual.html
The rest of this README covers the Android gradle style build process. The rest of this README covers the Android gradle style build process.
If you are using the older ant build process, it is no longer officially If you are using the older ant build process, it is no longer officially
supported, but you can use the "android-project-ant" directory as a template. supported, but you can use the "android-project-ant" directory as a template.
Requirements Requirements
================================================================================ ================================================================================
Android SDK (version 34 or later) Android SDK (version 34 or later)
https://developer.android.com/sdk/index.html https://developer.android.com/sdk/index.html
Android NDK r15c or later Android NDK r15c or later
https://developer.android.com/tools/sdk/ndk/index.html https://developer.android.com/tools/sdk/ndk/index.html
Minimum API level supported by SDL: 19 (Android 4.4) Minimum API level supported by SDL: 19 (Android 4.4)
How the port works How the port works
================================================================================ ================================================================================
- Android applications are Java-based, optionally with parts written in C - Android applications are Java-based, optionally with parts written in C
- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to - As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
the SDL library the SDL library
- This means that your application C code must be placed inside an Android - This means that your application C code must be placed inside an Android
Java project, along with some C support code that communicates with Java Java project, along with some C support code that communicates with Java
- This eventually produces a standard Android .apk package - This eventually produces a standard Android .apk package
The Android Java code implements an "Activity" and can be found in: The Android Java code implements an "Activity" and can be found in:
android-project/app/src/main/java/org/libsdl/app/SDLActivity.java android-project/app/src/main/java/org/libsdl/app/SDLActivity.java
The Java code loads your game code, the SDL shared library, and The Java code loads your game code, the SDL shared library, and
dispatches to native functions implemented in the SDL library: dispatches to native functions implemented in the SDL library:
src/core/android/SDL_android.c src/core/android/SDL_android.c
Building an app Building an app
================================================================================ ================================================================================
For simple projects you can use the script located at build-scripts/androidbuild.sh For simple projects you can use the script located at build-scripts/androidbuild.sh
There's two ways of using it: There's two ways of using it:
androidbuild.sh com.yourcompany.yourapp < sources.list androidbuild.sh com.yourcompany.yourapp < sources.list
androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c
sources.list should be a text file with a source file name in each line sources.list should be a text file with a source file name in each line
Filenames should be specified relative to the current directory, for example if Filenames should be specified relative to the current directory, for example if
you are in the build-scripts directory and want to create the testgles.c test, you'll you are in the build-scripts directory and want to create the testgles.c test, you'll
run: run:
./androidbuild.sh org.libsdl.testgles ../test/testgles.c ./androidbuild.sh org.libsdl.testgles ../test/testgles.c
One limitation of this script is that all sources provided will be aggregated into One limitation of this script is that all sources provided will be aggregated into
a single directory, thus all your source files should have a unique name. a single directory, thus all your source files should have a unique name.
Once the project is complete the script will tell you where the debug APK is located. Once the project is complete the script will tell you where the debug APK is located.
If you want to create a signed release APK, you can use the project created by this If you want to create a signed release APK, you can use the project created by this
utility to generate it. utility to generate it.
Finally, a word of caution: re running androidbuild.sh wipes any changes you may have Finally, a word of caution: re running androidbuild.sh wipes any changes you may have
done in the build directory for the app! done in the build directory for the app!
For more complex projects, follow these instructions: For more complex projects, follow these instructions:
1. Get the source code for SDL and copy the 'android-project' directory located at SDL/android-project to a suitable location. Also make sure to rename it to your project name (In these examples: YOURPROJECT). 1. Get the source code for SDL and copy the 'android-project' directory located at SDL/android-project to a suitable location. Also make sure to rename it to your project name (In these examples: YOURPROJECT).
(The 'android-project' directory can basically be seen as a sort of starting point for the android-port of your project. It contains the glue code between the Android Java 'frontend' and the SDL code 'backend'. It also contains some standard behaviour, like how events should be handled, which you will be able to change.) (The 'android-project' directory can basically be seen as a sort of starting point for the android-port of your project. It contains the glue code between the Android Java 'frontend' and the SDL code 'backend'. It also contains some standard behaviour, like how events should be handled, which you will be able to change.)
2. Move or [symlink](https://en.wikipedia.org/wiki/Symbolic_link) the SDL directory into the "YOURPROJECT/app/jni" directory 2. Move or [symlink](https://en.wikipedia.org/wiki/Symbolic_link) the SDL directory into the "YOURPROJECT/app/jni" directory
(This is needed as the source of SDL has to be compiled by the Android compiler) (This is needed as the source of SDL has to be compiled by the Android compiler)
3. Edit "YOURPROJECT/app/jni/src/Android.mk" to include your source files. 3. Edit "YOURPROJECT/app/jni/src/Android.mk" to include your source files.
(They should be separated by spaces after the "LOCAL_SRC_FILES := " declaration) (They should be separated by spaces after the "LOCAL_SRC_FILES := " declaration)
4a. If you want to use Android Studio, simply open your 'YOURPROJECT' directory and start building. 4a. If you want to use Android Studio, simply open your 'YOURPROJECT' directory and start building.
4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device 4b. If you want to build manually, run './gradlew installDebug' in the project directory. This compiles the .java, creates an .apk with the native code embedded, and installs it on any connected Android device
If you already have a project that uses CMake, the instructions change somewhat: If you already have a project that uses CMake, the instructions change somewhat:
1. Do points 1 and 2 from the instruction above. 1. Do points 1 and 2 from the instruction above.
2. Edit "YOURPROJECT/app/build.gradle" to comment out or remove sections containing ndk-build 2. Edit "YOURPROJECT/app/build.gradle" to comment out or remove sections containing ndk-build
and uncomment the cmake sections. Add arguments to the CMake invocation as needed. and uncomment the cmake sections. Add arguments to the CMake invocation as needed.
3. Edit "YOURPROJECT/app/jni/CMakeLists.txt" to include your project (it defaults to 3. Edit "YOURPROJECT/app/jni/CMakeLists.txt" to include your project (it defaults to
adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static adding the "src" subdirectory). Note that you'll have SDL2, SDL2main and SDL2-static
as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)" as targets in your project, so you should have "target_link_libraries(yourgame SDL2 SDL2main)"
in your CMakeLists.txt file. Also be aware that you should use add_library() instead of in your CMakeLists.txt file. Also be aware that you should use add_library() instead of
add_executable() for the target containing your "main" function. add_executable() for the target containing your "main" function.
If you wish to use Android Studio, you can skip the last step. If you wish to use Android Studio, you can skip the last step.
4. Run './gradlew installDebug' or './gradlew installRelease' in the project directory. It will build and install your .apk on any 4. Run './gradlew installDebug' or './gradlew installRelease' in the project directory. It will build and install your .apk on any
connected Android device connected Android device
Here's an explanation of the files in the Android project, so you can customize them: Here's an explanation of the files in the Android project, so you can customize them:
android-project/app android-project/app
build.gradle - build info including the application version and SDK build.gradle - build info including the application version and SDK
src/main/AndroidManifest.xml - package manifest. Among others, it contains the class name of the main Activity and the package name of the application. src/main/AndroidManifest.xml - package manifest. Among others, it contains the class name of the main Activity and the package name of the application.
jni/ - directory holding native code jni/ - directory holding native code
jni/Application.mk - Application JNI settings, including target platform and STL library jni/Application.mk - Application JNI settings, including target platform and STL library
jni/Android.mk - Android makefile that can call recursively the Android.mk files in all subdirectories jni/Android.mk - Android makefile that can call recursively the Android.mk files in all subdirectories
jni/CMakeLists.txt - Top-level CMake project that adds SDL as a subproject jni/CMakeLists.txt - Top-level CMake project that adds SDL as a subproject
jni/SDL/ - (symlink to) directory holding the SDL library files jni/SDL/ - (symlink to) directory holding the SDL library files
jni/SDL/Android.mk - Android makefile for creating the SDL shared library jni/SDL/Android.mk - Android makefile for creating the SDL shared library
jni/src/ - directory holding your C/C++ source jni/src/ - directory holding your C/C++ source
jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references jni/src/Android.mk - Android makefile that you should customize to include your source code and any library references
jni/src/CMakeLists.txt - CMake file that you may customize to include your source code and any library references jni/src/CMakeLists.txt - CMake file that you may customize to include your source code and any library references
src/main/assets/ - directory holding asset files for your application src/main/assets/ - directory holding asset files for your application
src/main/res/ - directory holding resources for your application src/main/res/ - directory holding resources for your application
src/main/res/mipmap-* - directories holding icons for different phone hardware src/main/res/mipmap-* - directories holding icons for different phone hardware
src/main/res/values/strings.xml - strings used in your application, including the application name src/main/res/values/strings.xml - strings used in your application, including the application name
src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application. src/main/java/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding to SDL. Be very careful changing this, as the SDL library relies on this implementation. You should instead subclass this for your application.
Customizing your application name Customizing your application name
================================================================================ ================================================================================
To customize your application name, edit AndroidManifest.xml and replace To customize your application name, edit AndroidManifest.xml and replace
"org.libsdl.app" with an identifier for your product package. "org.libsdl.app" with an identifier for your product package.
Then create a Java class extending SDLActivity and place it in a directory Then create a Java class extending SDLActivity and place it in a directory
under src matching your package, e.g. under src matching your package, e.g.
src/com/gamemaker/game/MyGame.java src/com/gamemaker/game/MyGame.java
Here's an example of a minimal class file: Here's an example of a minimal class file:
--- MyGame.java -------------------------- --- MyGame.java --------------------------
package com.gamemaker.game; package com.gamemaker.game;
import org.libsdl.app.SDLActivity; import org.libsdl.app.SDLActivity;
/** /**
* A sample wrapper class that just calls SDLActivity * A sample wrapper class that just calls SDLActivity
*/ */
public class MyGame extends SDLActivity { } public class MyGame extends SDLActivity { }
------------------------------------------ ------------------------------------------
Then replace "SDLActivity" in AndroidManifest.xml with the name of your Then replace "SDLActivity" in AndroidManifest.xml with the name of your
class, .e.g. "MyGame" class, .e.g. "MyGame"
Customizing your application icon Customizing your application icon
================================================================================ ================================================================================
Conceptually changing your icon is just replacing the "ic_launcher.png" files in Conceptually changing your icon is just replacing the "ic_launcher.png" files in
the drawable directories under the res directory. There are several directories the drawable directories under the res directory. There are several directories
for different screen sizes. for different screen sizes.
Loading assets Loading assets
================================================================================ ================================================================================
Any files you put in the "app/src/main/assets" directory of your project Any files you put in the "app/src/main/assets" directory of your project
directory will get bundled into the application package and you can load directory will get bundled into the application package and you can load
them using the standard functions in SDL_rwops.h. them using the standard functions in SDL_rwops.h.
There are also a few Android specific functions that allow you to get other There are also a few Android specific functions that allow you to get other
useful paths for saving and loading data: useful paths for saving and loading data:
* SDL_AndroidGetInternalStoragePath() * SDL_AndroidGetInternalStoragePath()
* SDL_AndroidGetExternalStorageState() * SDL_AndroidGetExternalStorageState()
* SDL_AndroidGetExternalStoragePath() * SDL_AndroidGetExternalStoragePath()
See SDL_system.h for more details on these functions. See SDL_system.h for more details on these functions.
The asset packaging system will, by default, compress certain file extensions. The asset packaging system will, by default, compress certain file extensions.
SDL includes two asset file access mechanisms, the preferred one is the so SDL includes two asset file access mechanisms, the preferred one is the so
called "File Descriptor" method, which is faster and doesn't involve the Dalvik called "File Descriptor" method, which is faster and doesn't involve the Dalvik
GC, but given this method does not work on compressed assets, there is also the GC, but given this method does not work on compressed assets, there is also the
"Input Stream" method, which is automatically used as a fall back by SDL. You "Input Stream" method, which is automatically used as a fall back by SDL. You
may want to keep this fact in mind when building your APK, specially when large may want to keep this fact in mind when building your APK, specially when large
files are involved. files are involved.
For more information on which extensions get compressed by default and how to For more information on which extensions get compressed by default and how to
disable this behaviour, see for example: disable this behaviour, see for example:
http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/ http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
Pause / Resume behaviour Pause / Resume behaviour
================================================================================ ================================================================================
If SDL_HINT_ANDROID_BLOCK_ON_PAUSE hint is set (the default), If SDL_HINT_ANDROID_BLOCK_ON_PAUSE hint is set (the default),
the event loop will block itself when the app is paused (ie, when the user the event loop will block itself when the app is paused (ie, when the user
returns to the main Android dashboard). Blocking is better in terms of battery returns to the main Android dashboard). Blocking is better in terms of battery
use, and it allows your app to spring back to life instantaneously after resume use, and it allows your app to spring back to life instantaneously after resume
(versus polling for a resume message). (versus polling for a resume message).
Upon resume, SDL will attempt to restore the GL context automatically. Upon resume, SDL will attempt to restore the GL context automatically.
In modern devices (Android 3.0 and up) this will most likely succeed and your In modern devices (Android 3.0 and up) this will most likely succeed and your
app can continue to operate as it was. app can continue to operate as it was.
However, there's a chance (on older hardware, or on systems under heavy load), However, there's a chance (on older hardware, or on systems under heavy load),
where the GL context can not be restored. In that case you have to listen for where the GL context can not be restored. In that case you have to listen for
a specific message (SDL_RENDER_DEVICE_RESET) and restore your textures a specific message (SDL_RENDER_DEVICE_RESET) and restore your textures
manually or quit the app. manually or quit the app.
You should not use the SDL renderer API while the app going in background: You should not use the SDL renderer API while the app going in background:
- SDL_APP_WILLENTERBACKGROUND: - SDL_APP_WILLENTERBACKGROUND:
after you read this message, GL context gets backed-up and you should not after you read this message, GL context gets backed-up and you should not
use the SDL renderer API. use the SDL renderer API.
When this event is received, you have to set the render target to NULL, if you're using it. When this event is received, you have to set the render target to NULL, if you're using it.
(eg call SDL_SetRenderTarget(renderer, NULL)) (eg call SDL_SetRenderTarget(renderer, NULL))
- SDL_APP_DIDENTERFOREGROUND: - SDL_APP_DIDENTERFOREGROUND:
GL context is restored, and the SDL renderer API is available (unless you GL context is restored, and the SDL renderer API is available (unless you
receive SDL_RENDER_DEVICE_RESET). receive SDL_RENDER_DEVICE_RESET).
Mouse / Touch events Mouse / Touch events
================================================================================ ================================================================================
In some case, SDL generates synthetic mouse (resp. touch) events for touch In some case, SDL generates synthetic mouse (resp. touch) events for touch
(resp. mouse) devices. (resp. mouse) devices.
To enable/disable this behavior, see SDL_hints.h: To enable/disable this behavior, see SDL_hints.h:
- SDL_HINT_TOUCH_MOUSE_EVENTS - SDL_HINT_TOUCH_MOUSE_EVENTS
- SDL_HINT_MOUSE_TOUCH_EVENTS - SDL_HINT_MOUSE_TOUCH_EVENTS
Misc Misc
================================================================================ ================================================================================
For some device, it appears to works better setting explicitly GL attributes For some device, it appears to works better setting explicitly GL attributes
before creating a window: before creating a window:
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6); SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
Threads and the Java VM Threads and the Java VM
================================================================================ ================================================================================
For a quick tour on how Linux native threads interoperate with the Java VM, take For a quick tour on how Linux native threads interoperate with the Java VM, take
a look here: https://developer.android.com/guide/practices/jni.html a look here: https://developer.android.com/guide/practices/jni.html
If you want to use threads in your SDL app, it's strongly recommended that you If you want to use threads in your SDL app, it's strongly recommended that you
do so by creating them using SDL functions. This way, the required attach/detach do so by creating them using SDL functions. This way, the required attach/detach
handling is managed by SDL automagically. If you have threads created by other handling is managed by SDL automagically. If you have threads created by other
means and they make calls to SDL functions, make sure that you call means and they make calls to SDL functions, make sure that you call
Android_JNI_SetupThread() before doing anything else otherwise SDL will attach Android_JNI_SetupThread() before doing anything else otherwise SDL will attach
your thread automatically anyway (when you make an SDL call), but it'll never your thread automatically anyway (when you make an SDL call), but it'll never
detach it. detach it.
If you ever want to use JNI in a native thread (created by "SDL_CreateThread()"), If you ever want to use JNI in a native thread (created by "SDL_CreateThread()"),
it won't be able to find your java class and method because of the java class loader it won't be able to find your java class and method because of the java class loader
which is different for native threads, than for java threads (eg your "main()"). which is different for native threads, than for java threads (eg your "main()").
the work-around is to find class/method, in you "main()" thread, and to use them the work-around is to find class/method, in you "main()" thread, and to use them
in your native thread. in your native thread.
see: see:
https://developer.android.com/training/articles/perf-jni#faq:-why-didnt-findclass-find-my-class https://developer.android.com/training/articles/perf-jni#faq:-why-didnt-findclass-find-my-class
Using STL Using STL
================================================================================ ================================================================================
You can use STL in your project by creating an Application.mk file in the jni You can use STL in your project by creating an Application.mk file in the jni
folder and adding the following line: folder and adding the following line:
APP_STL := c++_shared APP_STL := c++_shared
For more information go here: For more information go here:
https://developer.android.com/ndk/guides/cpp-support https://developer.android.com/ndk/guides/cpp-support
Using the emulator Using the emulator
================================================================================ ================================================================================
There are some good tips and tricks for getting the most out of the There are some good tips and tricks for getting the most out of the
emulator here: https://developer.android.com/tools/devices/emulator.html emulator here: https://developer.android.com/tools/devices/emulator.html
Especially useful is the info on setting up OpenGL ES 2.0 emulation. Especially useful is the info on setting up OpenGL ES 2.0 emulation.
Notice that this software emulator is incredibly slow and needs a lot of disk space. Notice that this software emulator is incredibly slow and needs a lot of disk space.
Using a real device works better. Using a real device works better.
Troubleshooting Troubleshooting
================================================================================ ================================================================================
You can see if adb can see any devices with the following command: You can see if adb can see any devices with the following command:
adb devices adb devices
You can see the output of log messages on the default device with: You can see the output of log messages on the default device with:
adb logcat adb logcat
You can push files to the device with: You can push files to the device with:
adb push local_file remote_path_and_file adb push local_file remote_path_and_file
You can push files to the SD Card at /sdcard, for example: You can push files to the SD Card at /sdcard, for example:
adb push moose.dat /sdcard/moose.dat adb push moose.dat /sdcard/moose.dat
You can see the files on the SD card with a shell command: You can see the files on the SD card with a shell command:
adb shell ls /sdcard/ adb shell ls /sdcard/
You can start a command shell on the default device with: You can start a command shell on the default device with:
adb shell adb shell
You can remove the library files of your project (and not the SDL lib files) with: You can remove the library files of your project (and not the SDL lib files) with:
ndk-build clean ndk-build clean
You can do a build with the following command: You can do a build with the following command:
ndk-build ndk-build
You can see the complete command line that ndk-build is using by passing V=1 on the command line: You can see the complete command line that ndk-build is using by passing V=1 on the command line:
ndk-build V=1 ndk-build V=1
If your application crashes in native code, you can use ndk-stack to get a symbolic stack trace: If your application crashes in native code, you can use ndk-stack to get a symbolic stack trace:
https://developer.android.com/ndk/guides/ndk-stack https://developer.android.com/ndk/guides/ndk-stack
If you want to go through the process manually, you can use addr2line to convert the If you want to go through the process manually, you can use addr2line to convert the
addresses in the stack trace to lines in your code. addresses in the stack trace to lines in your code.
For example, if your crash looks like this: For example, if your crash looks like this:
I/DEBUG ( 31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0 I/DEBUG ( 31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0
I/DEBUG ( 31): r0 00000000 r1 00001000 r2 00000003 r3 400085d4 I/DEBUG ( 31): r0 00000000 r1 00001000 r2 00000003 r3 400085d4
I/DEBUG ( 31): r4 400085d0 r5 40008000 r6 afd41504 r7 436c6a7c I/DEBUG ( 31): r4 400085d0 r5 40008000 r6 afd41504 r7 436c6a7c
I/DEBUG ( 31): r8 436c6b30 r9 435c6fb0 10 435c6f9c fp 4168d82c I/DEBUG ( 31): r8 436c6b30 r9 435c6fb0 10 435c6f9c fp 4168d82c
I/DEBUG ( 31): ip 8346aff0 sp 436c6a60 lr afd1c8ff pc afd1c902 cpsr 60000030 I/DEBUG ( 31): ip 8346aff0 sp 436c6a60 lr afd1c8ff pc afd1c902 cpsr 60000030
I/DEBUG ( 31): #00 pc 0001c902 /system/lib/libc.so I/DEBUG ( 31): #00 pc 0001c902 /system/lib/libc.so
I/DEBUG ( 31): #01 pc 0001ccf6 /system/lib/libc.so I/DEBUG ( 31): #01 pc 0001ccf6 /system/lib/libc.so
I/DEBUG ( 31): #02 pc 000014bc /data/data/org.libsdl.app/lib/libmain.so I/DEBUG ( 31): #02 pc 000014bc /data/data/org.libsdl.app/lib/libmain.so
I/DEBUG ( 31): #03 pc 00001506 /data/data/org.libsdl.app/lib/libmain.so I/DEBUG ( 31): #03 pc 00001506 /data/data/org.libsdl.app/lib/libmain.so
You can see that there's a crash in the C library being called from the main code. You can see that there's a crash in the C library being called from the main code.
I run addr2line with the debug version of my code: I run addr2line with the debug version of my code:
arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so
and then paste in the number after "pc" in the call stack, from the line that I care about: and then paste in the number after "pc" in the call stack, from the line that I care about:
000014bc 000014bc
I get output from addr2line showing that it's in the quit function, in testspriteminimal.c, on line 23. I get output from addr2line showing that it's in the quit function, in testspriteminimal.c, on line 23.
You can add logging to your code to help show what's happening: You can add logging to your code to help show what's happening:
#include <android/log.h> #include <android/log.h>
__android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x); __android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
If you need to build without optimization turned on, you can create a file called If you need to build without optimization turned on, you can create a file called
"Application.mk" in the jni directory, with the following line in it: "Application.mk" in the jni directory, with the following line in it:
APP_OPTIM := debug APP_OPTIM := debug
Memory debugging Memory debugging
================================================================================ ================================================================================
The best (and slowest) way to debug memory issues on Android is valgrind. The best (and slowest) way to debug memory issues on Android is valgrind.
Valgrind has support for Android out of the box, just grab code using: Valgrind has support for Android out of the box, just grab code using:
svn co svn://svn.valgrind.org/valgrind/trunk valgrind svn co svn://svn.valgrind.org/valgrind/trunk valgrind
... and follow the instructions in the file README.android to build it. ... and follow the instructions in the file README.android to build it.
One thing I needed to do on Mac OS X was change the path to the toolchain, One thing I needed to do on Mac OS X was change the path to the toolchain,
and add ranlib to the environment variables: and add ranlib to the environment variables:
export RANLIB=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib export RANLIB=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib
Once valgrind is built, you can create a wrapper script to launch your Once valgrind is built, you can create a wrapper script to launch your
application with it, changing org.libsdl.app to your package identifier: application with it, changing org.libsdl.app to your package identifier:
--- start_valgrind_app ------------------- --- start_valgrind_app -------------------
#!/system/bin/sh #!/system/bin/sh
export TMPDIR=/data/data/org.libsdl.app export TMPDIR=/data/data/org.libsdl.app
exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $* exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $*
------------------------------------------ ------------------------------------------
Then push it to the device: Then push it to the device:
adb push start_valgrind_app /data/local adb push start_valgrind_app /data/local
and make it executable: and make it executable:
adb shell chmod 755 /data/local/start_valgrind_app adb shell chmod 755 /data/local/start_valgrind_app
and tell Android to use the script to launch your application: and tell Android to use the script to launch your application:
adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app" adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app"
If the setprop command says "could not set property", it's likely that If the setprop command says "could not set property", it's likely that
your package name is too long and you should make it shorter by changing your package name is too long and you should make it shorter by changing
AndroidManifest.xml and the path to your class file in android-project/src AndroidManifest.xml and the path to your class file in android-project/src
You can then launch your application normally and waaaaaaaiiittt for it. You can then launch your application normally and waaaaaaaiiittt for it.
You can monitor the startup process with the logcat command above, and You can monitor the startup process with the logcat command above, and
when it's done (or even while it's running) you can grab the valgrind when it's done (or even while it's running) you can grab the valgrind
output file: output file:
adb pull /sdcard/valgrind.log adb pull /sdcard/valgrind.log
When you're done instrumenting with valgrind, you can disable the wrapper: When you're done instrumenting with valgrind, you can disable the wrapper:
adb shell setprop wrap.org.libsdl.app "" adb shell setprop wrap.org.libsdl.app ""
Graphics debugging Graphics debugging
================================================================================ ================================================================================
If you are developing on a compatible Tegra-based tablet, NVidia provides If you are developing on a compatible Tegra-based tablet, NVidia provides
Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL Tegra Graphics Debugger at their website. Because SDL2 dynamically loads EGL
and GLES libraries, you must follow their instructions for installing the and GLES libraries, you must follow their instructions for installing the
interposer library on a rooted device. The non-rooted instructions are not interposer library on a rooted device. The non-rooted instructions are not
compatible with applications that use SDL2 for video. compatible with applications that use SDL2 for video.
The Tegra Graphics Debugger is available from NVidia here: The Tegra Graphics Debugger is available from NVidia here:
https://developer.nvidia.com/tegra-graphics-debugger https://developer.nvidia.com/tegra-graphics-debugger
Why is API level 19 the minimum required? Why is API level 19 the minimum required?
================================================================================ ================================================================================
The latest NDK toolchain doesn't support targeting earlier than API level 19. The latest NDK toolchain doesn't support targeting earlier than API level 19.
As of this writing, according to https://www.composables.com/tools/distribution-chart As of this writing, according to https://www.composables.com/tools/distribution-chart
about 99.7% of the Android devices accessing Google Play support API level 19 or about 99.7% of the Android devices accessing Google Play support API level 19 or
higher (August 2023). higher (August 2023).
A note regarding the use of the "dirty rectangles" rendering technique A note regarding the use of the "dirty rectangles" rendering technique
================================================================================ ================================================================================
If your app uses a variation of the "dirty rectangles" rendering technique, If your app uses a variation of the "dirty rectangles" rendering technique,
where you only update a portion of the screen on each frame, you may notice a where you only update a portion of the screen on each frame, you may notice a
variety of visual glitches on Android, that are not present on other platforms. variety of visual glitches on Android, that are not present on other platforms.
This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2 This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2
contexts, in particular the use of the eglSwapBuffers function. As stated in the contexts, in particular the use of the eglSwapBuffers function. As stated in the
documentation for the function "The contents of ancillary buffers are always documentation for the function "The contents of ancillary buffers are always
undefined after calling eglSwapBuffers". undefined after calling eglSwapBuffers".
Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED
is not possible for SDL as it requires EGL 1.4, available only on the API level is not possible for SDL as it requires EGL 1.4, available only on the API level
17+, so the only workaround available on this platform is to redraw the entire 17+, so the only workaround available on this platform is to redraw the entire
screen each frame. screen each frame.
Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html
Ending your application Ending your application
================================================================================ ================================================================================
Two legitimate ways: Two legitimate ways:
- return from your main() function. Java side will automatically terminate the - return from your main() function. Java side will automatically terminate the
Activity by calling Activity.finish(). Activity by calling Activity.finish().
- Android OS can decide to terminate your application by calling onDestroy() - Android OS can decide to terminate your application by calling onDestroy()
(see Activity life cycle). Your application will receive a SDL_QUIT event you (see Activity life cycle). Your application will receive a SDL_QUIT event you
can handle to save things and quit. can handle to save things and quit.
Don't call exit() as it stops the activity badly. Don't call exit() as it stops the activity badly.
NB: "Back button" can be handled as a SDL_KEYDOWN/UP events, with Keycode NB: "Back button" can be handled as a SDL_KEYDOWN/UP events, with Keycode
SDLK_AC_BACK, for any purpose. SDLK_AC_BACK, for any purpose.
Known issues Known issues
================================================================================ ================================================================================
- The number of buttons reported for each joystick is hardcoded to be 36, which - The number of buttons reported for each joystick is hardcoded to be 36, which
is the current maximum number of buttons Android can report. is the current maximum number of buttons Android can report.
+163 -163
View File
@@ -1,163 +1,163 @@
# CMake # CMake
(www.cmake.org) (www.cmake.org)
SDL's build system was traditionally based on autotools. Over time, this SDL's build system was traditionally based on autotools. Over time, this
approach has suffered from several issues across the different supported approach has suffered from several issues across the different supported
platforms. platforms.
To solve these problems, a new build system based on CMake was introduced. To solve these problems, a new build system based on CMake was introduced.
It is developed in parallel to the legacy autotools build system, so users It is developed in parallel to the legacy autotools build system, so users
can experiment with it without complication. can experiment with it without complication.
The CMake build system is supported on the following platforms: The CMake build system is supported on the following platforms:
* FreeBSD * FreeBSD
* Linux * Linux
* Microsoft Visual C * Microsoft Visual C
* MinGW and Msys * MinGW and Msys
* macOS, iOS, and tvOS, with support for XCode * macOS, iOS, and tvOS, with support for XCode
* Android * Android
* Emscripten * Emscripten
* RiscOS * RiscOS
* Playstation Vita * Playstation Vita
## Building SDL ## Building SDL
Assuming the source for SDL is located at `~/sdl` Assuming the source for SDL is located at `~/sdl`
```sh ```sh
cd ~ cd ~
mkdir build mkdir build
cd build cd build
cmake ~/sdl cmake ~/sdl
cmake --build . cmake --build .
``` ```
This will build the static and dynamic versions of SDL in the `~/build` directory. This will build the static and dynamic versions of SDL in the `~/build` directory.
Installation can be done using: Installation can be done using:
```sh ```sh
cmake --install . # '--install' requires CMake 3.15, or newer cmake --install . # '--install' requires CMake 3.15, or newer
``` ```
## Including SDL in your project ## Including SDL in your project
SDL can be included in your project in 2 major ways: SDL can be included in your project in 2 major ways:
- using a system SDL library, provided by your (*nix) distribution or a package manager - using a system SDL library, provided by your (*nix) distribution or a package manager
- using a vendored SDL library: this is SDL copied or symlinked in a subfolder. - using a vendored SDL library: this is SDL copied or symlinked in a subfolder.
The following CMake script supports both, depending on the value of `MYGAME_VENDORED`. The following CMake script supports both, depending on the value of `MYGAME_VENDORED`.
```cmake ```cmake
cmake_minimum_required(VERSION 3.5) cmake_minimum_required(VERSION 3.5)
project(mygame) project(mygame)
# Create an option to switch between a system sdl library and a vendored sdl library # Create an option to switch between a system sdl library and a vendored sdl library
option(MYGAME_VENDORED "Use vendored libraries" OFF) option(MYGAME_VENDORED "Use vendored libraries" OFF)
if(MYGAME_VENDORED) if(MYGAME_VENDORED)
add_subdirectory(vendored/sdl EXCLUDE_FROM_ALL) add_subdirectory(vendored/sdl EXCLUDE_FROM_ALL)
else() else()
# 1. Look for a SDL2 package, 2. look for the SDL2 component and 3. fail if none can be found # 1. Look for a SDL2 package, 2. look for the SDL2 component and 3. fail if none can be found
find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2) find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2)
# 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available # 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available
find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main) find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main)
endif() endif()
# Create your game executable target as usual # Create your game executable target as usual
add_executable(mygame WIN32 mygame.c) add_executable(mygame WIN32 mygame.c)
# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications # SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications
if(TARGET SDL2::SDL2main) if(TARGET SDL2::SDL2main)
# It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static) # It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static)
target_link_libraries(mygame PRIVATE SDL2::SDL2main) target_link_libraries(mygame PRIVATE SDL2::SDL2main)
endif() endif()
# Link to the actual SDL2 library. SDL2::SDL2 is the shared SDL library, SDL2::SDL2-static is the static SDL libarary. # Link to the actual SDL2 library. SDL2::SDL2 is the shared SDL library, SDL2::SDL2-static is the static SDL libarary.
target_link_libraries(mygame PRIVATE SDL2::SDL2) target_link_libraries(mygame PRIVATE SDL2::SDL2)
``` ```
### A system SDL library ### A system SDL library
For CMake to find SDL, it must be installed in [a default location CMake is looking for](https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure). For CMake to find SDL, it must be installed in [a default location CMake is looking for](https://cmake.org/cmake/help/latest/command/find_package.html#config-mode-search-procedure).
The following components are available, to be used as an argument of `find_package`. The following components are available, to be used as an argument of `find_package`.
| Component name | Description | | Component name | Description |
|----------------|--------------------------------------------------------------------------------------------| |----------------|--------------------------------------------------------------------------------------------|
| SDL2 | The SDL2 shared library, available through the `SDL2::SDL2` target [^SDL_TARGET_EXCEPTION] | | SDL2 | The SDL2 shared library, available through the `SDL2::SDL2` target [^SDL_TARGET_EXCEPTION] |
| SDL2-static | The SDL2 static library, available through the `SDL2::SDL2-static` target | | SDL2-static | The SDL2 static library, available through the `SDL2::SDL2-static` target |
| SDL2main | The SDL2main static library, available through the `SDL2::SDL2main` target | | SDL2main | The SDL2main static library, available through the `SDL2::SDL2main` target |
| SDL2test | The SDL2test static library, available through the `SDL2::SDL2test` target | | SDL2test | The SDL2test static library, available through the `SDL2::SDL2test` target |
### Using a vendored SDL ### Using a vendored SDL
This only requires a copy of SDL in a subdirectory. This only requires a copy of SDL in a subdirectory.
## CMake configuration options for platforms ## CMake configuration options for platforms
### iOS/tvOS ### iOS/tvOS
CMake 3.14+ natively includes support for iOS and tvOS. SDL binaries may be built CMake 3.14+ natively includes support for iOS and tvOS. SDL binaries may be built
using Xcode or Make, possibly among other build-systems. using Xcode or Make, possibly among other build-systems.
When using a recent version of CMake (3.14+), it should be possible to: When using a recent version of CMake (3.14+), it should be possible to:
- build SDL for iOS, both static and dynamic - build SDL for iOS, both static and dynamic
- build SDL test apps (as iOS/tvOS .app bundles) - build SDL test apps (as iOS/tvOS .app bundles)
- generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis) - generate a working SDL_config.h for iOS (using SDL_config.h.cmake as a basis)
To use, set the following CMake variables when running CMake's configuration stage: To use, set the following CMake variables when running CMake's configuration stage:
- `CMAKE_SYSTEM_NAME=<OS>` (either `iOS` or `tvOS`) - `CMAKE_SYSTEM_NAME=<OS>` (either `iOS` or `tvOS`)
- `CMAKE_OSX_SYSROOT=<SDK>` (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`, - `CMAKE_OSX_SYSROOT=<SDK>` (examples: `iphoneos`, `iphonesimulator`, `iphoneos12.4`, `/full/path/to/iPhoneOS.sdk`,
`appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.) `appletvos`, `appletvsimulator`, `appletvos12.4`, `/full/path/to/AppleTVOS.sdk`, etc.)
- `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64") - `CMAKE_OSX_ARCHITECTURES=<semicolon-separated list of CPU architectures>` (example: "arm64;armv7s;x86_64")
#### Examples #### Examples
- for iOS-Simulator, using the latest, installed SDK: - for iOS-Simulator, using the latest, installed SDK:
```bash ```bash
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64 cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
``` ```
- for iOS-Device, using the latest, installed SDK, 64-bit only - for iOS-Device, using the latest, installed SDK, 64-bit only
```bash ```bash
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64 cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64
``` ```
- for iOS-Device, using the latest, installed SDK, mixed 32/64 bit - for iOS-Device, using the latest, installed SDK, mixed 32/64 bit
```cmake ```cmake
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s" cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"
``` ```
- for iOS-Device, using a specific SDK revision (iOS 12.4, in this example): - for iOS-Device, using a specific SDK revision (iOS 12.4, in this example):
```cmake ```cmake
cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64 cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64
``` ```
- for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles): - for iOS-Simulator, using the latest, installed SDK, and building SDL test apps (as .app bundles):
```cmake ```cmake
cmake ~/sdl -DSDL_TESTS=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64 cmake ~/sdl -DSDL_TESTS=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
``` ```
- for tvOS-Simulator, using the latest, installed SDK: - for tvOS-Simulator, using the latest, installed SDK:
```cmake ```cmake
cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64 cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64
``` ```
- for tvOS-Device, using the latest, installed SDK: - for tvOS-Device, using the latest, installed SDK:
```cmake ```cmake
cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64` cmake ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64`
``` ```
[^SDL_TARGET_EXCEPTION]: `SDL2::SDL2` can be an ALIAS to a static `SDL2::SDL2-static` target for multiple reasons. [^SDL_TARGET_EXCEPTION]: `SDL2::SDL2` can be an ALIAS to a static `SDL2::SDL2-static` target for multiple reasons.
+123 -123
View File
@@ -1,123 +1,123 @@
DirectFB DirectFB
======== ========
Supports: Supports:
- Hardware YUV overlays - Hardware YUV overlays
- OpenGL - software only - OpenGL - software only
- 2D/3D accelerations (depends on directfb driver) - 2D/3D accelerations (depends on directfb driver)
- multiple displays - multiple displays
- windows - windows
What you need: What you need:
* DirectFB 1.0.1, 1.2.x, 1.3.0 * DirectFB 1.0.1, 1.2.x, 1.3.0
* Kernel-Framebuffer support: required: vesafb, radeonfb .... * Kernel-Framebuffer support: required: vesafb, radeonfb ....
* Mesa 7.0.x - optional for OpenGL * Mesa 7.0.x - optional for OpenGL
The `/etc/directfbrc` file should contain the following lines to make The `/etc/directfbrc` file should contain the following lines to make
your joystick work and avoid crashes: your joystick work and avoid crashes:
``` ```
disable-module=joystick disable-module=joystick
disable-module=cle266 disable-module=cle266
disable-module=cyber5k disable-module=cyber5k
no-linux-input-grab no-linux-input-grab
``` ```
To disable to use x11 backend when DISPLAY variable is found use To disable to use x11 backend when DISPLAY variable is found use
``` ```
export SDL_DIRECTFB_X11_CHECK=0 export SDL_DIRECTFB_X11_CHECK=0
``` ```
To disable the use of linux input devices, i.e. multimice/multikeyboard support, To disable the use of linux input devices, i.e. multimice/multikeyboard support,
use use
``` ```
export SDL_DIRECTFB_LINUX_INPUT=0 export SDL_DIRECTFB_LINUX_INPUT=0
``` ```
To use hardware accelerated YUV-overlays for YUV-textures, use: To use hardware accelerated YUV-overlays for YUV-textures, use:
``` ```
export SDL_DIRECTFB_YUV_DIRECT=1 export SDL_DIRECTFB_YUV_DIRECT=1
``` ```
This is disabled by default. It will only support one This is disabled by default. It will only support one
YUV texture, namely the first. Every other YUV texture will be YUV texture, namely the first. Every other YUV texture will be
rendered in software. rendered in software.
In addition, you may use (directfb-1.2.x) In addition, you may use (directfb-1.2.x)
``` ```
export SDL_DIRECTFB_YUV_UNDERLAY=1 export SDL_DIRECTFB_YUV_UNDERLAY=1
``` ```
to make the YUV texture an underlay. This will make the cursor to to make the YUV texture an underlay. This will make the cursor to
be shown. be shown.
Simple Window Manager Simple Window Manager
===================== =====================
The driver has support for a very, very basic window manager you may The driver has support for a very, very basic window manager you may
want to use when running with `wm=default`. Use want to use when running with `wm=default`. Use
``` ```
export SDL_DIRECTFB_WM=1 export SDL_DIRECTFB_WM=1
``` ```
to enable basic window borders. In order to have the window title rendered, to enable basic window borders. In order to have the window title rendered,
you need to have the following font installed: you need to have the following font installed:
``` ```
/usr/share/fonts/truetype/freefont/FreeSans.ttf /usr/share/fonts/truetype/freefont/FreeSans.ttf
``` ```
OpenGL Support OpenGL Support
============== ==============
The following instructions will give you *software* OpenGL. However this The following instructions will give you *software* OpenGL. However this
works at least on all directfb supported platforms. works at least on all directfb supported platforms.
As of this writing 20100802 you need to pull Mesa from git and do the following: As of this writing 20100802 you need to pull Mesa from git and do the following:
``` ```
git clone git://anongit.freedesktop.org/git/mesa/mesa git clone git://anongit.freedesktop.org/git/mesa/mesa
cd mesa cd mesa
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
``` ```
Edit `configs/linux-directfb` so that the Directories-section looks like this: Edit `configs/linux-directfb` so that the Directories-section looks like this:
``` ```
# Directories # Directories
SRC_DIRS = mesa glu SRC_DIRS = mesa glu
GLU_DIRS = sgi GLU_DIRS = sgi
DRIVER_DIRS = directfb DRIVER_DIRS = directfb
PROGRAM_DIRS = PROGRAM_DIRS =
``` ```
Then do the following: Then do the following:
``` ```
make linux-directfb make linux-directfb
make make
echo Installing - please enter sudo pw. echo Installing - please enter sudo pw.
sudo make install INSTALL_DIR=/usr/local/dfb_GL sudo make install INSTALL_DIR=/usr/local/dfb_GL
cd src/mesa/drivers/directfb cd src/mesa/drivers/directfb
make make
sudo make install INSTALL_DIR=/usr/local/dfb_GL sudo make install INSTALL_DIR=/usr/local/dfb_GL
``` ```
To run the SDL - testprograms: To run the SDL - testprograms:
``` ```
export SDL_VIDEODRIVER=directfb export SDL_VIDEODRIVER=directfb
export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib
export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7 export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7
./testgl ./testgl
``` ```
+138 -138
View File
@@ -1,138 +1,138 @@
# Dynamic API # Dynamic API
Originally posted on Ryan's Google+ account. Originally posted on Ryan's Google+ account.
Background: Background:
- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2, - The Steam Runtime has (at least in theory) a really kick-ass build of SDL2,
but developers are shipping their own SDL2 with individual Steam games. but developers are shipping their own SDL2 with individual Steam games.
These games might stop getting updates, but a newer SDL2 might be needed later. These games might stop getting updates, but a newer SDL2 might be needed later.
Certainly we'll always be fixing bugs in SDL, even if a new video target isn't Certainly we'll always be fixing bugs in SDL, even if a new video target isn't
ever needed, and these fixes won't make it to a game shipping its own SDL. ever needed, and these fixes won't make it to a game shipping its own SDL.
- Even if we replace the SDL2 in those games with a compatible one, that is to - Even if we replace the SDL2 in those games with a compatible one, that is to
say, edit a developer's Steam depot (yuck!), there are developers that are say, edit a developer's Steam depot (yuck!), there are developers that are
statically linking SDL2 that we can't do this for. We can't even force the statically linking SDL2 that we can't do this for. We can't even force the
dynamic loader to ignore their SDL2 in this case, of course. dynamic loader to ignore their SDL2 in this case, of course.
- If you don't ship an SDL2 with the game in some form, people that disabled the - If you don't ship an SDL2 with the game in some form, people that disabled the
Steam Runtime, or just tried to run the game from the command line instead of Steam Runtime, or just tried to run the game from the command line instead of
Steam might find themselves unable to run the game, due to a missing dependency. Steam might find themselves unable to run the game, due to a missing dependency.
- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target - If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target
generic Linux boxes that may or may not have SDL2 installed, you have to ship generic Linux boxes that may or may not have SDL2 installed, you have to ship
the library or risk a total failure to launch. So now, you might have to have the library or risk a total failure to launch. So now, you might have to have
a non-Steam build plus a Steam build (that is, one with and one without SDL2 a non-Steam build plus a Steam build (that is, one with and one without SDL2
included), which is inconvenient if you could have had one universal build included), which is inconvenient if you could have had one universal build
that works everywhere. that works everywhere.
- We like the zlib license, but the biggest complaint from the open source - We like the zlib license, but the biggest complaint from the open source
community about the license change is the static linking. The LGPL forced this community about the license change is the static linking. The LGPL forced this
as a legal, not technical issue, but zlib doesn't care. Even those that aren't as a legal, not technical issue, but zlib doesn't care. Even those that aren't
concerned about the GNU freedoms found themselves solving the same problems: concerned about the GNU freedoms found themselves solving the same problems:
swapping in a newer SDL to an older game often times can save the day. swapping in a newer SDL to an older game often times can save the day.
Static linking stops this dead. Static linking stops this dead.
So here's what we did: So here's what we did:
SDL now has, internally, a table of function pointers. So, this is what SDL_Init 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);
} }
``` ```
Except that is all done with a bunch of macro magic so we don't have to maintain Except that is all done with a bunch of macro magic so we don't have to maintain
every one of these. every one of these.
What is jump_table.SDL_init()? Eventually, that's a function pointer of the real What is jump_table.SDL_init()? Eventually, that's a function pointer of the real
SDL_Init() that you've been calling all this time. But at startup, it looks more SDL_Init() that you've been calling all this time. But at startup, it looks more
like this: like this:
```c ```c
Uint32 SDL_Init_DEFAULT(Uint32 flags) Uint32 SDL_Init_DEFAULT(Uint32 flags)
{ {
SDL_InitDynamicAPI(); SDL_InitDynamicAPI();
return jump_table.SDL_Init(flags); return jump_table.SDL_Init(flags);
} }
``` ```
SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function
pointers, which means that this `_DEFAULT` function never gets called again. pointers, which means that this `_DEFAULT` function never gets called again.
First call to any SDL function sets the whole thing up. First call to any SDL function sets the whole thing up.
So you might be asking, what was the value in that? Isn't this what the operating So you might be asking, what was the value in that? Isn't this what the operating
system's dynamic loader was supposed to do for us? Yes, but now we've got this system's dynamic loader was supposed to do for us? Yes, but now we've got this
level of indirection, we can do things like this: level of indirection, we can do things like this:
```bash ```bash
export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0 export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0
./MyGameThatIsStaticallyLinkedToSDL2 ./MyGameThatIsStaticallyLinkedToSDL2
``` ```
And now, this game that is statically linked to SDL, can still be overridden And now, this game that is statically linked to SDL, can still be overridden
with a newer, or better, SDL. The statically linked one will only be used as with a newer, or better, SDL. The statically linked one will only be used as
far as calling into the jump table in this case. But in cases where no override far as calling into the jump table in this case. But in cases where no override
is desired, the statically linked version will provide its own jump table, is desired, the statically linked version will provide its own jump table,
and everyone is happy. and everyone is happy.
So now: So now:
- Developers can statically link SDL, and users can still replace it. - Developers can statically link SDL, and users can still replace it.
(We'd still rather you ship a shared library, though!) (We'd still rather you ship a shared library, though!)
- Developers can ship an SDL with their game, Valve can override it for, say, - Developers can ship an SDL with their game, Valve can override it for, say,
new features on SteamOS, or distros can override it for their own needs, new features on SteamOS, or distros can override it for their own needs,
but it'll also just work in the default case. but it'll also just work in the default case.
- Developers can ship the same package to everyone (Humble Bundle, GOG, etc), - Developers can ship the same package to everyone (Humble Bundle, GOG, etc),
and it'll do the right thing. and it'll do the right thing.
- End users (and Valve) can update a game's SDL in almost any case, - End users (and Valve) can update a game's SDL in almost any case,
to keep abandoned games running on newer platforms. to keep abandoned games running on newer platforms.
- Everyone develops with SDL exactly as they have been doing all along. - Everyone develops with SDL exactly as they have been doing all along.
Same headers, same ABI. Just get the latest version to enable this magic. Same headers, same ABI. Just get the latest version to enable this magic.
A little more about SDL_InitDynamicAPI(): A little more about SDL_InitDynamicAPI():
Internally, InitAPI does some locking to make sure everything waits until a Internally, InitAPI does some locking to make sure everything waits until a
single thread initializes everything (although even SDL_CreateThread() goes single thread initializes everything (although even SDL_CreateThread() goes
through here before spinning a thread, too), and then decides if it should use through here before spinning a thread, too), and then decides if it should use
an external SDL library. If not, it sets up the jump table using the current an external SDL library. If not, it sets up the jump table using the current
SDL's function pointers (which might be statically linked into a program, or in SDL's function pointers (which might be statically linked into a program, or in
a shared library of its own). If so, it loads that library and looks for and 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
the jump table, and the size, in bytes, of the table. the jump table, and the size, in bytes, of the table.
Now, we've got policy here: this table's layout never changes; new stuff gets Now, we've got policy here: this table's layout never changes; new stuff gets
added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all
the needed functions if tablesize <= sizeof its own jump table. If tablesize is the needed functions if tablesize <= sizeof its own jump table. If tablesize is
bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but
if it's smaller, we know we can provide the entire API that the caller needs. if it's smaller, we know we can provide the entire API that the caller needs.
The version variable is a failsafe switch. The version variable is a failsafe switch.
Right now it's always 1. This number changes when there are major API changes Right now it's always 1. This number changes when there are major API changes
(so we know if the tablesize might be smaller, or entries in it have changed). (so we know if the tablesize might be smaller, or entries in it have changed).
Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not
inconceivable to have a small dispatch library that only supplies this one inconceivable to have a small dispatch library that only supplies this one
function and loads different, otherwise-incompatible SDL libraries and has the function and loads different, otherwise-incompatible SDL libraries and has the
right one initialize the jump table based on the version. For something that right one initialize the jump table based on the version. For something that
must generically catch lots of different versions of SDL over time, like the must generically catch lots of different versions of SDL over time, like the
Steam Client, this isn't a bad option. Steam Client, this isn't a bad option.
Finally, I'm sure some people are reading this and thinking, Finally, I'm sure some people are reading this and thinking,
"I don't want that overhead in my project!" "I don't want that overhead in my project!"
To which I would point out that the extra function call through the jump table To which I would point out that the extra function call through the jump table
probably wouldn't even show up in a profile, but lucky you: this can all be probably wouldn't even show up in a profile, but lucky you: this can all be
disabled. You can build SDL without this if you absolutely must, but we would disabled. You can build SDL without this if you absolutely must, but we would
encourage you not to do that. However, on heavily locked down platforms like encourage you not to do that. However, on heavily locked down platforms like
iOS, or maybe when debugging, it makes sense to disable it. The way this is iOS, or maybe when debugging, it makes sense to disable it. The way this is
designed in SDL, you just have to change one #define, and the entire system designed in SDL, you just have to change one #define, and the entire system
vaporizes out, and SDL functions exactly like it always did. Most of it is vaporizes out, and SDL functions exactly like it always did. Most of it is
macro magic, so the system is contained to one C file and a few headers. macro magic, so the system is contained to one C file and a few headers.
However, this is on by default and you have to edit a header file to turn it However, this is on by default and you have to edit a header file to turn it
off. Our hopes is that if we make it easy to disable, but not too easy, off. Our hopes is that if we make it easy to disable, but not too easy,
everyone will ultimately be able to get what they want, but we've gently everyone will ultimately be able to get what they want, but we've gently
nudged everyone towards what we think is the best solution. nudged everyone towards what we think is the best solution.
+76 -374
View File
@@ -1,374 +1,76 @@
# 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.)
Modern web browsers will not permit web pages to produce sound before the
In modern times, all the browsers you probably care about (Chrome, Firefox, user has interacted with them; this is for several reasons, not the least
Edge, and Safari, on Windows, macOS, Linux, iOS and Android), support some of which being that no one likes when a random browser tab suddenly starts
reasonable base configurations: making noise and the user has to scramble to figure out which and silence
it.
- WebAssembly (don't bother with asm.js any more)
- WebGL (which will look like OpenGL ES 2 or 3 to your app). To solve this, most browsers will refuse to let a web app use the audio
- Threads (see caveats, though!) subsystem at all before the user has interacted with (clicked on) the page
- Game controllers in a meaningful way. SDL-based apps also have to deal with this problem; if
- Autoupdating (so you can assume they have a recent version of the browser) the user hasn't interacted with the page, SDL_OpenAudioDevice will fail.
All this to say we're at the point where you don't have to make a lot of There are two reasonable ways to deal with this: if you are writing some
concessions to get even a fairly complex SDL-based game up and running. sort of media player thing, where the user expects there to be a volume
control when you mouseover the canvas, just default that control to a muted
state; if the user clicks on the control to unmute it, on this first click,
## RTFM open the audio device. This allows the media to play at start, the user can
reasonably opt-in to listening, and you never get access denied to the audio
This document is a quick rundown of some high-level details. The device.
documentation at [emscripten.org](https://emscripten.org/) is vast
and extremely detailed for a wide variety of topics, and you should at Many games do not have this sort of UI, and are more rigid about starting
least skim through it at some point. audio along with everything else at the start of the process. For these, your
best bet is to write a little Javascript that puts up a "Click here to play!"
UI, and upon the user clicking, remove that UI and then call the Emscripten
## Porting your app to Emscripten app's main() function. As far as the application knows, the audio device was
available to be opened as soon as the program started, and since this magic
Many many things just need some simple adjustments and they'll compile happens in a little Javascript, you don't have to change your C/C++ code at
like any other C/C++ code, as long as SDL was handling the platform-specific all to make it happen.
work for your program.
Please see the discussion at https://github.com/libsdl-org/SDL/issues/6385
First, you probably need this in at least one of your source files: for some Javascript code to steal for this approach.
```c
#ifdef __EMSCRIPTEN__ ## Building SDL/emscripten
#include <emscripten.h>
#endif SDL currently requires at least Emscripten 3.1.35 to build. Newer versions
``` are likely to work, as well.
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)! Build:
Third: Middleware has to go. If you have a third-party library you link $ mkdir build
against, you either need an Emscripten port of it, or the source code to it $ cd build
to compile yourself, or you need to remove it. $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2"
$ emmake make
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, Or with cmake:
called a mainloop.
$ mkdir build
Somewhere in your program, you probably have something that looks like a more $ cd build
complicated version of this: $ emcmake cmake ..
$ emmake make
```c
void main(void) To build one of the tests:
{
initialize_the_game(); $ cd test/
while (game_is_still_running) { $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
check_for_new_input();
think_about_stuff(); Uses GLES2 renderer or software
draw_the_next_frame();
} Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere):
deinitialize_the_game();
} SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/):
```
$ EMCONFIGURE_JS=1 emconfigure ../configure
This will not work on Emscripten, because the main thread needs to be free build as usual...
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). SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx):
```c $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx
static void mainloop(void) /* this will run often, possibly at the monitor's refresh rate */ build as usual...
{
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
user has interacted with them (clicked or tapped on them, usually); this is
for several reasons, not the least of which being that no one likes when a
random browser tab suddenly starts making noise and the user has to scramble
to figure out which and silence it.
SDL will allow you to open the audio device for playback in this
circumstance, and your audio callback will fire, but SDL will throw the audio
data away until the user interacts with the page. This helps apps that depend
on the audio callback to make progress, and also keeps audio playback in sync
once the app is finally allowed to make noise.
There are two reasonable ways to deal with the silence at the app level:
if you are writing some sort of media player thing, where the user expects
there to be a volume control when you mouseover the canvas, just default
that control to a muted state; if the user clicks on the control to unmute
it, on this first click, open the audio device. This allows the media to
play at start, and the user can reasonably opt-in to listening.
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
best bet is to write a little Javascript that puts up a "Click here to play!"
UI, and upon the user clicking, remove that UI and then call the Emscripten
app's main() function. As far as the application knows, the audio device was
available to be opened as soon as the program started, and since this magic
happens in a little Javascript, you don't have to change your C/C++ code at
all to make it happen.
Please see the discussion at https://github.com/libsdl-org/SDL/issues/6385
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
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
are likely to work, as well.
Build:
This works on Linux/Unix and macOS. Please send comments about Windows.
Make sure you've [installed emsdk](https://emscripten.org/docs/getting_started/downloads.html)
first, and run `source emsdk_env.sh` at the command line so it finds the
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:
```bash
mkdir build
cd build
emcmake cmake ..
emmake make -j4
```
To build one of the tests:
```bash
cd test/
emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html
```
## Building your app
You need to compile with `emcc` instead of `gcc` or `clang` or whatever, but
mostly it uses the same command line arguments as Clang.
Link against the SDL/build/.libs/libSDL2.a file you generated by building SDL,
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!
+155 -176
View File
@@ -1,176 +1,155 @@
GDK 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
------------ ------------
* 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.
Windows GDK Status
Windows GDK Status ------
------
The Windows GDK port supports the full set of Win32 APIs, renderers, controllers, input devices, etc., as the normal Windows x64 build of SDL.
The Windows GDK port supports the full set of Win32 APIs, renderers, controllers, input devices, etc., as the normal Windows x64 build of SDL.
* Additionally, the GDK port adds the following:
* Additionally, the GDK port adds the following: * Compile-time platform detection for SDL programs. The `__GDK__` is `#define`d on every GDK platform, and the `__WINGDK__` is `#define`d on Windows GDK, specifically. (This distinction exists because other GDK platforms support a smaller subset of functionality. This allows you to mark code for "any" GDK separate from Windows GDK.)
* Compile-time platform detection for SDL programs. The `__GDK__` is `#define`d on every GDK platform, and the `__WINGDK__` is `#define`d on Windows GDK, specifically. (This distinction exists because other GDK platforms support a smaller subset of functionality. This allows you to mark code for "any" GDK separate from Windows GDK.) * GDK-specific setup:
* GDK-specific setup: * Initializing/uninitializing the game runtime, and initializing Xbox Live services
* Initializing/uninitializing the game runtime, and initializing Xbox Live services * Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue.
* Creating a global task queue and setting it as the default for the process. When running any async operations, passing in `NULL` as the task queue will make the task get added to the global task queue.
* An implementation on `WinMain` that performs the above GDK setup (you should link against SDL2main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
* An implementation on `WinMain` that performs the above GDK setup (you should link against SDL2main.lib, as in Windows x64). If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters. * 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).
* What doesn't work:
* Single-player games have some additional features available: * Compilation with anything other than through the included Visual C++ solution file
* Call `SDL_GDKGetDefaultUser` to get the default XUserHandle pointer.
* `SDL_GetPrefPath` still works, but only for single-player titles. ## VisualC-GDK Solution
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! The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration:
* What doesn't work: * SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64.
* Compilation with anything other than through the included Visual C++ solution file * SDL2main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs.
* tests/testgamecontroller - Standard SDL test program demonstrating controller functionality.
## VisualC-GDK Solution * tests/testgdk - GDK-specific test program that demonstrates using the global task queue to login a user into Xbox Live.
*NOTE*: As of the June 2022 GDK, you cannot test user logins without a valid Title ID and MSAAppId. You will need to manually change the identifiers in the `MicrosoftGame.config` to your valid IDs from Partner Center if you wish to test this.
The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration: * tests/testsprite2 - Standard SDL test program demonstrating sprite drawing functionality.
* SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64. If you set one of the test programs as a startup project, you can run it directly from Visual Studio.
* SDL2main (lib) - This contains a drop-in implementation of `WinMain` that is used as the entry point for GDK programs.
* tests/testgamecontroller - Standard SDL test program demonstrating controller functionality. Windows GDK Setup, Detailed Steps
* tests/testgdk - GDK-specific test program that demonstrates using the global task queue to login a user into Xbox Live. ---------------------
*NOTE*: As of the June 2022 GDK, you cannot test user logins without a valid Title ID and MSAAppId. You will need to manually change the identifiers in the `MicrosoftGame.config` to your valid IDs from Partner Center if you wish to test this.
* tests/testsprite2 - Standard SDL test program demonstrating sprite drawing functionality. These steps assume you already have a game using SDL that runs on Windows x64 along with a corresponding Visual Studio solution file for the x64 version. If you don't have this, it's easiest to use one of the test program vcxproj files in the `VisualC-GDK` directory as a starting point, though you will still need to do most of the steps below.
If you set one of the test programs as a startup project, you can run it directly from Visual Studio. ### 1. Add a Gaming.Desktop.x64 Configuration ###
Windows GDK Setup, Detailed Steps In your game's existing Visual Studio Solution, go to Build > Configuration Manager. From the "Active solution platform" drop-down select "New...". From the drop-down list, select Gaming.Desktop.x64 and copy the settings from the x64 configuration.
---------------------
### 2. Build SDL2 and SDL2main for GDK ###
These steps assume you already have a game using SDL that runs on Windows x64 along with a corresponding Visual Studio solution file for the x64 version. If you don't have this, it's easiest to use one of the test program vcxproj files in the `VisualC-GDK` directory as a starting point, though you will still need to do most of the steps below.
Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project.
### 1. Add a Gaming.Desktop.x64 Configuration ###
*Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built.
In your game's existing Visual Studio Solution, go to Build > Configuration Manager. From the "Active solution platform" drop-down select "New...". From the drop-down list, select Gaming.Desktop.x64 and copy the settings from the x64 configuration.
### 3. Configuring Project Settings ###
### 2. Build SDL2 and SDL2main for GDK ###
While the Gaming.Desktop.x64 configuration sets most of the required settings, there are some additional items to configure for your game project under the Gaming.Desktop.x64 Configuration:
Open `VisualC-GDK/SDL.sln` in Visual Studio, you need to build the SDL2 and SDL2main targets for the Gaming.Desktop.x64 platform (Release is recommended). You will need to copy/keep track of the `SDL2.dll`, `XCurl.dll` (which is output by Gaming.Desktop.x64), `SDL2.lib`, and `SDL2main.lib` output files for your game project.
* Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced
*Alternatively*, you could setup your solution file to instead reference the SDL2/SDL2main project file targets from the SDL source, and add those projects as a dependency. This would mean that SDL2 and SDL2main would both be built when your game is built. * Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL2.lib and SDL2main.lib are
* Under Linker > Input > Additional Dependencies, you need the following:
### 3. Configuring Project Settings ### * `SDL2.lib`
* `SDL2main.lib` (unless not using)
While the Gaming.Desktop.x64 configuration sets most of the required settings, there are some additional items to configure for your game project under the Gaming.Desktop.x64 Configuration: * `xgameruntime.lib`
* `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib`
* Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced * Note that in general, the GDK libraries depend on the MSVC C/C++ runtime, so there is no way to remove this dependency from a GDK program that links against GDK.
* Under Linker > General > Additional Library Directories, make sure to reference the path where the newly-built SDL2.lib and SDL2main.lib are
* Under Linker > Input > Additional Dependencies, you need the following: ### 4. Setting up SDL_main ###
* `SDL2.lib`
* `SDL2main.lib` (unless not using) Rather than using your own implementation of `WinMain`, it's recommended that you instead `#include "SDL_main.h"` and declare a standard main function. If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters.
* `xgameruntime.lib`
* `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib` ### 5. Required DLLs ###
* Note that in general, the GDK libraries depend on the MSVC C/C++ runtime, so there is no way to remove this dependency from a GDK program that links against GDK.
The game will not launch in the debugger unless required DLLs are included in the directory that contains the game's .exe file. You need to make sure that the following files are copied into the directory:
### 4. Setting up SDL_main ###
* Your SDL2.dll
Rather than using your own implementation of `WinMain`, it's recommended that you instead `#include "SDL_main.h"` and declare a standard main function. If you are unable to do this, you can instead manually call `SDL_GDKRunApp` from your entry point, passing in your `SDL_main` function and `NULL` as the parameters. * "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll"
* XCurl.dll
### 5. Required DLLs ###
You can either copy these in a post-build step, or you can add the dlls into the project and set its Configuration Properties > General > Item type to "Copy file," which will also copy them into the output directory.
The game will not launch in the debugger unless required DLLs are included in the directory that contains the game's .exe file. You need to make sure that the following files are copied into the directory:
### 6. Setting up MicrosoftGame.config ###
* Your SDL2.dll
* "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll" You can copy `VisualC-GDK/tests/testgdk/MicrosoftGame.config` and use that as a starting point in your project. Minimally, you will want to change the Executable Name attribute, the DefaultDisplayName, and the Description.
* XCurl.dll
This file must be copied into the same directory as the game's .exe file. As with the DLLs, you can either use a post-build step or the "Copy file" item type.
You can either copy these in a post-build step, or you can add the dlls into the project and set its Configuration Properties > General > Item type to "Copy file," which will also copy them into the output directory.
For basic testing, you do not need to change anything else in `MicrosoftGame.config`. However, if you want to test any Xbox Live services (such as logging in users) _or_ publish a package, you will need to setup a Game app on Partner Center.
### 6. Setting up MicrosoftGame.config ###
Then, you need to set the following values to the values from Partner Center:
You can copy `VisualC-GDK/tests/testgdk/MicrosoftGame.config` and use that as a starting point in your project. Minimally, you will want to change the Executable Name attribute, the DefaultDisplayName, and the Description.
* Identity tag - Name and Publisher attributes
This file must be copied into the same directory as the game's .exe file. As with the DLLs, you can either use a post-build step or the "Copy file" item type. * TitleId
* MSAAppId
For basic testing, you do not need to change anything else in `MicrosoftGame.config`. However, if you want to test any Xbox Live services (such as logging in users) _or_ publish a package, you will need to setup a Game app on Partner Center.
### 7. Adding Required Logos
Then, you need to set the following values to the values from Partner Center:
Several logo PNG files are required to be able to launch the game, even from the debugger. You can use the sample logos provided in `VisualC-GDK/logos`. As with the other files, they must be copied into the same directory as the game's .exe file.
* Identity tag - Name and Publisher attributes
* TitleId
* MSAAppId ### 8. Copying any Data Files ###
### 7. Adding Required Logos When debugging GDK games, there is no way to specify a working directory. Therefore, any required game data must also be copied into the output directory, likely in a post-build step.
Several logo PNG files are required to be able to launch the game, even from the debugger. You can use the sample logos provided in `VisualC-GDK/logos`. As with the other files, they must be copied into the same directory as the game's .exe file.
### 9. Build and Run from Visual Studio ###
### 8. Copying any Data Files ### At this point, you should be able to build and run your game from the Visual Studio Debugger. If you get any linker errors, make sure you double-check that you referenced all the required libs.
When debugging GDK games, there is no way to specify a working directory. Therefore, any required game data must also be copied into the output directory, likely in a post-build step. If you are testing Xbox Live functionality, it's likely you will need to change to the Sandbox for your title. To do this:
1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
### 9. Build and Run from Visual Studio ### 2. Switch the sandbox name with:
`XblPCSandbox SANDBOX.#`
At this point, you should be able to build and run your game from the Visual Studio Debugger. If you get any linker errors, make sure you double-check that you referenced all the required libs. 3. (To switch back to the retail sandbox):
`XblPCSandbox RETAIL`
If you are testing Xbox Live functionality, it's likely you will need to change to the Sandbox for your title. To do this:
### 10. Packaging and Installing Locally
1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
2. Switch the sandbox name with: You can use one of the test program's `PackageLayout.xml` as a starting point. Minimally, you will need to change the exe to the correct name and also reference any required game data. As with the other data files, it's easiest if you have this copy to the output directory, although it's not a requirement as you can specify relative paths to files.
`XblPCSandbox SANDBOX.#`
3. (To switch back to the retail sandbox): To create the package:
`XblPCSandbox RETAIL`
1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu
### 10. Packaging and Installing Locally 2. `cd` to the directory containing the `PackageLayout.xml` with the correct paths (if you use the local path as in the sample package layout, this would be from your .exe output directory)
3. `mkdir Package` to create an output directory
You can use one of the test program's `PackageLayout.xml` as a starting point. Minimally, you will need to change the exe to the correct name and also reference any required game data. As with the other data files, it's easiest if you have this copy to the output directory, although it's not a requirement as you can specify relative paths to files. 4. To package the file into the `Package` directory, use:
`makepkg pack /f PackageLayout.xml /lt /d . /nogameos /pc /pd Package`
To create the package: 5. To install the package, use:
`wdapp install PACKAGENAME.msixvc`
1. Run "Desktop VS 2022 Gaming Command Prompt" from the Start Menu 6. Once the package is installed, you can run it from the start menu.
2. `cd` to the directory containing the `PackageLayout.xml` with the correct paths (if you use the local path as in the sample package layout, this would be from your .exe output directory) 7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox.
3. `mkdir Package` to create an output directory
4. To package the file into the `Package` directory, use:
`makepkg pack /f PackageLayout.xml /lt /d . /nogameos /pc /pd Package` Troubleshooting
5. To install the package, use: ---------------
`wdapp install PACKAGENAME.msixvc`
6. Once the package is installed, you can run it from the start menu. #### Xbox Live Login does not work
7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox.
As of June 2022 GDK, you must have a valid Title Id and MSAAppId in order to test Xbox Live functionality such as user login. Make sure these are set correctly in the `MicrosoftGame.config`. This means that even testgdk will not let you login without setting these properties to valid values.
Xbox GDKX Setup
--------------------- Furthermore, confirm that your PC is set to the correct sandbox.
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 current user has already installed an unpackaged version of this app. A packaged version cannot replace this." error when installing
* 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) Prior to June 2022 GDK, running from the Visual Studio debugger would still locally register the app (and it would appear on the start menu). To fix this, you have to uninstall it (it's simplest to right click on it from the start menu to uninstall it).
* 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
---------------
#### Xbox Live Login does not work
As of June 2022 GDK, you must have a valid Title Id and MSAAppId in order to test Xbox Live functionality such as user login. Make sure these are set correctly in the `MicrosoftGame.config`. This means that even testgdk will not let you login without setting these properties to valid values.
Furthermore, confirm that your PC is set to the correct sandbox.
#### "The current user has already installed an unpackaged version of this app. A packaged version cannot replace this." error when installing
Prior to June 2022 GDK, running from the Visual Studio debugger would still locally register the app (and it would appear on the start menu). To fix this, you have to uninstall it (it's simplest to right click on it from the start menu to uninstall it).
+71 -71
View File
@@ -1,71 +1,71 @@
Dollar Gestures Dollar Gestures
=========================================================================== ===========================================================================
SDL provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures. SDL provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures.
Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up. Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up.
Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID. Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID.
Recording: Recording:
---------- ----------
To begin recording on a touch device call: To begin recording on a touch device call:
SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices. SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices.
Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event. Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event.
A SDL_DOLLARRECORD event is a dgesture with the following fields: A SDL_DOLLARRECORD event is a dgesture with the following fields:
* event.dgesture.touchId - the Id of the touch used to record the gesture. * event.dgesture.touchId - the Id of the touch used to record the gesture.
* event.dgesture.gestureId - the unique id of the recorded gesture. * event.dgesture.gestureId - the unique id of the recorded gesture.
Performing: Performing:
----------- -----------
As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields: As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields:
* event.dgesture.touchId - the Id of the touch which performed the gesture. * event.dgesture.touchId - the Id of the touch which performed the gesture.
* event.dgesture.gestureId - the unique id of the closest gesture to the performed stroke. * event.dgesture.gestureId - the unique id of the closest gesture to the performed stroke.
* event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is a better match. * event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is a better match.
* event.dgesture.numFingers - the number of fingers used to draw the stroke. * event.dgesture.numFingers - the number of fingers used to draw the stroke.
Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed). Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed).
Saving: Saving:
------- -------
To save a template, call SDL_SaveDollarTemplate(gestureId, dst) where gestureId is the id of the gesture you want to save, and dst is an SDL_RWops pointer to the file where the gesture will be stored. To save a template, call SDL_SaveDollarTemplate(gestureId, dst) where gestureId is the id of the gesture you want to save, and dst is an SDL_RWops pointer to the file where the gesture will be stored.
To save all currently loaded templates, call SDL_SaveAllDollarTemplates(dst) where dst is an SDL_RWops pointer to the file where the gesture will be stored. To save all currently loaded templates, call SDL_SaveAllDollarTemplates(dst) where dst is an SDL_RWops pointer to the file where the gesture will be stored.
Both functions return the number of gestures successfully saved. Both functions return the number of gestures successfully saved.
Loading: Loading:
-------- --------
To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file. To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file.
SDL_LoadDollarTemplates returns the number of templates successfully loaded. SDL_LoadDollarTemplates returns the number of templates successfully loaded.
=========================================================================== ===========================================================================
Multi Gestures Multi Gestures
=========================================================================== ===========================================================================
SDL provides simple support for pinch/rotate/swipe gestures. SDL provides simple support for pinch/rotate/swipe gestures.
Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields: Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields:
* event.mgesture.touchId - the Id of the touch on which the gesture was performed. * event.mgesture.touchId - the Id of the touch on which the gesture was performed.
* event.mgesture.x - the normalized x coordinate of the gesture. (0..1) * event.mgesture.x - the normalized x coordinate of the gesture. (0..1)
* event.mgesture.y - the normalized y coordinate of the gesture. (0..1) * event.mgesture.y - the normalized y coordinate of the gesture. (0..1)
* event.mgesture.dTheta - the amount that the fingers rotated during this motion. * event.mgesture.dTheta - the amount that the fingers rotated during this motion.
* event.mgesture.dDist - the amount that the fingers pinched during this motion. * event.mgesture.dDist - the amount that the fingers pinched during this motion.
* event.mgesture.numFingers - the number of fingers used in the gesture. * event.mgesture.numFingers - the number of fingers used in the gesture.
=========================================================================== ===========================================================================
Notes Notes
=========================================================================== ===========================================================================
For a complete example see test/testgesture.c For a complete example see test/testgesture.c
Please direct questions/comments to: Please direct questions/comments to:
jim.tla+sdl_touch@gmail.com jim.tla+sdl_touch@gmail.com
+19 -19
View File
@@ -1,19 +1,19 @@
git git
========= =========
The latest development version of SDL is available via git. The latest development version of SDL is available via git.
Git allows you to get up-to-the-minute fixes and enhancements; Git allows you to get up-to-the-minute fixes and enhancements;
as a developer works on a source tree, you can use "git" to mirror that as a developer works on a source tree, you can use "git" to mirror that
source tree instead of waiting for an official release. Please look source tree instead of waiting for an official release. Please look
at the Git website ( https://git-scm.com/ ) for more at the Git website ( https://git-scm.com/ ) for more
information on using git, where you can also download software for information on using git, where you can also download software for
macOS, Windows, and Unix systems. macOS, Windows, and Unix systems.
git clone https://github.com/libsdl-org/SDL git clone https://github.com/libsdl-org/SDL
If you are building SDL via configure, you will need to run autogen.sh If you are building SDL via configure, you will need to run autogen.sh
before running configure. before running configure.
There is a web interface to the Git repository at: There is a web interface to the Git repository at:
http://github.com/libsdl-org/SDL/ http://github.com/libsdl-org/SDL/
+4 -4
View File
@@ -1,4 +1,4 @@
We are no longer hosted in Mercurial. Please see README-git.md for details. We are no longer hosted in Mercurial. Please see README-git.md for details.
Thanks! Thanks!
+307 -307
View File
@@ -1,307 +1,307 @@
iOS iOS
====== ======
Building the Simple DirectMedia Layer for iOS 9.0+ Building the Simple DirectMedia Layer for iOS 9.0+
============================================================================== ==============================================================================
Requirements: Mac OS X 10.9 or later and the iOS 9.0 or newer SDK. Requirements: Mac OS X 10.9 or later and the iOS 9.0 or newer SDK.
Instructions: Instructions:
1. Open SDL.xcodeproj (located in Xcode/SDL) in Xcode. 1. Open SDL.xcodeproj (located in Xcode/SDL) in Xcode.
2. Select your desired target, and hit build. 2. Select your desired target, and hit build.
Using the Simple DirectMedia Layer for iOS Using the Simple DirectMedia Layer for iOS
============================================================================== ==============================================================================
1. Run Xcode and create a new project using the iOS Game template, selecting the Objective C language and Metal game technology. 1. Run Xcode and create a new project using the iOS Game template, selecting the Objective C language and Metal game technology.
2. In the main view, delete all files except for Assets and LaunchScreen 2. In the main view, delete all files except for Assets and LaunchScreen
3. Right click the project in the main view, select "Add Files...", and add the SDL project, Xcode/SDL/SDL.xcodeproj 3. Right click the project in the main view, select "Add Files...", and add the SDL project, Xcode/SDL/SDL.xcodeproj
4. Select the project in the main view, go to the "Info" tab and under "Custom iOS Target Properties" remove the line "Main storyboard file base name" 4. Select the project in the main view, go to the "Info" tab and under "Custom iOS Target Properties" remove the line "Main storyboard file base name"
5. Select the project in the main view, go to the "Build Settings" tab, select "All", and edit "Header Search Path" and drag over the SDL "Public Headers" folder from the left 5. Select the project in the main view, go to the "Build Settings" tab, select "All", and edit "Header Search Path" and drag over the SDL "Public Headers" folder from the left
6. Select the project in the main view, go to the "Build Phases" tab, select "Link Binary With Libraries", and add SDL2.framework from "Framework-iOS" 6. Select the project in the main view, go to the "Build Phases" tab, select "Link Binary With Libraries", and add SDL2.framework from "Framework-iOS"
7. Select the project in the main view, go to the "General" tab, scroll down to "Frameworks, Libraries, and Embedded Content", and select "Embed & Sign" for the SDL library. 7. Select the project in the main view, go to the "General" tab, scroll down to "Frameworks, Libraries, and Embedded Content", and select "Embed & Sign" for the SDL library.
8. In the main view, expand SDL -> Library Source -> main -> uikit and drag SDL_uikit_main.c into your game files 8. In the main view, expand SDL -> Library Source -> main -> uikit and drag SDL_uikit_main.c into your game files
9. Add the source files that you would normally have for an SDL program, making sure to have #include "SDL.h" at the top of the file containing your main() function. 9. Add the source files that you would normally have for an SDL program, making sure to have #include "SDL.h" at the top of the file containing your main() function.
10. Add any assets that your application needs. 10. Add any assets that your application needs.
11. Enjoy! 11. Enjoy!
TODO: Add information regarding App Store requirements such as icons, etc. TODO: Add information regarding App Store requirements such as icons, etc.
Notes -- Retina / High-DPI and window sizes Notes -- Retina / High-DPI and window sizes
============================================================================== ==============================================================================
Window and display mode sizes in SDL are in "screen coordinates" (or "points", Window and display mode sizes in SDL are in "screen coordinates" (or "points",
in Apple's terminology) rather than in pixels. On iOS this means that a window in Apple's terminology) rather than in pixels. On iOS this means that a window
created on an iPhone 6 will have a size in screen coordinates of 375 x 667, created on an iPhone 6 will have a size in screen coordinates of 375 x 667,
rather than a size in pixels of 750 x 1334. All iOS apps are expected to rather than a size in pixels of 750 x 1334. All iOS apps are expected to
size their content based on screen coordinates / points rather than pixels, size their content based on screen coordinates / points rather than pixels,
as this allows different iOS devices to have different pixel densities as this allows different iOS devices to have different pixel densities
(Retina versus non-Retina screens, etc.) without apps caring too much. (Retina versus non-Retina screens, etc.) without apps caring too much.
By default SDL will not use the full pixel density of the screen on By default SDL will not use the full pixel density of the screen on
Retina/high-dpi capable devices. Use the SDL_WINDOW_ALLOW_HIGHDPI flag when Retina/high-dpi capable devices. Use the SDL_WINDOW_ALLOW_HIGHDPI flag when
creating your window to enable high-dpi support. creating your window to enable high-dpi support.
When high-dpi support is enabled, SDL_GetWindowSize() and display mode sizes When high-dpi support is enabled, SDL_GetWindowSize() and display mode sizes
will still be in "screen coordinates" rather than pixels, but the window will will still be in "screen coordinates" rather than pixels, but the window will
have a much greater pixel density when the device supports it, and the have a much greater pixel density when the device supports it, and the
SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() functions (depending on SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() functions (depending on
whether raw OpenGL or the SDL_Render API is used) can be queried to determine whether raw OpenGL or the SDL_Render API is used) can be queried to determine
the size in pixels of the drawable screen framebuffer. the size in pixels of the drawable screen framebuffer.
Some OpenGL ES functions such as glViewport expect sizes in pixels rather than Some OpenGL ES functions such as glViewport expect sizes in pixels rather than
sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an
orthographic projection matrix using the size in screen coordinates orthographic projection matrix using the size in screen coordinates
(SDL_GetWindowSize()) can be used in order to display content at the same scale (SDL_GetWindowSize()) can be used in order to display content at the same scale
no matter whether a Retina device is used or not. no matter whether a Retina device is used or not.
Notes -- Application events Notes -- Application events
============================================================================== ==============================================================================
On iOS the application goes through a fixed life cycle and you will get On iOS the application goes through a fixed life cycle and you will get
notifications of state changes via application events. When these events notifications of state changes via application events. When these events
are delivered you must handle them in an event callback because the OS may are delivered you must handle them in an event callback because the OS may
not give you any processing time after the events are delivered. not give you any processing time after the events are delivered.
e.g. e.g.
int HandleAppEvents(void *userdata, SDL_Event *event) int HandleAppEvents(void *userdata, SDL_Event *event)
{ {
switch (event->type) switch (event->type)
{ {
case SDL_APP_TERMINATING: case SDL_APP_TERMINATING:
/* Terminate the app. /* Terminate the app.
Shut everything down before returning from this function. Shut everything down before returning from this function.
*/ */
return 0; return 0;
case SDL_APP_LOWMEMORY: case SDL_APP_LOWMEMORY:
/* You will get this when your app is paused and iOS wants more memory. /* You will get this when your app is paused and iOS wants more memory.
Release as much memory as possible. Release as much memory as possible.
*/ */
return 0; return 0;
case SDL_APP_WILLENTERBACKGROUND: case SDL_APP_WILLENTERBACKGROUND:
/* Prepare your app to go into the background. Stop loops, etc. /* Prepare your app to go into the background. Stop loops, etc.
This gets called when the user hits the home button, or gets a call. This gets called when the user hits the home button, or gets a call.
*/ */
return 0; return 0;
case SDL_APP_DIDENTERBACKGROUND: case SDL_APP_DIDENTERBACKGROUND:
/* This will get called if the user accepted whatever sent your app to the background. /* This will get called if the user accepted whatever sent your app to the background.
If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops. If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops.
When you get this, you have 5 seconds to save all your state or the app will be terminated. When you get this, you have 5 seconds to save all your state or the app will be terminated.
Your app is NOT active at this point. Your app is NOT active at this point.
*/ */
return 0; return 0;
case SDL_APP_WILLENTERFOREGROUND: case SDL_APP_WILLENTERFOREGROUND:
/* This call happens when your app is coming back to the foreground. /* This call happens when your app is coming back to the foreground.
Restore all your state here. Restore all your state here.
*/ */
return 0; return 0;
case SDL_APP_DIDENTERFOREGROUND: case SDL_APP_DIDENTERFOREGROUND:
/* Restart your loops here. /* Restart your loops here.
Your app is interactive and getting CPU again. Your app is interactive and getting CPU again.
*/ */
return 0; return 0;
default: default:
/* No special processing, add it to the event queue */ /* No special processing, add it to the event queue */
return 1; return 1;
} }
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
SDL_SetEventFilter(HandleAppEvents, NULL); SDL_SetEventFilter(HandleAppEvents, NULL);
... run your main loop ... run your main loop
return 0; return 0;
} }
Notes -- Accelerometer as Joystick Notes -- Accelerometer as Joystick
============================================================================== ==============================================================================
SDL for iPhone supports polling the built in accelerometer as a joystick device. For an example on how to do this, see the accelerometer.c in the demos directory. SDL for iPhone supports polling the built in accelerometer as a joystick device. For an example on how to do this, see the accelerometer.c in the demos directory.
The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis() reports joystick values as signed integers. Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver. To convert SDL_JoystickGetAxis() reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF. The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis() reports joystick values as signed integers. Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver. To convert SDL_JoystickGetAxis() reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF.
Notes -- OpenGL ES Notes -- OpenGL ES
============================================================================== ==============================================================================
Your SDL application for iOS uses OpenGL ES for video by default. Your SDL application for iOS uses OpenGL ES for video by default.
OpenGL ES for iOS supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute(). OpenGL ES for iOS supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute().
If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0. If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0.
Finally, if your application completely redraws the screen each frame, you may find significant performance improvement by setting the attribute SDL_GL_RETAINED_BACKING to 0. Finally, if your application completely redraws the screen each frame, you may find significant performance improvement by setting the attribute SDL_GL_RETAINED_BACKING to 0.
OpenGL ES on iOS doesn't use the traditional system-framebuffer setup provided in other operating systems. Special care must be taken because of this: OpenGL ES on iOS doesn't use the traditional system-framebuffer setup provided in other operating systems. Special care must be taken because of this:
- The drawable Renderbuffer must be bound to the GL_RENDERBUFFER binding point when SDL_GL_SwapWindow() is called. - The drawable Renderbuffer must be bound to the GL_RENDERBUFFER binding point when SDL_GL_SwapWindow() is called.
- The drawable Framebuffer Object must be bound while rendering to the screen and when SDL_GL_SwapWindow() is called. - The drawable Framebuffer Object must be bound while rendering to the screen and when SDL_GL_SwapWindow() is called.
- If multisample antialiasing (MSAA) is used and glReadPixels is used on the screen, the drawable framebuffer must be resolved to the MSAA resolve framebuffer (via glBlitFramebuffer or glResolveMultisampleFramebufferAPPLE), and the MSAA resolve framebuffer must be bound to the GL_READ_FRAMEBUFFER binding point, before glReadPixels is called. - If multisample antialiasing (MSAA) is used and glReadPixels is used on the screen, the drawable framebuffer must be resolved to the MSAA resolve framebuffer (via glBlitFramebuffer or glResolveMultisampleFramebufferAPPLE), and the MSAA resolve framebuffer must be bound to the GL_READ_FRAMEBUFFER binding point, before glReadPixels is called.
The above objects can be obtained via SDL_GetWindowWMInfo() (in SDL_syswm.h). The above objects can be obtained via SDL_GetWindowWMInfo() (in SDL_syswm.h).
Notes -- Keyboard Notes -- Keyboard
============================================================================== ==============================================================================
The SDL keyboard API has been extended to support on-screen keyboards: The SDL keyboard API has been extended to support on-screen keyboards:
void SDL_StartTextInput() void SDL_StartTextInput()
-- enables text events and reveals the onscreen keyboard. -- enables text events and reveals the onscreen keyboard.
void SDL_StopTextInput() void SDL_StopTextInput()
-- disables text events and hides the onscreen keyboard. -- disables text events and hides the onscreen keyboard.
SDL_bool SDL_IsTextInputActive() SDL_bool SDL_IsTextInputActive()
-- returns whether or not text events are enabled (and the onscreen keyboard is visible) -- returns whether or not text events are enabled (and the onscreen keyboard is visible)
Notes -- Mouse Notes -- Mouse
============================================================================== ==============================================================================
iOS now supports Bluetooth mice on iPad, but by default will provide the mouse input as touch. In order for SDL to see the real mouse events, you should set the key UIApplicationSupportsIndirectInputEvents to true in your Info.plist iOS now supports Bluetooth mice on iPad, but by default will provide the mouse input as touch. In order for SDL to see the real mouse events, you should set the key UIApplicationSupportsIndirectInputEvents to true in your Info.plist
Notes -- Reading and Writing files Notes -- Reading and Writing files
============================================================================== ==============================================================================
Each application installed on iPhone resides in a sandbox which includes its own Application Home directory. Your application may not access files outside this directory. Each application installed on iPhone resides in a sandbox which includes its own Application Home directory. Your application may not access files outside this directory.
Once your application is installed its directory tree looks like: Once your application is installed its directory tree looks like:
MySDLApp Home/ MySDLApp Home/
MySDLApp.app MySDLApp.app
Documents/ Documents/
Library/ Library/
Preferences/ Preferences/
tmp/ tmp/
When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored. You cannot write to this directory. Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences". When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored. You cannot write to this directory. Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences".
More information on this subject is available here: More information on this subject is available here:
http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html
Notes -- xcFramework Notes -- xcFramework
============================================================================== ==============================================================================
The SDL.xcodeproj file now includes a target to build SDL2.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform. The SDL.xcodeproj file now includes a target to build SDL2.xcframework. An xcframework is a new (Xcode 11) uber-framework which can handle any combination of processor type and target OS platform.
In the past, iOS devices were always an ARM variant processor, and the simulator was always i386 or x86_64, and thus libraries could be combined into a single framework for both simulator and device. With the introduction of the Apple Silicon ARM-based machines, regular frameworks would collide as CPU type was no longer sufficient to differentiate the platform. So Apple created the new xcframework library package. In the past, iOS devices were always an ARM variant processor, and the simulator was always i386 or x86_64, and thus libraries could be combined into a single framework for both simulator and device. With the introduction of the Apple Silicon ARM-based machines, regular frameworks would collide as CPU type was no longer sufficient to differentiate the platform. So Apple created the new xcframework library package.
The xcframework target builds into a Products directory alongside the SDL.xcodeproj file, as SDL2.xcframework. This can be brought in to any iOS project and will function properly for both simulator and device, no matter their CPUs. Note that Intel Macs cannot cross-compile for Apple Silicon Macs. If you need AS compatibility, perform this build on an Apple Silicon Mac. The xcframework target builds into a Products directory alongside the SDL.xcodeproj file, as SDL2.xcframework. This can be brought in to any iOS project and will function properly for both simulator and device, no matter their CPUs. Note that Intel Macs cannot cross-compile for Apple Silicon Macs. If you need AS compatibility, perform this build on an Apple Silicon Mac.
This target requires Xcode 11 or later. The target will simply fail to build if attempted on older Xcodes. This target requires Xcode 11 or later. The target will simply fail to build if attempted on older Xcodes.
In addition, on Apple platforms, main() cannot be in a dynamically loaded library. This means that iOS apps which used the statically-linked libSDL2.lib and now link with the xcframwork will need to define their own main() to call SDL_UIKitRunApp(), like this: In addition, on Apple platforms, main() cannot be in a dynamically loaded library. This means that iOS apps which used the statically-linked libSDL2.lib and now link with the xcframwork will need to define their own main() to call SDL_UIKitRunApp(), like this:
#ifndef SDL_MAIN_HANDLED #ifndef SDL_MAIN_HANDLED
#ifdef main #ifdef main
#undef main #undef main
#endif #endif
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
return SDL_UIKitRunApp(argc, argv, SDL_main); return SDL_UIKitRunApp(argc, argv, SDL_main);
} }
#endif /* !SDL_MAIN_HANDLED */ #endif /* !SDL_MAIN_HANDLED */
Using an xcFramework is similar to using a regular framework. However, issues have been seen with the build system not seeing the headers in the xcFramework. To remedy this, add the path to the xcFramework in your app's target ==> Build Settings ==> Framework Search Paths and mark it recursive (this is critical). Also critical is to remove "*.framework" from Build Settings ==> Sub-Directories to Exclude in Recursive Searches. Clean the build folder, and on your next build the build system should be able to see any of these in your code, as expected: Using an xcFramework is similar to using a regular framework. However, issues have been seen with the build system not seeing the headers in the xcFramework. To remedy this, add the path to the xcFramework in your app's target ==> Build Settings ==> Framework Search Paths and mark it recursive (this is critical). Also critical is to remove "*.framework" from Build Settings ==> Sub-Directories to Exclude in Recursive Searches. Clean the build folder, and on your next build the build system should be able to see any of these in your code, as expected:
#include "SDL_main.h" #include "SDL_main.h"
#include <SDL.h> #include <SDL.h>
#include <SDL_main.h> #include <SDL_main.h>
Notes -- iPhone SDL limitations Notes -- iPhone SDL limitations
============================================================================== ==============================================================================
Windows: Windows:
Full-size, single window applications only. You cannot create multi-window SDL applications for iPhone OS. The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow() the flag SDL_WINDOW_BORDERLESS). Full-size, single window applications only. You cannot create multi-window SDL applications for iPhone OS. The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow() the flag SDL_WINDOW_BORDERLESS).
Textures: Textures:
The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats. The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats.
Loading Shared Objects: Loading Shared Objects:
This is disabled by default since it seems to break the terms of the iOS SDK agreement for iOS versions prior to iOS 8. It can be re-enabled in SDL_config_iphoneos.h. This is disabled by default since it seems to break the terms of the iOS SDK agreement for iOS versions prior to iOS 8. It can be re-enabled in SDL_config_iphoneos.h.
Notes -- CoreBluetooth.framework Notes -- CoreBluetooth.framework
============================================================================== ==============================================================================
SDL_JOYSTICK_HIDAPI is disabled by default. It can give you access to a lot SDL_JOYSTICK_HIDAPI is disabled by default. It can give you access to a lot
more game controller devices, but it requires permission from the user before more game controller devices, but it requires permission from the user before
your app will be able to talk to the Bluetooth hardware. "Made For iOS" your app will be able to talk to the Bluetooth hardware. "Made For iOS"
branded controllers do not need this as we don't have to speak to them branded controllers do not need this as we don't have to speak to them
directly with raw bluetooth, so many apps can live without this. directly with raw bluetooth, so many apps can live without this.
You'll need to link with CoreBluetooth.framework and add something like this You'll need to link with CoreBluetooth.framework and add something like this
to your Info.plist: to your Info.plist:
<key>NSBluetoothPeripheralUsageDescription</key> <key>NSBluetoothPeripheralUsageDescription</key>
<string>MyApp would like to remain connected to nearby bluetooth Game Controllers and Game Pads even when you're not using the app.</string> <string>MyApp would like to remain connected to nearby bluetooth Game Controllers and Game Pads even when you're not using the app.</string>
Game Center 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, void (*callback)(void*), 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.
e.g. e.g.
extern "C" extern "C"
void ShowFrame(void*) void ShowFrame(void*)
{ {
... do event handling, frame logic and rendering ... ... do event handling, frame logic and rendering ...
} }
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
... 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();
// Set up the game to run in the window animation callback on iOS // Set up the game to run in the window animation callback on iOS
// so that Game Center and so forth works correctly. // so that Game Center and so forth works correctly.
SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL); SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL);
#else #else
while ( running ) { while ( running ) {
ShowFrame(0); ShowFrame(0);
DelayFrame(); DelayFrame();
} }
#endif #endif
return 0; return 0;
} }
Deploying to older versions of iOS Deploying to older versions of iOS
============================================================================== ==============================================================================
SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0 SDL supports deploying to older versions of iOS than are supported by the latest version of Xcode, all the way back to iOS 8.0
In order to do that you need to download an older version of Xcode: In order to do that you need to download an older version of Xcode:
https://developer.apple.com/download/more/?name=Xcode https://developer.apple.com/download/more/?name=Xcode
Open the package contents of the older Xcode and your newer version of Xcode and copy over the folders in Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport Open the package contents of the older Xcode and your newer version of Xcode and copy over the folders in Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
Then open the file Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist and add the versions of iOS you want to deploy to the key Root/DefaultProperties/DEPLOYMENT_TARGET_SUGGESTED_VALUES Then open the file Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/SDKSettings.plist and add the versions of iOS you want to deploy to the key Root/DefaultProperties/DEPLOYMENT_TARGET_SUGGESTED_VALUES
Open your project and set your deployment target to the desired version of iOS Open your project and set your deployment target to the desired version of iOS
Finally, remove GameController from the list of frameworks linked by your application and edit the build settings for "Other Linker Flags" and add -weak_framework GameController Finally, remove GameController from the list of frameworks linked by your application and edit the build settings for "Other Linker Flags" and add -weak_framework GameController
+27 -27
View File
@@ -1,27 +1,27 @@
KMSDRM on *BSD KMSDRM on *BSD
================================================== ==================================================
KMSDRM is supported on FreeBSD and OpenBSD. DragonFlyBSD works but requires being a root user. NetBSD isn't supported yet because the application will crash when creating the KMSDRM screen. KMSDRM is supported on FreeBSD and OpenBSD. DragonFlyBSD works but requires being a root user. NetBSD isn't supported yet because the application will crash when creating the KMSDRM screen.
WSCONS support has been brought back, but only as an input backend. It will not be brought back as a video backend to ease maintenance. WSCONS support has been brought back, but only as an input backend. It will not be brought back as a video backend to ease maintenance.
OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices. OpenBSD note: Note that the video backend assumes that the user has read/write permissions to the /dev/drm* devices.
SDL2 WSCONS input backend features SDL2 WSCONS input backend features
=================================================== ===================================================
1. It is keymap-aware; it will work properly with different keymaps. 1. It is keymap-aware; it will work properly with different keymaps.
2. It has mouse support. 2. It has mouse support.
3. Accent input is supported. 3. Accent input is supported.
4. Compose keys are supported. 4. Compose keys are supported.
5. AltGr and Meta Shift keys work as intended. 5. AltGr and Meta Shift keys work as intended.
Partially working or no input on OpenBSD/NetBSD. Partially working or no input on OpenBSD/NetBSD.
================================================== ==================================================
The WSCONS input backend needs read/write access to the /dev/wskbd* devices, without which it will not work properly. /dev/wsmouse must also be read/write accessible, otherwise mouse input will not work. The WSCONS input backend needs read/write access to the /dev/wskbd* devices, without which it will not work properly. /dev/wsmouse must also be read/write accessible, otherwise mouse input will not work.
Partially working or no input on FreeBSD. Partially working or no input on FreeBSD.
================================================== ==================================================
The evdev devices are only accessible to the root user by default. Edit devfs rules to allow access to such devices. The /dev/kbd* devices are also only accessible to the root user by default. Edit devfs rules to allow access to such devices. The evdev devices are only accessible to the root user by default. Edit devfs rules to allow access to such devices. The /dev/kbd* devices are also only accessible to the root user by default. Edit devfs rules to allow access to such devices.
+96 -96
View File
@@ -1,96 +1,96 @@
Linux Linux
================================================================================ ================================================================================
By default SDL will only link against glibc, the rest of the features will be By default SDL will only link against glibc, the rest of the features will be
enabled dynamically at runtime depending on the available features on the target enabled dynamically at runtime depending on the available features on the target
system. So, for example if you built SDL with XRandR support and the target system. So, for example if you built SDL with XRandR support and the target
system does not have the XRandR libraries installed, it will be disabled system does not have the XRandR libraries installed, it will be disabled
at runtime, and you won't get a missing library error, at least with the at runtime, and you won't get a missing library error, at least with the
default configuration parameters. default configuration parameters.
Build Dependencies Build Dependencies
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Ubuntu 18.04, all available features enabled: Ubuntu 18.04, all available features enabled:
sudo apt-get install build-essential git make autoconf automake libtool \ sudo apt-get install build-essential git make autoconf automake libtool \
pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \ pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \ libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \ libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \ libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
Ubuntu 22.04+ can also add `libpipewire-0.3-dev libdecor-0-dev` to that command line. Ubuntu 22.04+ can also add `libpipewire-0.3-dev libdecor-0-dev` to that command line.
Fedora 35, all available features enabled: Fedora 35, all available features enabled:
sudo yum install gcc git-core make cmake autoconf automake libtool \ sudo yum install gcc git-core make cmake autoconf automake libtool \
alsa-lib-devel pulseaudio-libs-devel nas-devel pipewire-devel \ alsa-lib-devel pulseaudio-libs-devel nas-devel pipewire-devel \
libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel \ libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel \
libXi-devel libXScrnSaver-devel dbus-devel ibus-devel fcitx-devel \ libXi-devel libXScrnSaver-devel dbus-devel ibus-devel fcitx-devel \
systemd-devel mesa-libGL-devel libxkbcommon-devel mesa-libGLES-devel \ systemd-devel mesa-libGL-devel libxkbcommon-devel mesa-libGLES-devel \
mesa-libEGL-devel vulkan-devel wayland-devel wayland-protocols-devel \ mesa-libEGL-devel vulkan-devel wayland-devel wayland-protocols-devel \
libdrm-devel mesa-libgbm-devel libusb-devel libdecor-devel \ libdrm-devel mesa-libgbm-devel libusb-devel libdecor-devel \
libsamplerate-devel pipewire-jack-audio-connection-kit-devel \ libsamplerate-devel pipewire-jack-audio-connection-kit-devel \
NOTES: NOTES:
- This includes all the audio targets except arts and esd, because Ubuntu - This includes all the audio targets except arts and esd, because Ubuntu
(and/or Debian) pulled their packages, but in theory SDL still supports them. (and/or Debian) pulled their packages, but in theory SDL still supports them.
The sndio audio target is also unavailable on Fedora. The sndio audio target is also unavailable on Fedora.
- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime - libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
for higher-quality audio resampling. SDL will work without it if the library for higher-quality audio resampling. SDL will work without it if the library
is missing, so it's safe to build in support even if the end user doesn't is missing, so it's safe to build in support even if the end user doesn't
have this library installed. have this library installed.
- DirectFB isn't included because the configure script (currently) fails to find - DirectFB isn't included because the configure script (currently) fails to find
it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the
configure script to include DirectFB support. Send patches. :) configure script to include DirectFB support. Send patches. :)
Joystick does not work Joystick does not work
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
If you compiled or are using a version of SDL with udev support (and you should!) If you compiled or are using a version of SDL with udev support (and you should!)
there's a few issues that may cause SDL to fail to detect your joystick. To there's a few issues that may cause SDL to fail to detect your joystick. To
debug this, start by installing the evtest utility. On Ubuntu/Debian: debug this, start by installing the evtest utility. On Ubuntu/Debian:
sudo apt-get install evtest sudo apt-get install evtest
Then run: Then run:
sudo evtest sudo evtest
You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX" You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX"
Now run: Now run:
cat /dev/input/event/XX cat /dev/input/event/XX
If you get a permission error, you need to set a udev rule to change the mode of If you get a permission error, you need to set a udev rule to change the mode of
your device (see below) your device (see below)
Also, try: Also, try:
sudo udevadm info --query=all --name=input/eventXX sudo udevadm info --query=all --name=input/eventXX
If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it, If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it,
you need to set up an udev rule to force this variable. you need to set up an udev rule to force this variable.
A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks
like: like:
SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1" SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1" SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1"
You can set up similar rules for your device by changing the values listed in You can set up similar rules for your device by changing the values listed in
idProduct and idVendor. To obtain these values, try: idProduct and idVendor. To obtain these values, try:
sudo udevadm info -a --name=input/eventXX | grep idVendor sudo udevadm info -a --name=input/eventXX | grep idVendor
sudo udevadm info -a --name=input/eventXX | grep idProduct sudo udevadm info -a --name=input/eventXX | grep idProduct
If multiple values come up for each of these, the one you want is the first one of each. If multiple values come up for each of these, the one you want is the first one of each.
On other systems which ship with an older udev (such as CentOS), you may need On other systems which ship with an older udev (such as CentOS), you may need
to set up a rule such as: to set up a rule such as:
SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1" SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1"
+285 -285
View File
@@ -1,285 +1,285 @@
# Mac OS X (aka macOS). # Mac OS X (aka macOS).
These instructions are for people using Apple's Mac OS X (pronounced These instructions are for people using Apple's Mac OS X (pronounced
"ten"), which in newer versions is just referred to as "macOS". "ten"), which in newer versions is just referred to as "macOS".
From the developer's point of view, macOS is a sort of hybrid Mac and From the developer's point of view, macOS is a sort of hybrid Mac and
Unix system, and you have the option of using either traditional Unix system, and you have the option of using either traditional
command line tools or Apple's IDE Xcode. command line tools or Apple's IDE Xcode.
# Command Line Build # Command Line Build
To build SDL using the command line, use the standard configure and make To build SDL using the command line, use the standard configure and make
process: process:
```bash ```bash
mkdir build mkdir build
cd build cd build
../configure ../configure
make make
sudo make install sudo make install
``` ```
CMake is also known to work, although it continues to be a work in progress: CMake is also known to work, although it continues to be a work in progress:
```bash ```bash
mkdir build mkdir build
cd build cd build
cmake -DCMAKE_BUILD_TYPE=Release .. cmake -DCMAKE_BUILD_TYPE=Release ..
make make
sudo make install sudo make install
``` ```
You can also build SDL as a Universal library (a single binary for both You can also build SDL as a Universal library (a single binary for both
64-bit Intel and ARM architectures), by using the build-scripts/clang-fat.sh 64-bit Intel and ARM architectures), by using the build-scripts/clang-fat.sh
script. script.
```bash ```bash
mkdir build mkdir build
cd build cd build
CC=$PWD/../build-scripts/clang-fat.sh ../configure CC=$PWD/../build-scripts/clang-fat.sh ../configure
make make
sudo make install sudo make install
``` ```
This script builds SDL with 10.9 ABI compatibility on 64-bit Intel and 11.0 This script builds SDL with 10.9 ABI compatibility on 64-bit Intel and 11.0
ABI compatibility on ARM64 architectures. For best compatibility you ABI compatibility on ARM64 architectures. For best compatibility you
should compile your application the same way. should compile your application the same way.
Please note that building SDL requires at least Xcode 6 and the 10.9 SDK. Please note that building SDL requires at least Xcode 6 and the 10.9 SDK.
PowerPC support for macOS has been officially dropped as of SDL 2.0.2. PowerPC support for macOS has been officially dropped as of SDL 2.0.2.
32-bit Intel and macOS 10.8 runtime support has been officially dropped as 32-bit Intel and macOS 10.8 runtime support has been officially dropped as
of SDL 2.24.0. of SDL 2.24.0.
To use the library once it's built, you essential have two possibilities: To use the library once it's built, you essential have two possibilities:
use the traditional autoconf/automake/make method, or use Xcode. use the traditional autoconf/automake/make method, or use Xcode.
# Caveats for using SDL with Mac OS X # Caveats for using SDL with Mac OS X
If you register your own NSApplicationDelegate (using [NSApp setDelegate:]), If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
SDL will not register its own. This means that SDL will not terminate using SDL will not register its own. This means that SDL will not terminate using
SDL_Quit if it receives a termination request, it will terminate like a SDL_Quit if it receives a termination request, it will terminate like a
normal app, and it will not send a SDL_DROPFILE when you request to open a normal app, and it will not send a SDL_DROPFILE when you request to open a
file with the app. To solve these issues, put the following code in your file with the app. To solve these issues, put the following code in your
NSApplicationDelegate implementation: NSApplicationDelegate implementation:
```objc ```objc
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{ {
if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) { if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
SDL_Event event; SDL_Event event;
event.type = SDL_QUIT; event.type = SDL_QUIT;
SDL_PushEvent(&event); SDL_PushEvent(&event);
} }
return NSTerminateCancel; return NSTerminateCancel;
} }
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{ {
if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) { if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
SDL_Event event; SDL_Event event;
event.type = SDL_DROPFILE; event.type = SDL_DROPFILE;
event.drop.file = SDL_strdup([filename UTF8String]); event.drop.file = SDL_strdup([filename UTF8String]);
return (SDL_PushEvent(&event) > 0); return (SDL_PushEvent(&event) > 0);
} }
return NO; return NO;
} }
``` ```
# Using the Simple DirectMedia Layer with a traditional Makefile # Using the Simple DirectMedia Layer with a traditional Makefile
An existing autoconf/automake build system for your SDL app has good chances An existing autoconf/automake build system for your SDL app has good chances
to work almost unchanged on macOS. However, to produce a "real" Mac binary to work almost unchanged on macOS. However, to produce a "real" Mac binary
that you can distribute to users, you need to put the generated binary into a that you can distribute to users, you need to put the generated binary into a
so called "bundle", which is basically a fancy folder with a name like so called "bundle", which is basically a fancy folder with a name like
"MyCoolGame.app". "MyCoolGame.app".
To get this build automatically, add something like the following rule to To get this build automatically, add something like the following rule to
your Makefile.am: your Makefile.am:
```make ```make
bundle_contents = APP_NAME.app/Contents bundle_contents = APP_NAME.app/Contents
APP_NAME_bundle: EXE_NAME APP_NAME_bundle: EXE_NAME
mkdir -p $(bundle_contents)/MacOS mkdir -p $(bundle_contents)/MacOS
mkdir -p $(bundle_contents)/Resources mkdir -p $(bundle_contents)/Resources
echo "APPL????" > $(bundle_contents)/PkgInfo echo "APPL????" > $(bundle_contents)/PkgInfo
$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/ $(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
``` ```
You should replace `EXE_NAME` with the name of the executable. `APP_NAME` is You should replace `EXE_NAME` with the name of the executable. `APP_NAME` is
what will be visible to the user in the Finder. Usually it will be the same what will be visible to the user in the Finder. Usually it will be the same
as `EXE_NAME` but capitalized. E.g. if `EXE_NAME` is "testgame" then `APP_NAME` as `EXE_NAME` but capitalized. E.g. if `EXE_NAME` is "testgame" then `APP_NAME`
usually is "TestGame". You might also want to use `@PACKAGE@` to use the usually is "TestGame". You might also want to use `@PACKAGE@` to use the
package name as specified in your configure.ac file. package name as specified in your configure.ac file.
If your project builds more than one application, you will have to do a bit If your project builds more than one application, you will have to do a bit
more. For each of your target applications, you need a separate rule. more. For each of your target applications, you need a separate rule.
If you want the created bundles to be installed, you may want to add this If you want the created bundles to be installed, you may want to add this
rule to your Makefile.am: rule to your Makefile.am:
```make ```make
install-exec-hook: APP_NAME_bundle install-exec-hook: APP_NAME_bundle
rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
mkdir -p $(DESTDIR)$(prefix)/Applications/ mkdir -p $(DESTDIR)$(prefix)/Applications/
cp -r $< /$(DESTDIR)$(prefix)Applications/ cp -r $< /$(DESTDIR)$(prefix)Applications/
``` ```
This rule takes the Bundle created by the rule from step 3 and installs them This rule takes the Bundle created by the rule from step 3 and installs them
into "$(DESTDIR)$(prefix)/Applications/". into "$(DESTDIR)$(prefix)/Applications/".
Again, if you want to install multiple applications, you will have to augment Again, if you want to install multiple applications, you will have to augment
the make rule accordingly. the make rule accordingly.
But beware! That is only part of the story! With the above, you end up with But beware! That is only part of the story! With the above, you end up with
a barebones .app bundle, which is double-clickable from the Finder. But a barebones .app bundle, which is double-clickable from the Finder. But
there are some more things you should do before shipping your product... there are some more things you should do before shipping your product...
1. The bundle right now probably is dynamically linked against SDL. That 1. The bundle right now probably is dynamically linked against SDL. That
means that when you copy it to another computer, *it will not run*, means that when you copy it to another computer, *it will not run*,
unless you also install SDL on that other computer. A good solution unless you also install SDL on that other computer. A good solution
for this dilemma is to static link against SDL. On OS X, you can for this dilemma is to static link against SDL. On OS X, you can
achieve that by linking against the libraries listed by achieve that by linking against the libraries listed by
```bash ```bash
sdl-config --static-libs sdl-config --static-libs
``` ```
instead of those listed by instead of those listed by
```bash ```bash
sdl-config --libs sdl-config --libs
``` ```
Depending on how exactly SDL is integrated into your build systems, the Depending on how exactly SDL is integrated into your build systems, the
way to achieve that varies, so I won't describe it here in detail way to achieve that varies, so I won't describe it here in detail
2. Add an 'Info.plist' to your application. That is a special XML file which 2. Add an 'Info.plist' to your application. That is a special XML file which
contains some meta-information about your application (like some copyright contains some meta-information about your application (like some copyright
information, the version of your app, the name of an optional icon file, information, the version of your app, the name of an optional icon file,
and other things). Part of that information is displayed by the Finder and other things). Part of that information is displayed by the Finder
when you click on the .app, or if you look at the "Get Info" window. when you click on the .app, or if you look at the "Get Info" window.
More information about Info.plist files can be found on Apple's homepage. More information about Info.plist files can be found on Apple's homepage.
As a final remark, let me add that I use some of the techniques (and some As a final remark, let me add that I use some of the techniques (and some
variations of them) in [Exult](https://github.com/exult/exult) and variations of them) in [Exult](https://github.com/exult/exult) and
[ScummVM](https://github.com/scummvm/scummvm); both are available in source on [ScummVM](https://github.com/scummvm/scummvm); both are available in source on
the net, so feel free to take a peek at them for inspiration! the net, so feel free to take a peek at them for inspiration!
# Using the Simple DirectMedia Layer with Xcode # Using the Simple DirectMedia Layer with Xcode
These instructions are for using Apple's Xcode IDE to build SDL applications. These instructions are for using Apple's Xcode IDE to build SDL applications.
## First steps ## First steps
The first thing to do is to unpack the Xcode.tar.gz archive in the The first thing to do is to unpack the Xcode.tar.gz archive in the
top level SDL directory (where the Xcode.tar.gz archive resides). top level SDL directory (where the Xcode.tar.gz archive resides).
Because Stuffit Expander will unpack the archive into a subdirectory, Because Stuffit Expander will unpack the archive into a subdirectory,
you should unpack the archive manually from the command line: you should unpack the archive manually from the command line:
```bash ```bash
cd [path_to_SDL_source] cd [path_to_SDL_source]
tar zxf Xcode.tar.gz tar zxf Xcode.tar.gz
``` ```
This will create a new folder called Xcode, which you can browse This will create a new folder called Xcode, which you can browse
normally from the Finder. normally from the Finder.
## Building the Framework ## Building the Framework
The SDL Library is packaged as a framework bundle, an organized The SDL Library is packaged as a framework bundle, an organized
relocatable folder hierarchy of executable code, interface headers, relocatable folder hierarchy of executable code, interface headers,
and additional resources. For practical purposes, you can think of a and additional resources. For practical purposes, you can think of a
framework as a more user and system-friendly shared library, whose library framework as a more user and system-friendly shared library, whose library
file behaves more or less like a standard UNIX shared library. file behaves more or less like a standard UNIX shared library.
To build the framework, simply open the framework project and build it. To build the framework, simply open the framework project and build it.
By default, the framework bundle "SDL.framework" is installed in By default, the framework bundle "SDL.framework" is installed in
/Library/Frameworks. Therefore, the testers and project stationary expect /Library/Frameworks. Therefore, the testers and project stationary expect
it to be located there. However, it will function the same in any of the it to be located there. However, it will function the same in any of the
following locations: following locations:
* ~/Library/Frameworks * ~/Library/Frameworks
* /Local/Library/Frameworks * /Local/Library/Frameworks
* /System/Library/Frameworks * /System/Library/Frameworks
## Build Options ## Build Options
There are two "Build Styles" (See the "Targets" tab) for SDL. There are two "Build Styles" (See the "Targets" tab) for SDL.
"Deployment" should be used if you aren't tweaking the SDL library. "Deployment" should be used if you aren't tweaking the SDL library.
"Development" should be used to debug SDL apps or the library itself. "Development" should be used to debug SDL apps or the library itself.
## Building the Testers ## Building the Testers
Open the SDLTest project and build away! Open the SDLTest project and build away!
## Using the Project Stationary ## Using the Project Stationary
Copy the stationary to the indicated folders to access it from Copy the stationary to the indicated folders to access it from
the "New Project" and "Add target" menus. What could be easier? the "New Project" and "Add target" menus. What could be easier?
## Setting up a new project by hand ## Setting up a new project by hand
Some of you won't want to use the Stationary so I'll give some tips: Some of you won't want to use the Stationary so I'll give some tips:
(this is accurate as of Xcode 12.5.) (this is accurate as of Xcode 12.5.)
* Click "File" -> "New" -> "Project... * Click "File" -> "New" -> "Project...
* Choose "macOS" and then "App" from the "Application" section. * Choose "macOS" and then "App" from the "Application" section.
* Fill out the options in the next window. User interface is "XIB" and * Fill out the options in the next window. User interface is "XIB" and
Language is "Objective-C". Language is "Objective-C".
* Remove "main.m" from your project * Remove "main.m" from your project
* Remove "MainMenu.xib" from your project * Remove "MainMenu.xib" from your project
* Remove "AppDelegates.*" from your project * Remove "AppDelegates.*" from your project
* Add "\$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path * Add "\$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
* Add "\$(HOME)/Library/Frameworks" to the frameworks search path * Add "\$(HOME)/Library/Frameworks" to the frameworks search path
* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS" * Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
* Add your files * Add your files
* Clean and build * Clean and build
## Building from command line ## Building from command line
Use `xcode-build` in the same directory as your .pbxproj file Use `xcode-build` in the same directory as your .pbxproj file
## Running your app ## Running your app
You can send command line args to your app by either invoking it from You can send command line args to your app by either invoking it from
the command line (in *.app/Contents/MacOS) or by entering them in the the command line (in *.app/Contents/MacOS) or by entering them in the
Executables" panel of the target settings. Executables" panel of the target settings.
# Implementation Notes # Implementation Notes
Some things that may be of interest about how it all works... 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. SDL2 does change the parent, but this is no longer the case in SDL 2.0. SDL2 does change the
working directory, which means it'll be whatever the command line prompt working directory, which means it'll be whatever the command line prompt
that launched the program was using, or if launched by double-clicking in that launched the program was using, or if launched by double-clicking in
the finger, 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.
## You have a Cocoa App! ## You have a Cocoa App!
Your SDL app is essentially a Cocoa application. When your app Your SDL app is essentially a Cocoa application. When your app
starts up and the libraries finish loading, a Cocoa procedure is called, starts up and the libraries finish loading, a Cocoa procedure is called,
which sets up the working directory and calls your main() method. which sets up the working directory and calls your main() method.
You are free to modify your Cocoa app with generally no consequence You are free to modify your Cocoa app with generally no consequence
to SDL. You cannot, however, easily change the SDL window itself. to SDL. You cannot, however, easily change the SDL window itself.
Functionality may be added in the future to help this. Functionality may be added in the future to help this.
# Bug reports # Bug reports
Bugs are tracked at [the GitHub issue tracker](https://github.com/libsdl-org/SDL/issues/). Bugs are tracked at [the GitHub issue tracker](https://github.com/libsdl-org/SDL/issues/).
Please feel free to report bugs there! Please feel free to report bugs there!
+28 -28
View File
@@ -1,28 +1,28 @@
# Nintendo 3DS # Nintendo 3DS
SDL port for the Nintendo 3DS [Homebrew toolchain](https://devkitpro.org/) contributed by: SDL port for the Nintendo 3DS [Homebrew toolchain](https://devkitpro.org/) contributed by:
- [Pierre Wendling](https://github.com/FtZPetruska) - [Pierre Wendling](https://github.com/FtZPetruska)
Credits to: Credits to:
- The awesome people who ported SDL to other homebrew platforms. - The awesome people who ported SDL to other homebrew platforms.
- The Devkitpro team for making all the tools necessary to achieve this. - The Devkitpro team for making all the tools necessary to achieve this.
## Building ## Building
To build for the Nintendo 3DS, make sure you have devkitARM and cmake installed and run: To build for the Nintendo 3DS, make sure you have devkitARM and cmake installed and run:
```bash ```bash
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release
cmake --build build cmake --build build
cmake --install build cmake --install build
``` ```
## Notes ## Notes
- Currently only software rendering is supported. - Currently only software rendering is supported.
- SDL2main should be used to ensure ROMFS is enabled. - SDL2main should be used to ensure ROMFS is enabled.
- By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function. - By default, the extra L2 cache and higher clock speeds of the New 2/3DS lineup are enabled. If you wish to turn it off, use `osSetSpeedupEnable(false)` in your main function.
- `SDL_GetBasePath` returns the romfs root instead of the executable's directory. - `SDL_GetBasePath` returns the romfs root instead of the executable's directory.
- The Nintendo 3DS uses a cooperative threading model on a single core, meaning a thread will never yield unless done manually through the `SDL_Delay` functions, or blocking waits (`SDL_LockMutex`, `SDL_SemWait`, `SDL_CondWait`, `SDL_WaitThread`). To avoid starving other threads, `SDL_SemTryWait` and `SDL_SemWaitTimeout` will yield if they fail to acquire the semaphore, see https://github.com/libsdl-org/SDL/pull/6776 for more information. - The Nintendo 3DS uses a cooperative threading model on a single core, meaning a thread will never yield unless done manually through the `SDL_Delay` functions, or blocking waits (`SDL_LockMutex`, `SDL_SemWait`, `SDL_CondWait`, `SDL_WaitThread`). To avoid starving other threads, `SDL_SemTryWait` and `SDL_SemWaitTimeout` will yield if they fail to acquire the semaphore, see https://github.com/libsdl-org/SDL/pull/6776 for more information.
+103 -103
View File
@@ -1,103 +1,103 @@
Native Client Native Client
================================================================================ ================================================================================
Requirements: Requirements:
* Native Client SDK (https://developer.chrome.com/native-client), * Native Client SDK (https://developer.chrome.com/native-client),
(tested with Pepper version 33 or higher). (tested with Pepper version 33 or higher).
The SDL backend for Chrome's Native Client has been tested only with the PNaCl The SDL backend for Chrome's Native Client has been tested only with the PNaCl
toolchain, which generates binaries designed to run on ARM and x86_32/64 toolchain, which generates binaries designed to run on ARM and x86_32/64
platforms. This does not mean it won't work with the other toolchains! platforms. This does not mean it won't work with the other toolchains!
================================================================================ ================================================================================
Building SDL for NaCl Building SDL for NaCl
================================================================================ ================================================================================
Set up the right environment variables (see naclbuild.sh), then configure SDL with: Set up the right environment variables (see naclbuild.sh), then configure SDL with:
configure --host=pnacl --prefix some/install/destination configure --host=pnacl --prefix some/install/destination
Then "make". Then "make".
As an example of how to create a deployable app a Makefile project is provided As an example of how to create a deployable app a Makefile project is provided
in test/nacl/Makefile, which includes some monkey patching of the common.mk file in test/nacl/Makefile, which includes some monkey patching of the common.mk file
provided by NaCl, without which linking properly to SDL won't work (the search provided by NaCl, without which linking properly to SDL won't work (the search
path can't be modified externally, so the linker won't find SDL's binaries unless path can't be modified externally, so the linker won't find SDL's binaries unless
you dump them into the SDK path, which is inconvenient). you dump them into the SDK path, which is inconvenient).
Also provided in test/nacl is the required support file, such as index.html, Also provided in test/nacl is the required support file, such as index.html,
manifest.json, etc. manifest.json, etc.
SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure. SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure.
This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem), This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem),
hiding the asynchronous nature of the browser behind the scenes...which is not the hiding the asynchronous nature of the browser behind the scenes...which is not the
same as making it disappear! same as making it disappear!
================================================================================ ================================================================================
Running tests Running tests
================================================================================ ================================================================================
Due to the nature of NaCl programs, building and running SDL tests is not as Due to the nature of NaCl programs, building and running SDL tests is not as
straightforward as one would hope. The script naclbuild.sh in build-scripts straightforward as one would hope. The script naclbuild.sh in build-scripts
automates the process and should serve as a guide for users of SDL trying to build automates the process and should serve as a guide for users of SDL trying to build
their own applications. their own applications.
Basic usage: Basic usage:
./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35) ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35)
This will build testgles2.c by default. This will build testgles2.c by default.
If you want to build a different test, for example testrendercopyex.c: If you want to build a different test, for example testrendercopyex.c:
SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35 SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35
Once the build finishes, you have to serve the contents with a web server (the Once the build finishes, you have to serve the contents with a web server (the
script will give you instructions on how to do that with Python). script will give you instructions on how to do that with Python).
================================================================================ ================================================================================
RWops and nacl_io RWops and nacl_io
================================================================================ ================================================================================
SDL_RWops work transparently with nacl_io. Two functions control the mount points: SDL_RWops work transparently with nacl_io. Two functions control the mount points:
int mount(const char* source, const char* target, int mount(const char* source, const char* target,
const char* filesystemtype, const char* filesystemtype,
unsigned long mountflags, const void *data); unsigned long mountflags, const void *data);
int umount(const char *target); int umount(const char *target);
For convenience, SDL will by default mount an httpfs tree at / before calling For convenience, SDL will by default mount an httpfs tree at / before calling
the app's main function. Such setting can be overridden by calling: the app's main function. Such setting can be overridden by calling:
umount("/"); umount("/");
And then mounting a different filesystem at / And then mounting a different filesystem at /
It's important to consider that the asynchronous nature of file operations on a It's important to consider that the asynchronous nature of file operations on a
browser is hidden from the application, effectively providing the developer with browser is hidden from the application, effectively providing the developer with
a set of blocking file operations just like you get in a regular desktop a set of blocking file operations just like you get in a regular desktop
environment, which eases the job of porting to Native Client, but also introduces environment, which eases the job of porting to Native Client, but also introduces
a set of challenges of its own, in particular when big file sizes and slow a set of challenges of its own, in particular when big file sizes and slow
connections are involved. connections are involved.
For more information on how nacl_io and mount points work, see: For more information on how nacl_io and mount points work, see:
https://developer.chrome.com/native-client/devguide/coding/nacl_io https://developer.chrome.com/native-client/devguide/coding/nacl_io
https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h
To be able to save into the directory "/save/" (like backup of game) : To be able to save into the directory "/save/" (like backup of game) :
mount("", "/save", "html5fs", 0, "type=PERSISTENT"); mount("", "/save", "html5fs", 0, "type=PERSISTENT");
And add to manifest.json : And add to manifest.json :
"permissions": [ "permissions": [
"unlimitedStorage" "unlimitedStorage"
] ]
================================================================================ ================================================================================
TODO - Known Issues TODO - Known Issues
================================================================================ ================================================================================
* Testing of all systems with a real application (something other than SDL's tests) * Testing of all systems with a real application (something other than SDL's tests)
* Key events don't seem to work properly * Key events don't seem to work properly
+44 -44
View File
@@ -1,44 +1,44 @@
Nokia N-Gage Nokia N-Gage
============ ============
SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage SDL2 port for Symbian S60v1 and v2 with a main focus on the Nokia N-Gage
(Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev). (Classic and QD) by [Michael Fitzmayer](https://github.com/mupfdev).
Compiling Compiling
--------- ---------
SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project. SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project.
The library is included in the The library is included in the
[toolchain](https://github.com/ngagesdk/ngage-toolchain) as a [toolchain](https://github.com/ngagesdk/ngage-toolchain) as a
sub-module. sub-module.
A complete example project based on SDL2 can be found in the GitHub A complete example project based on SDL2 can be found in the GitHub
account of the SDK: [Wordle](https://github.com/ngagesdk/wordle). account of the SDK: [Wordle](https://github.com/ngagesdk/wordle).
Current level of implementation Current level of implementation
------------------------------- -------------------------------
The video driver currently provides full screen video support with The video driver currently provides full screen video support with
keyboard input. keyboard input.
At the moment only the software renderer works. At the moment only the software renderer works.
Audio is not yet implemented. Audio is not yet implemented.
Acknowledgements Acknowledgements
---------------- ----------------
Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the
valuable insight into Symbian programming. Without the SDL 1.2 port valuable insight into Symbian programming. Without the SDL 1.2 port
which was specially developed for CDoom (Doom for the Nokia 9210), this which was specially developed for CDoom (Doom for the Nokia 9210), this
adaptation would not have been possible. adaptation would not have been possible.
I would like to thank my friends I would like to thank my friends
[Razvan](https://twitter.com/bewarerazvan) and [Dan [Razvan](https://twitter.com/bewarerazvan) and [Dan
Whelan](https://danwhelan.ie/), for their continuous support. Without Whelan](https://danwhelan.ie/), for their continuous support. Without
you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would
have lost my patience long ago. have lost my patience long ago.
Last but not least, I would like to thank the development team of Last but not least, I would like to thank the development team of
[EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your [EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your
patience and support in troubleshooting helped me a lot. patience and support in troubleshooting helped me a lot.
+92 -92
View File
@@ -1,92 +1,92 @@
Simple DirectMedia Layer 2 for OS/2 & eComStation Simple DirectMedia Layer 2 for OS/2 & eComStation
================================================================================ ================================================================================
SDL port for OS/2, authored by Andrey Vasilkin <digi@os2.snc.ru>, 2016 SDL port for OS/2, authored by Andrey Vasilkin <digi@os2.snc.ru>, 2016
OpenGL not supported by this port. OpenGL not supported by this port.
Additional optional environment variables: Additional optional environment variables:
SDL_AUDIO_SHARE SDL_AUDIO_SHARE
Values: 0 or 1, default is 0 Values: 0 or 1, default is 0
Initializes the device as shareable or exclusively acquired. Initializes the device as shareable or exclusively acquired.
SDL_VIDEODRIVER SDL_VIDEODRIVER
Values: DIVE or VMAN, default is DIVE Values: DIVE or VMAN, default is DIVE
Use video subsystem: Direct interface video extensions (DIVE) or Use video subsystem: Direct interface video extensions (DIVE) or
Video Manager (VMAN). Video Manager (VMAN).
You may significantly increase video output speed with OS4 kernel and patched You may significantly increase video output speed with OS4 kernel and patched
files vman.dll and dive.dll or with latest versions of ACPI support and video files vman.dll and dive.dll or with latest versions of ACPI support and video
driver Panorama. driver Panorama.
Latest versions of OS/4 kernel: Latest versions of OS/4 kernel:
http://gus.biysk.ru/os4/ http://gus.biysk.ru/os4/
(Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4) (Info: https://www.os2world.com/wiki/index.php/Phoenix_OS/4)
Patched files vman.dll and dive.dll: Patched files vman.dll and dive.dll:
http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR http://gus.biysk.ru/os4/test/pached_dll/PATCHED_DLL.RAR
Compiling: Compiling:
---------- ----------
Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see: Open Watcom 1.9 or newer is tested. For the new Open Watcom V2 fork, see:
https://github.com/open-watcom/ and https://open-watcom.github.io https://github.com/open-watcom/ and https://open-watcom.github.io
WATCOM environment variable must to be set to the Open Watcom install WATCOM environment variable must to be set to the Open Watcom install
directory. To compile, run: wmake -f Makefile.os2 directory. To compile, run: wmake -f Makefile.os2
Installing: Installing:
----------- -----------
- eComStation: - eComStation:
If you have previously installed SDL2, make a Backup copy of SDL2.dll If you have previously installed SDL2, make a Backup copy of SDL2.dll
located in D:\ecs\dll (where D: is disk on which installed eComStation). located in D:\ecs\dll (where D: is disk on which installed eComStation).
Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll Stop all programs running with SDL2. Copy SDL2.dll to D:\ecs\dll
- OS/2: - OS/2:
Copy SDL2.dll to any directory on your LIBPATH. If you have a previous Copy SDL2.dll to any directory on your LIBPATH. If you have a previous
version installed, close all SDL2 applications before replacing the old version installed, close all SDL2 applications before replacing the old
copy. Also make sure that any other older versions of DLLs are removed copy. Also make sure that any other older versions of DLLs are removed
from your system. from your system.
Joysticks in SDL2: Joysticks in SDL2:
------------------ ------------------
The joystick code in SDL2 is a direct forward-port from the SDL-1.2 version. The joystick code in SDL2 is a direct forward-port from the SDL-1.2 version.
Here is the original documentation from SDL-1.2: Here is the original documentation from SDL-1.2:
The Joystick detection only works for standard joysticks (2 buttons, 2 axes The Joystick detection only works for standard joysticks (2 buttons, 2 axes
and the like). Therefore, if you use a non-standard joystick, you should and the like). Therefore, if you use a non-standard joystick, you should
specify its features in the SDL_OS2_JOYSTICK environment variable in a batch specify its features in the SDL_OS2_JOYSTICK environment variable in a batch
file or CONFIG.SYS, so SDL applications can provide full capability to your file or CONFIG.SYS, so SDL applications can provide full capability to your
device. The syntax is: device. The syntax is:
SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS] SET SDL_OS2_JOYSTICK=[JOYSTICK_NAME] [AXES] [BUTTONS] [HATS] [BALLS]
So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls, So, it you have a Gravis GamePad with 4 axes, 2 buttons, 2 hats and 0 balls,
the line should be: the line should be:
SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0 SET SDL_OS2_JOYSTICK=Gravis_GamePad 4 2 2 0
If you want to add spaces in your joystick name, just surround it with If you want to add spaces in your joystick name, just surround it with
quotes or double-quotes: quotes or double-quotes:
SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0 SET SDL_OS2_JOYSTICK='Gravis GamePad' 4 2 2 0
or or
SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0 SET SDL_OS2_JOYSTICK="Gravis GamePad" 4 2 2 0
Note however that Balls and Hats are not supported under OS/2, and the Note however that Balls and Hats are not supported under OS/2, and the
value will be ignored... but it is wise to define these correctly because value will be ignored... but it is wise to define these correctly because
in the future those can be supported. in the future those can be supported.
Also the number of buttons is limited to 2 when using two joysticks, Also the number of buttons is limited to 2 when using two joysticks,
4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes 4 when using one joystick with 4 axes, 6 when using a joystick with 3 axes
and 8 when using a joystick with 2 axes. Notice however these are limitations and 8 when using a joystick with 2 axes. Notice however these are limitations
of the Joystick Port hardware, not OS/2. of the Joystick Port hardware, not OS/2.
+17 -17
View File
@@ -1,17 +1,17 @@
Pandora Pandora
===================================================================== =====================================================================
( http://openpandora.org/ ) ( http://openpandora.org/ )
- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES - A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES
support to work on the pandora under the framebuffer. This driver do not have support to work on the pandora under the framebuffer. This driver do not have
input support for now, so if you use it you will have to add your own control code. input support for now, so if you use it you will have to add your own control code.
The video driver name is "pandora" so if you have problem running it from The video driver name is "pandora" so if you have problem running it from
the framebuffer, try to set the following variable before starting your application : the framebuffer, try to set the following variable before starting your application :
"export SDL_VIDEODRIVER=pandora" "export SDL_VIDEODRIVER=pandora"
- OpenGL ES support was added to the x11 driver, so it's working like the normal - OpenGL ES support was added to the x11 driver, so it's working like the normal
x11 driver one with OpenGLX support, with SDL input event's etc.. x11 driver one with OpenGLX support, with SDL input event's etc..
David Carré (Cpasjuste) David Carré (Cpasjuste)
cpasjuste@gmail.com cpasjuste@gmail.com
+8 -8
View File
@@ -1,8 +1,8 @@
Platforms Platforms
========= =========
We maintain the list of supported platforms on our wiki now, and how to We maintain the list of supported platforms on our wiki now, and how to
build and install SDL for those platforms: build and install SDL for those platforms:
https://wiki.libsdl.org/Installation https://wiki.libsdl.org/Installation
+68 -68
View File
@@ -1,68 +1,68 @@
Porting Porting
======= =======
* Porting To A New Platform * Porting To A New Platform
The first thing you have to do when porting to a new platform, is look at The first thing you have to do when porting to a new platform, is look at
include/SDL_platform.h and create an entry there for your operating system. include/SDL_platform.h and create an entry there for your operating system.
The standard format is "__PLATFORM__", where PLATFORM is the name of the OS. The standard format is "__PLATFORM__", where PLATFORM is the name of the OS.
Ideally SDL_platform.h will be able to auto-detect the system it's building Ideally SDL_platform.h will be able to auto-detect the system it's building
on based on C preprocessor symbols. on based on C preprocessor symbols.
There are two basic ways of building SDL at the moment: There are two basic ways of building SDL at the moment:
1. The "UNIX" way: ./configure; make; make install 1. The "UNIX" way: ./configure; make; make install
If you have a GNUish system, then you might try this. Edit configure.ac, If you have a GNUish system, then you might try this. Edit configure.ac,
take a look at the large section labelled: take a look at the large section labelled:
"Set up the configuration based on the host platform!" "Set up the configuration based on the host platform!"
Add a section for your platform, and then re-run autogen.sh and build! Add a section for your platform, and then re-run autogen.sh and build!
2. Using an IDE: 2. Using an IDE:
If you're using an IDE or other non-configure build system, you'll probably If you're using an IDE or other non-configure build system, you'll probably
want to create a custom SDL_config.h for your platform. Edit SDL_config.h, want to create a custom SDL_config.h for your platform. Edit SDL_config.h,
add a section for your platform, and create a custom SDL_config_{platform}.h, add a section for your platform, and create a custom SDL_config_{platform}.h,
based on SDL_config_minimal.h and SDL_config.h.in based on SDL_config_minimal.h and SDL_config.h.in
Add the top level include directory to the header search path, and then add Add the top level include directory to the header search path, and then add
the following sources to the project: the following sources to the project:
src/*.c src/*.c
src/atomic/*.c src/atomic/*.c
src/audio/*.c src/audio/*.c
src/cpuinfo/*.c src/cpuinfo/*.c
src/events/*.c src/events/*.c
src/file/*.c src/file/*.c
src/haptic/*.c src/haptic/*.c
src/joystick/*.c src/joystick/*.c
src/power/*.c src/power/*.c
src/render/*.c src/render/*.c
src/render/software/*.c src/render/software/*.c
src/stdlib/*.c src/stdlib/*.c
src/thread/*.c src/thread/*.c
src/timer/*.c src/timer/*.c
src/video/*.c src/video/*.c
src/audio/disk/*.c src/audio/disk/*.c
src/audio/dummy/*.c src/audio/dummy/*.c
src/filesystem/dummy/*.c src/filesystem/dummy/*.c
src/video/dummy/*.c src/video/dummy/*.c
src/haptic/dummy/*.c src/haptic/dummy/*.c
src/joystick/dummy/*.c src/joystick/dummy/*.c
src/main/dummy/*.c src/main/dummy/*.c
src/thread/generic/*.c src/thread/generic/*.c
src/timer/dummy/*.c src/timer/dummy/*.c
src/loadso/dummy/*.c src/loadso/dummy/*.c
Once you have a working library without any drivers, you can go back to each Once you have a working library without any drivers, you can go back to each
of the major subsystems and start implementing drivers for your platform. of the major subsystems and start implementing drivers for your platform.
If you have any questions, don't hesitate to ask on the SDL mailing list: If you have any questions, don't hesitate to ask on the SDL mailing list:
http://www.libsdl.org/mailing-list.php http://www.libsdl.org/mailing-list.php
Enjoy! Enjoy!
Sam Lantinga (slouken@libsdl.org) Sam Lantinga (slouken@libsdl.org)
+51 -51
View File
@@ -1,51 +1,51 @@
PS2 PS2
====== ======
SDL2 port for the Sony Playstation 2 contributed by: SDL2 port for the Sony Playstation 2 contributed by:
- Francisco Javier Trujillo Mata - Francisco Javier Trujillo Mata
Credit to Credit to
- The guys that ported SDL to PSP & Vita because I'm taking them as reference. - The guys that ported SDL to PSP & Vita because I'm taking them as reference.
- David G. F. for helping me with several issues and tests. - David G. F. for helping me with several issues and tests.
## Building ## Building
To build SDL2 library for the PS2, make sure you have the latest PS2Dev status and run: To build SDL2 library for the PS2, make sure you have the latest PS2Dev status and run:
```bash ```bash
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake
cmake --build build cmake --build build
cmake --install build cmake --install build
``` ```
## Hints ## Hints
The PS2 port has a special Hint for having a dynamic VSYNC. The Hint is `SDL_HINT_PS2_DYNAMIC_VSYNC`. The PS2 port has a special Hint for having a dynamic VSYNC. The Hint is `SDL_HINT_PS2_DYNAMIC_VSYNC`.
If you enabled the dynamic vsync having as well `SDL_RENDERER_PRESENTVSYNC` enabled, then if the app is not able to run at 60 FPS, automatically the `vsync` will be disabled having a better performance, instead of droping FPS to 30. If you enabled the dynamic vsync having as well `SDL_RENDERER_PRESENTVSYNC` enabled, then if the app is not able to run at 60 FPS, automatically the `vsync` will be disabled having a better performance, instead of droping FPS to 30.
## Notes ## Notes
If you trying to debug a SDL app through [ps2client](https://github.com/ps2dev/ps2client) you need to avoid the IOP reset, otherwise you will lose the conection with your computer. If you trying to debug a SDL app through [ps2client](https://github.com/ps2dev/ps2client) you need to avoid the IOP reset, otherwise you will lose the conection with your computer.
So to avoid the reset of the IOP CPU, you need to call to the macro `SDL_PS2_SKIP_IOP_RESET();`. So to avoid the reset of the IOP CPU, you need to call to the macro `SDL_PS2_SKIP_IOP_RESET();`.
It could be something similar as: It could be something similar as:
```c ```c
..... .....
SDL_PS2_SKIP_IOP_RESET(); SDL_PS2_SKIP_IOP_RESET();
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
..... .....
``` ```
For a release binary is recommendable to reset the IOP always. For a release binary is recommendable to reset the IOP always.
Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_SKIP_IOP_RESET` otherwise the change won't be reflected. Remember to do a clean compilation everytime you enable or disable the `SDL_PS2_SKIP_IOP_RESET` otherwise the change won't be reflected.
## Getting PS2 Dev ## Getting PS2 Dev
[Installing PS2 Dev](https://github.com/ps2dev/ps2dev) [Installing PS2 Dev](https://github.com/ps2dev/ps2dev)
## Running on PCSX2 Emulator ## Running on PCSX2 Emulator
[PCSX2](https://github.com/PCSX2/pcsx2) [PCSX2](https://github.com/PCSX2/pcsx2)
[More PCSX2 information](https://pcsx2.net/) [More PCSX2 information](https://pcsx2.net/)
## To Do ## To Do
- PS2 Screen Keyboard - PS2 Screen Keyboard
- Dialogs - Dialogs
- Others - Others
+36 -36
View File
@@ -1,36 +1,36 @@
PSP PSP
====== ======
SDL2 port for the Sony PSP contributed by: SDL2 port for the Sony PSP contributed by:
- Captian Lex - Captian Lex
- Francisco Javier Trujillo Mata - Francisco Javier Trujillo Mata
- Wouter Wijsman - Wouter Wijsman
Credit to Credit to
Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP
Geecko for his PSP GU lib "Glib2d" Geecko for his PSP GU lib "Glib2d"
## Building ## Building
To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run: To build SDL2 library for the PSP, make sure you have the latest PSPDev status and run:
```bash ```bash
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake
cmake --build build cmake --build build
cmake --install build cmake --install build
``` ```
## Getting PSP Dev ## Getting PSP Dev
[Installing PSP Dev](https://github.com/pspdev/pspdev) [Installing PSP Dev](https://github.com/pspdev/pspdev)
## Running on PPSSPP Emulator ## Running on PPSSPP Emulator
[PPSSPP](https://github.com/hrydgard/ppsspp) [PPSSPP](https://github.com/hrydgard/ppsspp)
[Build Instructions](https://github.com/hrydgard/ppsspp/wiki/Build-instructions) [Build Instructions](https://github.com/hrydgard/ppsspp/wiki/Build-instructions)
## Compiling a HelloWorld ## Compiling a HelloWorld
[PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world) [PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world)
## To Do ## To Do
- PSP Screen Keyboard - PSP Screen Keyboard
- Dialogs - Dialogs
+180 -180
View File
@@ -1,180 +1,180 @@
Raspberry Pi Raspberry Pi
============ ============
Requirements: Requirements:
Raspbian (other Linux distros may work as well). Raspbian (other Linux distros may work as well).
Features Features
-------- --------
* Works without X11 * Works without X11
* Hardware accelerated OpenGL ES 2.x * Hardware accelerated OpenGL ES 2.x
* Sound via ALSA * Sound via ALSA
* Input (mouse/keyboard/joystick) via EVDEV * Input (mouse/keyboard/joystick) via EVDEV
* Hotplugging of input devices via UDEV * Hotplugging of input devices via UDEV
Raspbian Build Dependencies Raspbian Build Dependencies
--------------------------- ---------------------------
sudo apt-get install libudev-dev libasound2-dev libdbus-1-dev sudo apt-get install libudev-dev libasound2-dev libdbus-1-dev
You also need the VideoCore binary stuff that ships in /opt/vc for EGL and You also need the VideoCore binary stuff that ships in /opt/vc for EGL and
OpenGL ES 2.x, it usually comes pre-installed, but in any case: OpenGL ES 2.x, it usually comes pre-installed, but in any case:
sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev
NEON NEON
---- ----
If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so If your Pi has NEON support, make sure you add -mfpu=neon to your CFLAGS so
that SDL will select some otherwise-disabled highly-optimized code. The that SDL will select some otherwise-disabled highly-optimized code. The
original Pi units don't have NEON, the Pi2 probably does, and the Pi3 original Pi units don't have NEON, the Pi2 probably does, and the Pi3
definitely does. definitely does.
Cross compiling from x86 Linux Cross compiling from x86 Linux
------------------------------ ------------------------------
To cross compile SDL for Raspbian from your desktop machine, you'll need a To cross compile SDL for Raspbian from your desktop machine, you'll need a
Raspbian system root and the cross compilation tools. We'll assume these tools Raspbian system root and the cross compilation tools. We'll assume these tools
will be placed in /opt/rpi-tools will be placed in /opt/rpi-tools
sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools
You'll also need a Raspbian binary image. You'll also need a Raspbian binary image.
Get it from: http://downloads.raspberrypi.org/raspbian_latest Get it from: http://downloads.raspberrypi.org/raspbian_latest
After unzipping, you'll get file with a name like: "<date>-wheezy-raspbian.img" After unzipping, you'll get file with a name like: "<date>-wheezy-raspbian.img"
Let's assume the sysroot will be built in /opt/rpi-sysroot. Let's assume the sysroot will be built in /opt/rpi-sysroot.
export SYSROOT=/opt/rpi-sysroot export SYSROOT=/opt/rpi-sysroot
sudo kpartx -a -v <path_to_raspbian_image>.img sudo kpartx -a -v <path_to_raspbian_image>.img
sudo mount -o loop /dev/mapper/loop0p2 /mnt sudo mount -o loop /dev/mapper/loop0p2 /mnt
sudo cp -r /mnt $SYSROOT sudo cp -r /mnt $SYSROOT
sudo apt-get install qemu binfmt-support qemu-user-static sudo apt-get install qemu binfmt-support qemu-user-static
sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin
sudo mount --bind /dev $SYSROOT/dev sudo mount --bind /dev $SYSROOT/dev
sudo mount --bind /proc $SYSROOT/proc sudo mount --bind /proc $SYSROOT/proc
sudo mount --bind /sys $SYSROOT/sys sudo mount --bind /sys $SYSROOT/sys
Now, before chrooting into the ARM sysroot, you'll need to apply a workaround, Now, before chrooting into the ARM sysroot, you'll need to apply a workaround,
edit $SYSROOT/etc/ld.so.preload and comment out all lines in it. edit $SYSROOT/etc/ld.so.preload and comment out all lines in it.
sudo chroot $SYSROOT sudo chroot $SYSROOT
apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev
exit exit
sudo umount $SYSROOT/dev sudo umount $SYSROOT/dev
sudo umount $SYSROOT/proc sudo umount $SYSROOT/proc
sudo umount $SYSROOT/sys sudo umount $SYSROOT/sys
sudo umount /mnt sudo umount /mnt
There's one more fix required, as the libdl.so symlink uses an absolute path There's one more fix required, as the libdl.so symlink uses an absolute path
which doesn't quite work in our setup. which doesn't quite work in our setup.
sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so
The final step is compiling SDL itself. The final step is compiling SDL itself.
export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux" export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux"
cd <SDL SOURCE> cd <SDL SOURCE>
mkdir -p build;cd build mkdir -p build;cd build
LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd
make make
make install make install
To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths: To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths:
perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config
Apps don't work or poor video/audio performance Apps don't work or poor video/audio performance
----------------------------------------------- -----------------------------------------------
If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to
update the RPi's firmware. Note that doing so will fix these problems, but it update the RPi's firmware. Note that doing so will fix these problems, but it
will also render the CMA - Dynamic Memory Split functionality useless. will also render the CMA - Dynamic Memory Split functionality useless.
Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too
low in general, specially if a 1080p TV is hooked up. low in general, specially if a 1080p TV is hooked up.
See here how to configure this setting: http://elinux.org/RPiconfig See here how to configure this setting: http://elinux.org/RPiconfig
Using a fixed gpu_mem=128 is the best option (specially if you updated the Using a fixed gpu_mem=128 is the best option (specially if you updated the
firmware, using CMA probably won't work, at least it's the current case). firmware, using CMA probably won't work, at least it's the current case).
No input No input
-------- --------
Make sure you belong to the "input" group. Make sure you belong to the "input" group.
sudo usermod -aG input `whoami` sudo usermod -aG input `whoami`
No HDMI Audio No HDMI Audio
------------- -------------
If you notice that ALSA works but there's no audio over HDMI, try adding: If you notice that ALSA works but there's no audio over HDMI, try adding:
hdmi_drive=2 hdmi_drive=2
to your config.txt file and reboot. to your config.txt file and reboot.
Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062 Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062
Text Input API support Text Input API support
---------------------- ----------------------
The Text Input API is supported, with translation of scan codes done via the The Text Input API is supported, with translation of scan codes done via the
kernel symbol tables. For this to work, SDL needs access to a valid console. kernel symbol tables. For this to work, SDL needs access to a valid console.
If you notice there's no SDL_TEXTINPUT message being emitted, double check that If you notice there's no SDL_TEXTINPUT message being emitted, double check that
your app has read access to one of the following: your app has read access to one of the following:
* /proc/self/fd/0 * /proc/self/fd/0
* /dev/tty * /dev/tty
* /dev/tty[0...6] * /dev/tty[0...6]
* /dev/vc/0 * /dev/vc/0
* /dev/console * /dev/console
This is usually not a problem if you run from the physical terminal (as opposed This is usually not a problem if you run from the physical terminal (as opposed
to running from a pseudo terminal, such as via SSH). If running from a PTS, a to running from a pseudo terminal, such as via SSH). If running from a PTS, a
quick workaround is to run your app as root or add yourself to the tty group, quick workaround is to run your app as root or add yourself to the tty group,
then re-login to the system. then re-login to the system.
sudo usermod -aG tty `whoami` sudo usermod -aG tty `whoami`
The keyboard layout used by SDL is the same as the one the kernel uses. The keyboard layout used by SDL is the same as the one the kernel uses.
To configure the layout on Raspbian: To configure the layout on Raspbian:
sudo dpkg-reconfigure keyboard-configuration sudo dpkg-reconfigure keyboard-configuration
To configure the locale, which controls which keys are interpreted as letters, To configure the locale, which controls which keys are interpreted as letters,
this determining the CAPS LOCK behavior: this determining the CAPS LOCK behavior:
sudo dpkg-reconfigure locales sudo dpkg-reconfigure locales
OpenGL problems OpenGL problems
--------------- ---------------
If you have desktop OpenGL headers installed at build time in your RPi or cross If you have desktop OpenGL headers installed at build time in your RPi or cross
compilation environment, support for it will be built in. However, the chipset compilation environment, support for it will be built in. However, the chipset
does not actually have support for it, which causes issues in certain SDL apps does not actually have support for it, which causes issues in certain SDL apps
since the presence of OpenGL support supersedes the ES/ES2 variants. since the presence of OpenGL support supersedes the ES/ES2 variants.
The workaround is to disable OpenGL at configuration time: The workaround is to disable OpenGL at configuration time:
./configure --disable-video-opengl ./configure --disable-video-opengl
Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER
environment variable: environment variable:
export SDL_RENDER_DRIVER=opengles2 export SDL_RENDER_DRIVER=opengles2
Notes Notes
----- -----
* When launching apps remotely (via SSH), SDL can prevent local keystrokes from * When launching apps remotely (via SSH), SDL can prevent local keystrokes from
leaking into the console only if it has root privileges. Launching apps locally leaking into the console only if it has root privileges. Launching apps locally
does not suffer from this issue. does not suffer from this issue.
+41 -41
View File
@@ -1,41 +1,41 @@
RISC OS RISC OS
======= =======
Requirements: Requirements:
* RISC OS 3.5 or later. * RISC OS 3.5 or later.
* [SharedUnixLibrary](http://www.riscos.info/packages/LibraryDetails.html#SharedUnixLibraryarm). * [SharedUnixLibrary](http://www.riscos.info/packages/LibraryDetails.html#SharedUnixLibraryarm).
* [DigitalRenderer](http://www.riscos.info/packages/LibraryDetails.html#DRendererarm), for audio support. * [DigitalRenderer](http://www.riscos.info/packages/LibraryDetails.html#DRendererarm), for audio support.
* [Iconv](http://www.netsurf-browser.org/projects/iconv/), for `SDL_iconv` and related functions. * [Iconv](http://www.netsurf-browser.org/projects/iconv/), for `SDL_iconv` and related functions.
Compiling: Compiling:
---------- ----------
Currently, SDL2 for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported. Currently, SDL2 for RISC OS only supports compiling with GCCSDK under Linux. Both the autoconf and CMake build systems are supported.
The following commands can be used to build SDL2 for RISC OS using autoconf: The following commands can be used to build SDL2 for RISC OS using autoconf:
./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics ./configure --host=arm-unknown-riscos --prefix=$GCCSDK_INSTALL_ENV --disable-gcc-atomics
make make
make install make install
The following commands can be used to build SDL2 for RISC OS using CMake: The following commands can be used to build SDL2 for RISC OS using CMake:
cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF cmake -Bbuild-riscos -DCMAKE_TOOLCHAIN_FILE=$GCCSDK_INSTALL_ENV/toolchain-riscos.cmake -DRISCOS=ON -DCMAKE_INSTALL_PREFIX=$GCCSDK_INSTALL_ENV -DCMAKE_BUILD_TYPE=Release -DSDL_GCC_ATOMICS=OFF
cmake --build build-riscos cmake --build build-riscos
cmake --build build-riscos --target install cmake --build build-riscos --target install
Current level of implementation Current level of implementation
------------------------------- -------------------------------
The video driver currently provides full screen video support with keyboard and mouse input. Windowed mode is not yet supported, but is planned in the future. Only software rendering is supported. The video driver currently provides full screen video support with keyboard and mouse input. Windowed mode is not yet supported, but is planned in the future. Only software rendering is supported.
The filesystem APIs return either Unix-style paths or RISC OS-style paths based on the value of the `__riscosify_control` symbol, as is standard for UnixLib functions. The filesystem APIs return either Unix-style paths or RISC OS-style paths based on the value of the `__riscosify_control` symbol, as is standard for UnixLib functions.
The audio, loadso, thread and timer APIs are currently provided by UnixLib. The audio, loadso, thread and timer APIs are currently provided by UnixLib.
GCC atomics are currently broken on some platforms, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake. GCC atomics are currently broken on some platforms, meaning it's currently necessary to compile with `--disable-gcc-atomics` using autotools or `-DSDL_GCC_ATOMICS=OFF` using CMake.
The joystick, locale and power APIs are not yet implemented. The joystick, locale and power APIs are not yet implemented.
+86 -86
View File
@@ -1,86 +1,86 @@
Touch Touch
=========================================================================== ===========================================================================
System Specific Notes System Specific Notes
=========================================================================== ===========================================================================
Linux: Linux:
The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it. The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it.
Mac: Mac:
The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do. The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do.
iPhone: iPhone:
Works out of box. Works out of box.
Windows: Windows:
Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com
=========================================================================== ===========================================================================
Events Events
=========================================================================== ===========================================================================
SDL_FINGERDOWN: SDL_FINGERDOWN:
Sent when a finger (or stylus) is placed on a touch device. Sent when a finger (or stylus) is placed on a touch device.
Fields: Fields:
* event.tfinger.touchId - the Id of the touch device. * event.tfinger.touchId - the Id of the touch device.
* event.tfinger.fingerId - the Id of the finger which just went down. * event.tfinger.fingerId - the Id of the finger which just went down.
* event.tfinger.x - the x coordinate of the touch (0..1) * event.tfinger.x - the x coordinate of the touch (0..1)
* event.tfinger.y - the y coordinate of the touch (0..1) * event.tfinger.y - the y coordinate of the touch (0..1)
* event.tfinger.pressure - the pressure of the touch (0..1) * event.tfinger.pressure - the pressure of the touch (0..1)
SDL_FINGERMOTION: SDL_FINGERMOTION:
Sent when a finger (or stylus) is moved on the touch device. Sent when a finger (or stylus) is moved on the touch device.
Fields: Fields:
Same as SDL_FINGERDOWN but with additional: Same as SDL_FINGERDOWN but with additional:
* event.tfinger.dx - change in x coordinate during this motion event. * event.tfinger.dx - change in x coordinate during this motion event.
* event.tfinger.dy - change in y coordinate during this motion event. * event.tfinger.dy - change in y coordinate during this motion event.
SDL_FINGERUP: SDL_FINGERUP:
Sent when a finger (or stylus) is lifted from the touch device. Sent when a finger (or stylus) is lifted from the touch device.
Fields: Fields:
Same as SDL_FINGERDOWN. Same as SDL_FINGERDOWN.
=========================================================================== ===========================================================================
Functions Functions
=========================================================================== ===========================================================================
SDL provides the ability to access the underlying SDL_Finger structures. SDL provides the ability to access the underlying SDL_Finger structures.
These structures should _never_ be modified. These structures should _never_ be modified.
The following functions are included from SDL_touch.h The following functions are included from SDL_touch.h
To get a SDL_TouchID call SDL_GetTouchDevice(int index). To get a SDL_TouchID call SDL_GetTouchDevice(int index).
This returns a SDL_TouchID. This returns a SDL_TouchID.
IMPORTANT: If the touch has been removed, or there is no touch with the given index, SDL_GetTouchDevice() will return 0. Be sure to check for this! IMPORTANT: If the touch has been removed, or there is no touch with the given index, SDL_GetTouchDevice() will return 0. Be sure to check for this!
The number of touch devices can be queried with SDL_GetNumTouchDevices(). The number of touch devices can be queried with SDL_GetNumTouchDevices().
A SDL_TouchID may be used to get pointers to SDL_Finger. A SDL_TouchID may be used to get pointers to SDL_Finger.
SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device. SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device.
The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following: The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following:
float x = event.tfinger.x; float x = event.tfinger.x;
float y = event.tfinger.y; float y = event.tfinger.y;
To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger. To get a SDL_Finger, call SDL_GetTouchFinger(SDL_TouchID touchID, int index), where touchID is a SDL_TouchID, and index is the requested finger.
This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed. This returns a SDL_Finger *, or NULL if the finger does not exist, or has been removed.
A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled. A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled.
As a result, be very careful to check for NULL return values. As a result, be very careful to check for NULL return values.
A SDL_Finger has the following fields: A SDL_Finger has the following fields:
* x, y: * x, y:
The current coordinates of the touch. The current coordinates of the touch.
* pressure: * pressure:
The pressure of the touch. The pressure of the touch.
=========================================================================== ===========================================================================
Notes Notes
=========================================================================== ===========================================================================
For a complete example see test/testgesture.c For a complete example see test/testgesture.c
Please direct questions/comments to: Please direct questions/comments to:
jim.tla+sdl_touch@gmail.com jim.tla+sdl_touch@gmail.com
(original author, API was changed since) (original author, API was changed since)
+60 -60
View File
@@ -1,60 +1,60 @@
# Versioning # Versioning
## Since 2.23.0 ## Since 2.23.0
SDL follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak SDL follows an "odd/even" versioning policy, similar to GLib, GTK, Flatpak
and older versions of the Linux kernel: and older versions of the Linux kernel:
* The major version (first part) increases when backwards compatibility * The major version (first part) increases when backwards compatibility
is broken, which will happen infrequently. is broken, which will happen infrequently.
* If the minor version (second part) is divisible by 2 * If the minor version (second part) is divisible by 2
(for example 2.24.x, 2.26.x), this indicates a version of SDL that (for example 2.24.x, 2.26.x), this indicates a version of SDL that
is believed to be stable and suitable for production use. is believed to be stable and suitable for production use.
* In stable releases, the patchlevel or micro version (third part) * In stable releases, the patchlevel or micro version (third part)
indicates bugfix releases. Bugfix releases should not add or indicates bugfix releases. Bugfix releases should not add or
remove ABI, so the ".0" release (for example 2.24.0) should be remove ABI, so the ".0" release (for example 2.24.0) should be
forwards-compatible with all the bugfix releases from the forwards-compatible with all the bugfix releases from the
same cycle (for example 2.24.1). same cycle (for example 2.24.1).
* The minor version increases when new API or ABI is added, or when * The minor version increases when new API or ABI is added, or when
other significant changes are made. Newer minor versions are other significant changes are made. Newer minor versions are
backwards-compatible, but not fully forwards-compatible. backwards-compatible, but not fully forwards-compatible.
For example, programs built against SDL 2.24.x should work fine For example, programs built against SDL 2.24.x should work fine
with SDL 2.26.x, but programs built against SDL 2.26.x will not with SDL 2.26.x, but programs built against SDL 2.26.x will not
necessarily work with 2.24.x. necessarily work with 2.24.x.
* If the minor version (second part) is not divisible by 2 * If the minor version (second part) is not divisible by 2
(for example 2.23.x, 2.25.x), this indicates a development prerelease (for example 2.23.x, 2.25.x), this indicates a development prerelease
of SDL that is not suitable for stable software distributions. of SDL that is not suitable for stable software distributions.
Use with caution. Use with caution.
* The patchlevel or micro version (third part) increases with * The patchlevel or micro version (third part) increases with
each prerelease. each prerelease.
* Each prerelease might add new API and/or ABI. * Each prerelease might add new API and/or ABI.
* Prereleases are backwards-compatible with older stable branches. * Prereleases are backwards-compatible with older stable branches.
For example, 2.25.x will be backwards-compatible with 2.24.x. For example, 2.25.x will be backwards-compatible with 2.24.x.
* Prereleases are not guaranteed to be backwards-compatible with * Prereleases are not guaranteed to be backwards-compatible with
each other. For example, new API or ABI added in 2.25.1 each other. For example, new API or ABI added in 2.25.1
might be removed or changed in 2.25.2. might be removed or changed in 2.25.2.
If this would be a problem for you, please do not use prereleases. If this would be a problem for you, please do not use prereleases.
* Only upgrade to a prerelease if you can guarantee that you will * Only upgrade to a prerelease if you can guarantee that you will
promptly upgrade to the stable release that follows it. promptly upgrade to the stable release that follows it.
For example, do not upgrade to 2.23.x unless you will be able to For example, do not upgrade to 2.23.x unless you will be able to
upgrade to 2.24.0 when it becomes available. upgrade to 2.24.0 when it becomes available.
* Software distributions that have a freeze policy (in particular Linux * Software distributions that have a freeze policy (in particular Linux
distributions with a release cycle, such as Debian and Fedora) distributions with a release cycle, such as Debian and Fedora)
should usually only package stable releases, and not prereleases. should usually only package stable releases, and not prereleases.
## Before 2.23.0 ## Before 2.23.0
Older versions of SDL followed a similar policy, but instead of the Older versions of SDL followed a similar policy, but instead of the
odd/even rule applying to the minor version, it applied to the patchlevel odd/even rule applying to the minor version, it applied to the patchlevel
(micro version, third part). For example, 2.0.22 was a stable release (micro version, third part). For example, 2.0.22 was a stable release
and 2.0.21 was a prerelease. and 2.0.21 was a prerelease.
+114 -114
View File
@@ -1,114 +1,114 @@
Using SDL with Microsoft Visual C++ Using SDL with Microsoft Visual C++
=================================== ===================================
### by Lion Kimbro with additions by James Turk ### by Lion Kimbro with additions by James Turk
You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL You can either use the precompiled libraries from the [SDL](https://www.libsdl.org/download.php) web site, or you can build SDL
yourself. yourself.
### Building SDL ### Building SDL
0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from 0. To build SDL, your machine must, at a minimum, have the DirectX9.0c SDK installed. It may or may not be retrievable from
the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web). the [Microsoft](https://www.microsoft.com) website, so you might need to locate it [online](https://duckduckgo.com/?q=directx9.0c+sdk+download&t=h_&ia=web).
_Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_ _Editor's note: I've been able to successfully build SDL using Visual Studio 2019 **without** the DX9.0c SDK_
1. Open the Visual Studio solution file at `./VisualC/SDL.sln`. 1. Open the Visual Studio solution file at `./VisualC/SDL.sln`.
2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog, 2. Your IDE will likely prompt you to upgrade this solution file to whatever later version of the IDE you're using. In the `Retarget Projects` dialog,
all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with all of the affected project files should be checked allowing you to use the latest `Windows SDK Version` you have installed, along with
the `Platform Toolset`. the `Platform Toolset`.
If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`. If you choose *NOT* to upgrade to use the latest `Windows SDK Version` or `Platform Toolset`, then you'll need the `Visual Studio 2010 Platform Toolset`.
3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_ 3. Build the `.dll` and `.lib` files by right clicking on each project in turn (Projects are listed in the _Workspace_
panel in the _FileView_ tab), and selecting `Build`. panel in the _FileView_ tab), and selecting `Build`.
You may get a few warnings, but you should not get any errors. You may get a few warnings, but you should not get any errors.
Later, we will refer to the following `.lib` and `.dll` files that have just been generated: Later, we will refer to the following `.lib` and `.dll` files that have just been generated:
- `./VisualC/Win32/Debug/SDL2.dll` or `./VisualC/Win32/Release/SDL2.dll` - `./VisualC/Win32/Debug/SDL2.dll` or `./VisualC/Win32/Release/SDL2.dll`
- `./VisualC/Win32/Debug/SDL2.lib` or `./VisualC/Win32/Release/SDL2.lib` - `./VisualC/Win32/Debug/SDL2.lib` or `./VisualC/Win32/Release/SDL2.lib`
- `./VisualC/Win32/Debug/SDL2main.lib` or `./VisualC/Win32/Release/SDL2main.lib` - `./VisualC/Win32/Debug/SDL2main.lib` or `./VisualC/Win32/Release/SDL2main.lib`
_Note for the `x64` versions, just replace `Win32` in the path with `x64`_ _Note for the `x64` versions, just replace `Win32` in the path with `x64`_
### Creating a Project with SDL ### Creating a Project with SDL
- Create a project as a `Win32 Application`. - Create a project as a `Win32 Application`.
- Create a C++ file for your project. - Create a C++ file for your project.
- Set the C runtime to `Multi-threaded DLL` in the menu: - Set the C runtime to `Multi-threaded DLL` in the menu:
`Project|Settings|C/C++ tab|Code Generation|Runtime Library `. `Project|Settings|C/C++ tab|Code Generation|Runtime Library `.
- Add the SDL `include` directory to your list of includes in the menu: - Add the SDL `include` directory to your list of includes in the menu:
`Project|Settings|C/C++ tab|Preprocessor|Additional include directories ` `Project|Settings|C/C++ tab|Preprocessor|Additional include directories `
*VC7 Specific: Instead of doing this, I find it easier to add the *VC7 Specific: Instead of doing this, I find it easier to add the
include and library directories to the list that VC7 keeps. Do this by include and library directories to the list that VC7 keeps. Do this by
selecting Tools|Options|Projects|VC++ Directories and under the "Show selecting Tools|Options|Projects|VC++ Directories and under the "Show
Directories For:" dropbox select "Include Files", and click the "New Directories For:" dropbox select "Include Files", and click the "New
Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you Directory Icon" and add the [SDLROOT]\\include directory (e.g. If you
installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the installed to c:\\SDL\\ add c:\\SDL\\include). Proceed to change the
dropbox selection to "Library Files" and add [SDLROOT]\\lib.* dropbox selection to "Library Files" and add [SDLROOT]\\lib.*
The "include directory" I am referring to is the `./include` folder. The "include directory" I am referring to is the `./include` folder.
Now we're going to use the files that we had created earlier in the *Build SDL* step. Now we're going to use the files that we had created earlier in the *Build SDL* step.
Copy the following file into your Project directory: Copy the following file into your Project directory:
- `SDL2.dll` - `SDL2.dll`
Add the following files to your project (It is not necessary to copy them to your project directory): Add the following files to your project (It is not necessary to copy them to your project directory):
- `SDL2.lib` - `SDL2.lib`
- `SDL2main.lib` - `SDL2main.lib`
To add them to your project, right click on your project, and select To add them to your project, right click on your project, and select
`Add files to project`. `Add files to project`.
**Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line **Instead of adding the files to your project, it is more desirable to add them to the linker options: Project|Properties|Linker|Command Line
and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration and type the names of the libraries to link with in the "Additional Options:" box. Note: This must be done for each build configuration
(e.g. Release,Debug).** (e.g. Release,Debug).**
### Hello SDL2 ### Hello SDL2
Here's a sample SDL snippet to verify everything is setup in your IDE: Here's a sample SDL snippet to verify everything is setup in your IDE:
``` ```
#include "SDL.h" #include "SDL.h"
int main( int argc, char* argv[] ) int main( int argc, char* argv[] )
{ {
const int WIDTH = 640; const int WIDTH = 640;
const int HEIGHT = 480; const int HEIGHT = 480;
SDL_Window* window = NULL; SDL_Window* window = NULL;
SDL_Renderer* renderer = NULL; SDL_Renderer* renderer = NULL;
SDL_Init(SDL_INIT_VIDEO); SDL_Init(SDL_INIT_VIDEO);
window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN); window = SDL_CreateWindow("SDL2 Test", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
SDL_DestroyRenderer(renderer); SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window); SDL_DestroyWindow(window);
SDL_Quit(); SDL_Quit();
return 0; return 0;
} }
``` ```
### That's it! ### That's it!
I hope that this document has helped you get through the most difficult part of using the SDL: installing it. I hope that this document has helped you get through the most difficult part of using the SDL: installing it.
Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues). Suggestions for improvements should be posted to the [Github Issues](https://github.com/libsdl-org/SDL/issues).
### Credits ### Credits
Thanks to [Paulus Esterhazy](mailto:pesterhazy@gmx.net), for the work on VC++ port. Thanks to [Paulus Esterhazy](mailto:pesterhazy@gmx.net), for the work on VC++ port.
This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:slouken@libsdl.org). This document was originally called "VisualC.txt", and was written by [Sam Lantinga](mailto:slouken@libsdl.org).
Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:snowlion@sprynet.com). Later, it was converted to HTML and expanded into the document that you see today by [Lion Kimbro](mailto:snowlion@sprynet.com).
Minor Fixes and Visual C++ 7 Information (In Green) was added by [James Turk](mailto:james@conceptofzero.net) Minor Fixes and Visual C++ 7 Information (In Green) was added by [James Turk](mailto:james@conceptofzero.net)
+33 -33
View File
@@ -1,33 +1,33 @@
PS Vita PS Vita
======= =======
SDL port for the Sony Playstation Vita and Sony Playstation TV SDL port for the Sony Playstation Vita and Sony Playstation TV
Credit to Credit to
* xerpi, cpasjuste and rsn8887 for initial (vita2d) port * xerpi, cpasjuste and rsn8887 for initial (vita2d) port
* vitasdk/dolcesdk devs * vitasdk/dolcesdk devs
* CBPS discord (Namely Graphene and SonicMastr) * CBPS discord (Namely Graphene and SonicMastr)
Building Building
-------- --------
To build for the PSVita, make sure you have vitasdk and cmake installed and run: To build for the PSVita, make sure you have vitasdk and cmake installed and run:
``` ```
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE=${VITASDK}/share/vita.toolchain.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build build cmake --build build
cmake --install build cmake --install build
``` ```
Notes Notes
----- -----
* gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON` * gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON`
These renderers support 720p and 1080i resolutions. These can be specified with: These renderers support 720p and 1080i resolutions. These can be specified with:
`SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);` `SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);`
* Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK. * Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK.
They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);` They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);`
anytime before video subsystem initialization. anytime before video subsystem initialization.
* gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON` * gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON`
* By default SDL emits mouse events for touch events on every touchscreen. * By default SDL emits mouse events for touch events on every touchscreen.
Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead. Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead.
Individual touchscreens can be disabled with: Individual touchscreens can be disabled with:
`SDL_setenv("VITA_DISABLE_TOUCH_FRONT", "1", 1);` and `SDL_setenv("VITA_DISABLE_TOUCH_BACK", "1", 1);` `SDL_setenv("VITA_DISABLE_TOUCH_FRONT", "1", 1);` and `SDL_setenv("VITA_DISABLE_TOUCH_BACK", "1", 1);`
* Support for L2/R2/R3/R3 buttons, haptic feedback and gamepad led only available on PSTV, or when using external ds4 gamepad on vita. * Support for L2/R2/R3/R3 buttons, haptic feedback and gamepad led only available on PSTV, or when using external ds4 gamepad on vita.
+10 -10
View File
@@ -1,10 +1,10 @@
WinCE WinCE
===== =====
Windows CE is no longer supported by SDL. Windows CE is no longer supported by SDL.
We have left the CE support in SDL 1.2 for those that must have it, and we We have left the CE support in SDL 1.2 for those that must have it, and we
have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3. have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3.
--ryan. --ryan.
+58 -58
View File
@@ -1,58 +1,58 @@
# Windows # Windows
## LLVM and Intel C++ compiler support ## LLVM and Intel C++ compiler support
SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++ SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++
compiler, but you'll have to manually add the "-msse3" command line option compiler, but you'll have to manually add the "-msse3" command line option
to at least the SDL_audiocvt.c source file, and possibly others. This may to at least the SDL_audiocvt.c source file, and possibly others. This may
not be necessary if you build SDL with CMake instead of the included Visual not be necessary if you build SDL with CMake instead of the included Visual
Studio solution. Studio solution.
Details are here: https://github.com/libsdl-org/SDL/issues/5186 Details are here: https://github.com/libsdl-org/SDL/issues/5186
## OpenGL ES 2.x support ## OpenGL ES 2.x support
SDL has support for OpenGL ES 2.x under Windows via two alternative SDL has support for OpenGL ES 2.x under Windows via two alternative
implementations. implementations.
The most straightforward method consists in running your app in a system with The most straightforward method consists in running your app in a system with
a graphic card paired with a relatively recent (as of November of 2013) driver a graphic card paired with a relatively recent (as of November of 2013) driver
which supports the WGL_EXT_create_context_es2_profile extension. Vendors known which supports the WGL_EXT_create_context_es2_profile extension. Vendors known
to ship said extension on Windows currently include nVidia and Intel. to ship said extension on Windows currently include nVidia and Intel.
The other method involves using the The other method involves using the
[ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x [ANGLE library](https://code.google.com/p/angleproject/). If an OpenGL ES 2.x
context is requested and no WGL_EXT_create_context_es2_profile extension is context is requested and no WGL_EXT_create_context_es2_profile extension is
found, SDL will try to load the libEGL.dll library provided by ANGLE. found, SDL will try to load the libEGL.dll library provided by ANGLE.
To obtain the ANGLE binaries, you can either compile from source from To obtain the ANGLE binaries, you can either compile from source from
https://chromium.googlesource.com/angle/angle or copy the relevant binaries https://chromium.googlesource.com/angle/angle or copy the relevant binaries
from a recent Chrome/Chromium install for Windows. The files you need are: from a recent Chrome/Chromium install for Windows. The files you need are:
- libEGL.dll - libEGL.dll
- libGLESv2.dll - libGLESv2.dll
- d3dcompiler_46.dll (supports Windows Vista or later, better shader - d3dcompiler_46.dll (supports Windows Vista or later, better shader
compiler) *or* d3dcompiler_43.dll (supports Windows XP or later) compiler) *or* d3dcompiler_43.dll (supports Windows XP or later)
If you compile ANGLE from source, you can configure it so it does not need the If you compile ANGLE from source, you can configure it so it does not need the
d3dcompiler_* DLL at all (for details on this, see their documentation). d3dcompiler_* DLL at all (for details on this, see their documentation).
However, by default SDL will try to preload the d3dcompiler_46.dll to However, by default SDL will try to preload the d3dcompiler_46.dll to
comply with ANGLE's requirements. If you wish SDL to preload comply with ANGLE's requirements. If you wish SDL to preload
d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you d3dcompiler_43.dll (to support Windows XP) or to skip this step at all, you
can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more can use the SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more
details). details).
Known Bugs: Known Bugs:
- SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears - SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears
that there's a bug in the library which prevents the window contents from that there's a bug in the library which prevents the window contents from
refreshing if this is set to anything other than the default value. refreshing if this is set to anything other than the default value.
## Vulkan Surface Support ## Vulkan Surface Support
Support for creating Vulkan surfaces is configured on by default. To disable Support for creating Vulkan surfaces is configured on by default. To disable
it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You it change the value of `SDL_VIDEO_VULKAN` to 0 in `SDL_config_windows.h`. You
must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to must install the [Vulkan SDK](https://www.lunarg.com/vulkan-sdk/) in order to
use Vulkan graphics in your application. use Vulkan graphics in your application.
File diff suppressed because it is too large. Load diff
+63 -63
View File
@@ -1,63 +1,63 @@
# Simple DirectMedia Layer # Simple DirectMedia Layer
https://www.libsdl.org/ https://www.libsdl.org/
Simple DirectMedia Layer is a cross-platform development library designed Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and Direct3D. It is used by video playback software, hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games. and many Humble Bundle games.
SDL officially supports Windows, macOS, Linux, iOS, and Android. SDL officially supports Windows, macOS, Linux, iOS, and Android.
Support for other platforms may be found in the source code. Support for other platforms may be found in the source code.
SDL is written in C, works natively with C++, and there are bindings SDL is written in C, works natively with C++, and there are bindings
available for several other languages, including C# and Python. available for several other languages, including C# and Python.
This library is distributed under the zlib license, which can be found This library is distributed under the zlib license, which can be found
in the file "LICENSE.txt". in the file "LICENSE.txt".
The best way to learn how to use SDL is to check out the header files in The best way to learn how to use SDL is to check out the header files in
the "include" subdirectory and the programs in the "test" subdirectory. the "include" subdirectory and the programs in the "test" subdirectory.
The header files and test programs are well commented and always up to date. The header files and test programs are well commented and always up to date.
More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/) More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/)
- [Android](README-android.md) - [Android](README-android.md)
- [CMake](README-cmake.md) - [CMake](README-cmake.md)
- [DirectFB](README-directfb.md) - [DirectFB](README-directfb.md)
- [DynAPI](README-dynapi.md) - [DynAPI](README-dynapi.md)
- [Emscripten](README-emscripten.md) - [Emscripten](README-emscripten.md)
- [GDK](README-gdk.md) - [GDK](README-gdk.md)
- [Gesture](README-gesture.md) - [Gesture](README-gesture.md)
- [Git](README-git.md) - [Git](README-git.md)
- [iOS](README-ios.md) - [iOS](README-ios.md)
- [Linux](README-linux.md) - [Linux](README-linux.md)
- [macOS](README-macos.md) - [macOS](README-macos.md)
- [OS/2](README-os2.md) - [OS/2](README-os2.md)
- [Native Client](README-nacl.md) - [Native Client](README-nacl.md)
- [Pandora](README-pandora.md) - [Pandora](README-pandora.md)
- [Supported Platforms](README-platforms.md) - [Supported Platforms](README-platforms.md)
- [Porting information](README-porting.md) - [Porting information](README-porting.md)
- [PSP](README-psp.md) - [PSP](README-psp.md)
- [PS2](README-ps2.md) - [PS2](README-ps2.md)
- [Raspberry Pi](README-raspberrypi.md) - [Raspberry Pi](README-raspberrypi.md)
- [Touch](README-touch.md) - [Touch](README-touch.md)
- [Versions](README-versions.md) - [Versions](README-versions.md)
- [WinCE](README-wince.md) - [WinCE](README-wince.md)
- [Windows](README-windows.md) - [Windows](README-windows.md)
- [WinRT](README-winrt.md) - [WinRT](README-winrt.md)
- [PSVita](README-vita.md) - [PSVita](README-vita.md)
- [Nokia N-Gage](README-ngage.md) - [Nokia N-Gage](README-ngage.md)
If you need help with the library, or just want to discuss SDL related If you need help with the library, or just want to discuss SDL related
issues, you can join the [SDL Discourse](https://discourse.libsdl.org/), issues, you can join the [SDL Discourse](https://discourse.libsdl.org/),
which can be used as a web forum or a mailing list, at your preference. which can be used as a web forum or a mailing list, at your preference.
If you want to report bugs or contribute patches, please submit them to If you want to report bugs or contribute patches, please submit them to
[our bug tracker](https://github.com/libsdl-org/SDL/issues) [our bug tracker](https://github.com/libsdl-org/SDL/issues)
Enjoy! Enjoy!
Sam Lantinga <mailto:slouken@libsdl.org> Sam Lantinga <mailto:slouken@libsdl.org>
+1561 -1561
View File
File diff suppressed because it is too large. Load diff
+49 -49
View File
@@ -1,49 +1,49 @@
# Release checklist # Release checklist
When changing the version, run `build-scripts/update-version.sh X Y Z`, When changing the version, run `build-scripts/update-version.sh X Y Z`,
where `X Y Z` are the major version, minor version, and patch level. So where `X Y Z` are the major version, minor version, and patch level. So
`2 28 1` means "change the version to 2.28.1". This script does much of the `2 28 1` means "change the version to 2.28.1". This script does much of the
mechanical work. mechanical work.
## New feature release ## New feature release
* Update `WhatsNew.txt` * Update `WhatsNew.txt`
* Bump version number to 2.EVEN.0: * Bump version number to 2.EVEN.0:
* `./build-scripts/update-version.sh 2 EVEN 0` * `./build-scripts/update-version.sh 2 EVEN 0`
* Do the release * Do the release
* Update the website file include/header.inc.php to reflect the new version * Update the website file include/header.inc.php to reflect the new version
## New bugfix release ## New bugfix release
* Check that no new API/ABI was added * Check that no new API/ABI was added
* If it was, do a new feature release (see above) instead * If it was, do a new feature release (see above) instead
* Bump version number from 2.Y.Z to 2.Y.(Z+1) (Y is even) * Bump version number from 2.Y.Z to 2.Y.(Z+1) (Y is even)
* `./build-scripts/update-version.sh 2 Y Z+1` * `./build-scripts/update-version.sh 2 Y Z+1`
* Do the release * Do the release
* Update the website file include/header.inc.php to reflect the new version * Update the website file include/header.inc.php to reflect the new version
## After a feature release ## After a feature release
* Create a branch like `release-2.24.x` * Create a branch like `release-2.24.x`
* Bump version number to 2.ODD.0 for next development branch * Bump version number to 2.ODD.0 for next development branch
* `./build-scripts/update-version.sh 2 ODD 0` * `./build-scripts/update-version.sh 2 ODD 0`
## New development prerelease ## New development prerelease
* Bump version number from 2.Y.Z to 2.Y.(Z+1) (Y is odd) * Bump version number from 2.Y.Z to 2.Y.(Z+1) (Y is odd)
* `./build-scripts/update-version.sh 2 Y Z+1` * `./build-scripts/update-version.sh 2 Y Z+1`
* Do the release * Do the release
Binary file not shown.
@@ -0,0 +1,65 @@
#!/bin/sh
# Get the canonical path of the folder containing this script
bindir=$(cd -P -- "$(dirname -- "$0")" && printf '%s\n' "$(pwd -P)")
# Calculate the canonical path of the prefix, relative to the folder of this script
prefix=$(cd -P -- "$bindir/.." && printf '%s\n' "$(pwd -P)")
exec_prefix=${prefix}
exec_prefix_set=no
libdir=${exec_prefix}/lib
#usage="\
#Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs]"
usage="\
Usage: $0 [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--cflags] [--libs] [--static-libs]"
if test $# -eq 0; then
echo "${usage}" 1>&2
exit 1
fi
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
if test $exec_prefix_set = no ; then
exec_prefix=$optarg
fi
;;
--prefix)
echo $prefix
;;
--exec-prefix=*)
exec_prefix=$optarg
exec_prefix_set=yes
;;
--exec-prefix)
echo $exec_prefix
;;
--version)
echo 2.28.5
;;
--cflags)
echo -I${prefix}/include/SDL2 -Dmain=SDL_main
;;
--libs)
echo -L${exec_prefix}/lib -lmingw32 -lSDL2main -lSDL2 -mwindows
;;
--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")
echo -L${exec_prefix}/lib $sdl_static_libs
;;
*)
echo "${usage}" 1>&2
exit 1
;;
esac
shift
done
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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-2024 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-2024 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
@@ -209,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
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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-2024 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-2024 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
@@ -65,8 +65,8 @@ typedef enum
typedef enum 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;
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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-2024 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-2024 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-2024 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-2024 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-2024 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-2024 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
@@ -131,8 +131,6 @@ typedef enum
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,
@@ -448,7 +446,7 @@ typedef struct SDL_ControllerButtonEvent
*/ */
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;
@@ -582,6 +580,15 @@ typedef struct SDL_QuitEvent
Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */
} SDL_QuitEvent; } SDL_QuitEvent;
/**
* \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.*) * \brief A user-defined event type (event.user.*)
*/ */
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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
@@ -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,7 +120,7 @@ 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
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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
@@ -73,8 +73,7 @@ typedef enum
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 typedef enum
@@ -524,20 +523,6 @@ 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.
* *
@@ -613,9 +598,7 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void);
* and are centered within ~8000 of zero, though advanced UI will allow users to set * and are centered within ~8000 of zero, though advanced UI will allow users to set
* or autodetect the dead zone, which varies between controllers. * or autodetect the dead zone, which varies between controllers.
* *
* Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX.
* (fully 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 typedef enum
{ {
@@ -704,13 +687,8 @@ 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) * The state is a value ranging from -32768 to 32767. Triggers, however, range
* to 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 return a negative value. Note that this differs from the value
* reported by the lower-level SDL_GetJoystickAxis(), which normally uses
* the full range.
* *
* \param gamecontroller a game controller * \param gamecontroller a game controller
* \param axis an axis index (one of the SDL_GameControllerAxis values) * \param axis an axis index (one of the SDL_GameControllerAxis values)
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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-2024 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-2024 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-2024 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-2024 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
@@ -631,110 +631,6 @@ extern "C" {
*/ */
#define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS"
/**
* A variable containing a list of arcade stick style controllers.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES "SDL_JOYSTICK_ARCADESTICK_DEVICES"
/**
* A variable containing a list of devices that are not arcade stick style controllers. This will override SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES and the built in device list.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED"
/**
* A variable containing a list of devices that should not be considerd joysticks.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES "SDL_JOYSTICK_BLACKLIST_DEVICES"
/**
* A variable containing a list of devices that should be considered joysticks. This will override SDL_HINT_JOYSTICK_BLACKLIST_DEVICES and the built in device list.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED "SDL_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED"
/**
* A variable containing a list of flightstick style controllers.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES "SDL_JOYSTICK_FLIGHTSTICK_DEVICES"
/**
* A variable containing a list of devices that are not flightstick style controllers. This will override SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES and the built in device list.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED"
/**
* A variable containing a list of devices known to have a GameCube form factor.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES "SDL_JOYSTICK_GAMECUBE_DEVICES"
/**
* A variable containing a list of devices known not to have a GameCube form factor. This will override SDL_HINT_JOYSTICK_GAMECUBE_DEVICES and the built in device list.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED "SDL_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED"
/** /**
* \brief A variable controlling whether the HIDAPI joystick drivers should be used. * \brief A variable controlling whether the HIDAPI joystick drivers should be used.
* *
@@ -943,17 +839,6 @@ extern "C" {
*/ */
#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM" #define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM"
/**
* \brief A variable controlling whether the HIDAPI driver for the Steam Deck builtin controller should be used.
*
* This variable can be set to the following values:
* "0" - HIDAPI driver is not used
* "1" - HIDAPI driver is used
*
* The default is the value of SDL_HINT_JOYSTICK_HIDAPI
*/
#define SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK "SDL_JOYSTICK_HIDAPI_STEAMDECK"
/** /**
* \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used.
* *
@@ -1080,24 +965,6 @@ extern "C" {
*/ */
#define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED" #define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED"
/**
* A variable controlling whether IOKit should be used for controller handling.
*
* This variable can be set to the following values:
* "0" - IOKit is not used
* "1" - IOKit is used (the default)
*/
#define SDL_HINT_JOYSTICK_IOKIT "SDL_JOYSTICK_IOKIT"
/**
* A variable controlling whether GCController should be used for controller handling.
*
* This variable can be set to the following values:
* "0" - GCController is not used
* "1" - GCController is used (the default)
*/
#define SDL_HINT_JOYSTICK_MFI "SDL_JOYSTICK_MFI"
/** /**
* \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices.
* *
@@ -1140,32 +1007,6 @@ extern "C" {
*/ */
#define SDL_HINT_JOYSTICK_THREAD "SDL_JOYSTICK_THREAD" #define SDL_HINT_JOYSTICK_THREAD "SDL_JOYSTICK_THREAD"
/**
* A variable containing a list of throttle style controllers.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_THROTTLE_DEVICES "SDL_JOYSTICK_THROTTLE_DEVICES"
/**
* A variable containing a list of devices that are not throttle style controllers. This will override SDL_HINT_JOYSTICK_THROTTLE_DEVICES and the built in device list.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED "SDL_JOYSTICK_THROTTLE_DEVICES_EXCLUDED"
/** /**
* \brief A variable controlling whether Windows.Gaming.Input should be used for controller handling. * \brief A variable controlling whether Windows.Gaming.Input should be used for controller handling.
* *
@@ -1175,45 +1016,6 @@ extern "C" {
*/ */
#define SDL_HINT_JOYSTICK_WGI "SDL_JOYSTICK_WGI" #define SDL_HINT_JOYSTICK_WGI "SDL_JOYSTICK_WGI"
/**
* A variable containing a list of wheel style controllers.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_WHEEL_DEVICES "SDL_JOYSTICK_WHEEL_DEVICES"
/**
* A variable containing a list of devices that are not wheel style controllers. This will override SDL_HINT_JOYSTICK_WHEEL_DEVICES and the built in device list.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED "SDL_JOYSTICK_WHEEL_DEVICES_EXCLUDED"
/**
* A variable containing a list of devices known to have all axes centered at zero.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES "SDL_JOYSTICK_ZERO_CENTERED_DEVICES"
/** /**
* \brief Determines whether SDL enforces that DRM master is required in order * \brief Determines whether SDL enforces that DRM master is required in order
* to initialize the KMSDRM video backend. * to initialize the KMSDRM video backend.
@@ -1282,22 +1084,6 @@ extern "C" {
*/ */
#define SDL_HINT_LINUX_JOYSTICK_DEADZONES "SDL_LINUX_JOYSTICK_DEADZONES" #define SDL_HINT_LINUX_JOYSTICK_DEADZONES "SDL_LINUX_JOYSTICK_DEADZONES"
/**
* \brief A variable controlling the default SDL log levels.
*
* This variable is a comma separated set of category=level tokens that define the default logging levels for SDL applications.
*
* The category can be a numeric category, one of "app", "error", "assert", "system", "audio", "video", "render", "input", "test", or `*` for any unspecified category.
*
* The level can be a numeric level, one of "verbose", "debug", "info", "warn", "error", "critical", or "quiet" to disable that category.
*
* You can omit the category if you want to set the logging level for all categories.
*
* If this hint isn't set, the default log levels are equivalent to:
* "app=info,assert=warn,test=verbose,*=error"
*/
#define SDL_HINT_LOGGING "SDL_LOGGING"
/** /**
* \brief When set don't force the SDL app to become a foreground process * \brief When set don't force the SDL app to become a foreground process
* *
@@ -1699,32 +1485,6 @@ extern "C" {
*/ */
#define SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE "SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE" #define SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE "SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE"
/**
* A variable containing a list of ROG gamepad capable mice.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_ROG_GAMEPAD_MICE "SDL_ROG_GAMEPAD_MICE"
/**
* A variable containing a list of devices that are not ROG gamepad capable mice. This will override SDL_HINT_ROG_GAMEPAD_MICE and the built in device list.
*
* The format of the string is a comma separated list of USB VID/PID pairs
* in hexadecimal form, e.g.
*
* 0xAAAA/0xBBBB,0xCCCC/0xDDDD
*
* The variable can also take the form of @file, in which case the named
* file will be loaded and interpreted as the value of the variable.
*/
#define SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED "SDL_ROG_GAMEPAD_MICE_EXCLUDED"
/** /**
* \brief A variable controlling if VSYNC is automatically disable if doesn't reach the enough FPS * \brief A variable controlling if VSYNC is automatically disable if doesn't reach the enough FPS
* *
@@ -2682,22 +2442,6 @@ extern "C" {
*/ */
#define SDL_HINT_TRACKPAD_IS_TOUCH_ONLY "SDL_TRACKPAD_IS_TOUCH_ONLY" #define SDL_HINT_TRACKPAD_IS_TOUCH_ONLY "SDL_TRACKPAD_IS_TOUCH_ONLY"
/**
* Cause SDL to call dbus_shutdown() on quit.
*
* This is useful as a debug tool to validate memory leaks, but shouldn't ever
* be set in production applications, as other libraries used by the application
* might use dbus under the hood and this cause cause crashes if they continue
* after SDL_Quit().
*
* This variable can be set to the following values:
* "0" - SDL will not call dbus_shutdown() on quit (default)
* "1" - SDL will call dbus_shutdown() on quit
*
* This hint is available since SDL 2.30.0.
*/
#define SDL_HINT_SHUTDOWN_DBUS_ON_QUIT "SDL_SHUTDOWN_DBUS_ON_QUIT"
/** /**
* \brief An enumeration of hint priorities * \brief An enumeration of hint priorities
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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-2024 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
@@ -298,10 +298,8 @@ extern DECLSPEC void SDLCALL SDL_ClearComposition(void);
extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void); extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void);
/** /**
* Set the rectangle used to type Unicode text inputs. Native input methods * Set the rectangle used to type Unicode text inputs.
* 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.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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-2024 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-2024 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-2024 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
@@ -59,7 +59,7 @@ extern "C" {
* By default the application category is enabled at the INFO level, * By default the application category is enabled at the INFO level,
* the assert category is enabled at the WARN level, test is enabled * the assert category is enabled at the WARN level, test is enabled
* at the VERBOSE level and all other categories are enabled at the * at the VERBOSE level and all other categories are enabled at the
* ERROR level. * CRITICAL level.
*/ */
typedef enum typedef enum
{ {
@@ -352,7 +352,7 @@ 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.
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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-2024 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-2024 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-2024 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-2024 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-2024 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-2024 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-2024 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-2024 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-2024 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-2024 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,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) */
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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
@@ -166,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
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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-2024 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-2024 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-2024 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
@@ -42,7 +42,7 @@
* of the many good 3D engines. * of the many good 3D engines.
* *
* These functions must be called from the main thread. * These functions must be called from the main thread.
* See this bug for details: https://github.com/libsdl-org/SDL/issues/986 * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995
*/ */
#ifndef SDL_render_h_ #ifndef SDL_render_h_
@@ -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.30.0-0-g859844eae (" SDL_VENDOR_INFO ")" #define SDL_REVISION "SDL-release-2.28.5-0-g15ead9a40 (" SDL_VENDOR_INFO ")"
#else #else
#define SDL_REVISION "SDL-release-2.30.0-0-g859844eae" #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-2024 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-2024 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-2024 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-2024 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-2024 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
@@ -257,7 +257,7 @@ typedef uint64_t Uint64;
#define SDL_PRIs64 PRIs64 #define SDL_PRIs64 PRIs64
#elif defined(__WIN32__) || defined(__GDK__) #elif defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIs64 "I64d" #define SDL_PRIs64 "I64d"
#elif defined(__LP64__) && !defined(__APPLE__) #elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIs64 "ld" #define SDL_PRIs64 "ld"
#else #else
#define SDL_PRIs64 "lld" #define SDL_PRIs64 "lld"
@@ -268,7 +268,7 @@ typedef uint64_t Uint64;
#define SDL_PRIu64 PRIu64 #define SDL_PRIu64 PRIu64
#elif defined(__WIN32__) || defined(__GDK__) #elif defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIu64 "I64u" #define SDL_PRIu64 "I64u"
#elif defined(__LP64__) && !defined(__APPLE__) #elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIu64 "lu" #define SDL_PRIu64 "lu"
#else #else
#define SDL_PRIu64 "llu" #define SDL_PRIu64 "llu"
@@ -279,7 +279,7 @@ typedef uint64_t Uint64;
#define SDL_PRIx64 PRIx64 #define SDL_PRIx64 PRIx64
#elif defined(__WIN32__) || defined(__GDK__) #elif defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIx64 "I64x" #define SDL_PRIx64 "I64x"
#elif defined(__LP64__) && !defined(__APPLE__) #elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIx64 "lx" #define SDL_PRIx64 "lx"
#else #else
#define SDL_PRIx64 "llx" #define SDL_PRIx64 "llx"
@@ -290,7 +290,7 @@ typedef uint64_t Uint64;
#define SDL_PRIX64 PRIX64 #define SDL_PRIX64 PRIX64
#elif defined(__WIN32__) || defined(__GDK__) #elif defined(__WIN32__) || defined(__GDK__)
#define SDL_PRIX64 "I64X" #define SDL_PRIX64 "I64X"
#elif defined(__LP64__) && !defined(__APPLE__) #elif defined(__LINUX__) && defined(__LP64__)
#define SDL_PRIX64 "lX" #define SDL_PRIX64 "lX"
#else #else
#define SDL_PRIX64 "llX" #define SDL_PRIX64 "llX"
@@ -336,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>
@@ -364,14 +362,10 @@ 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 */
@@ -609,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
@@ -694,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.
*/ */
@@ -704,8 +698,8 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode,
const char *inbuf, const char *inbuf,
size_t inbytesleft); size_t inbytesleft);
#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
@@ -1,6 +1,6 @@
/* /*
Simple DirectMedia Layer Simple DirectMedia Layer
Copyright (C) 1997-2024 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-2024 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
@@ -593,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,
@@ -611,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-2024 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-2024 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-2024 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-2024 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
Loaded 100 of 376 files, more files were not shown because too many files have changed in this diff. Show more