Skip to content

Commit 5b7b3da

Browse files
committed
Sync wiki -> headers.
1 parent 0a0dfdb commit 5b7b3da

27 files changed

+886
-880
lines changed

docs/README-.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
3+
<!-- BEGIN CATEGORY LIST -->
4+
- [raspberrypi](raspberrypi)
5+
<!-- END CATEGORY LIST -->
6+

docs/README-android.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ How the port works
2626
================================================================================
2727

2828
- Android applications are Java-based, optionally with parts written in C
29-
- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
29+
- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to
3030
the SDL library
31-
- This means that your application C code must be placed inside an Android
31+
- This means that your application C code must be placed inside an Android
3232
Java project, along with some C support code that communicates with Java
3333
- This eventually produces a standard Android .apk package
3434

@@ -69,7 +69,7 @@ done in the build directory for the app!
6969

7070

7171
For more complex projects, follow these instructions:
72-
72+
7373
1. Copy the android-project directory wherever you want to keep your projects
7474
and rename it to the name of your project.
7575
2. Move or symlink this SDL directory into the "<project>/app/jni" directory
@@ -132,15 +132,15 @@ Here's an example of a minimal class file:
132132

133133
--- MyGame.java --------------------------
134134
package com.gamemaker.game;
135-
136-
import org.libsdl.app.SDLActivity;
137-
135+
136+
import org.libsdl.app.SDLActivity;
137+
138138
/**
139-
* A sample wrapper class that just calls SDLActivity
140-
*/
141-
139+
* A sample wrapper class that just calls SDLActivity
140+
*/
141+
142142
public class MyGame extends SDLActivity { }
143-
143+
144144
------------------------------------------
145145

146146
Then replace "SDLActivity" in AndroidManifest.xml with the name of your
@@ -179,7 +179,7 @@ may want to keep this fact in mind when building your APK, specially when large
179179
files are involved.
180180
For more information on which extensions get compressed by default and how to
181181
disable this behaviour, see for example:
182-
182+
183183
http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/
184184

185185

@@ -350,7 +350,7 @@ I get output from addr2line showing that it's in the quit function, in testsprit
350350
You can add logging to your code to help show what's happening:
351351

352352
#include <android/log.h>
353-
353+
354354
__android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x);
355355

356356
If you need to build without optimization turned on, you can create a file called
@@ -440,7 +440,7 @@ where you only update a portion of the screen on each frame, you may notice a
440440
variety of visual glitches on Android, that are not present on other platforms.
441441
This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2
442442
contexts, in particular the use of the eglSwapBuffers function. As stated in the
443-
documentation for the function "The contents of ancillary buffers are always
443+
documentation for the function "The contents of ancillary buffers are always
444444
undefined after calling eglSwapBuffers".
445445
Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED
446446
is not possible for SDL as it requires EGL 1.4, available only on the API level
@@ -459,7 +459,7 @@ Two legitimate ways:
459459
Activity by calling Activity.finish().
460460

461461
- Android OS can decide to terminate your application by calling onDestroy()
462-
(see Activity life cycle). Your application will receive a SDL_QUIT event you
462+
(see Activity life cycle). Your application will receive a SDL_QUIT event you
463463
can handle to save things and quit.
464464

465465
Don't call exit() as it stops the activity badly.

docs/README-cmake.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
(www.cmake.org)
44

55
SDL's build system was traditionally based on autotools. Over time, this
6-
approach has suffered from several issues across the different supported
6+
approach has suffered from several issues across the different supported
77
platforms.
88
To solve these problems, a new build system based on CMake was introduced.
9-
It is developed in parallel to the legacy autotools build system, so users
9+
It is developed in parallel to the legacy autotools build system, so users
1010
can experiment with it without complication.
1111

1212
The CMake build system is supported on the following platforms:
@@ -59,15 +59,15 @@ if(MYGAME_VENDORED)
5959
else()
6060
# 1. Look for a SDL2 package, 2. look for the SDL2 component and 3. fail if none can be found
6161
find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2)
62-
63-
# 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available
62+
63+
# 1. Look for a SDL2 package, 2. Look for the SDL2maincomponent and 3. DO NOT fail when SDL2main is not available
6464
find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main)
6565
endif()
6666
67-
# Create your game executable target as usual
67+
# Create your game executable target as usual
6868
add_executable(mygame WIN32 mygame.c)
6969
70-
# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications
70+
# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications
7171
if(TARGET SDL2::SDL2main)
7272
# It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static)
7373
target_link_libraries(mygame PRIVATE SDL2::SDL2main)

docs/README-directfb.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Supports:
1212
What you need:
1313

1414
* DirectFB 1.0.1, 1.2.x, 1.3.0
15-
* Kernel-Framebuffer support: required: vesafb, radeonfb ....
15+
* Kernel-Framebuffer support: required: vesafb, radeonfb ....
1616
* Mesa 7.0.x - optional for OpenGL
1717

1818
The `/etc/directfbrc` file should contain the following lines to make
@@ -44,7 +44,7 @@ To use hardware accelerated YUV-overlays for YUV-textures, use:
4444
export SDL_DIRECTFB_YUV_DIRECT=1
4545
```
4646

47-
This is disabled by default. It will only support one
47+
This is disabled by default. It will only support one
4848
YUV texture, namely the first. Every other YUV texture will be
4949
rendered in software.
5050

@@ -84,18 +84,18 @@ As of this writing 20100802 you need to pull Mesa from git and do the following:
8484

8585
```
8686
git clone git://anongit.freedesktop.org/git/mesa/mesa
87-
cd mesa
87+
cd mesa
8888
git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a
8989
```
9090

9191
Edit `configs/linux-directfb` so that the Directories-section looks like this:
9292

9393
```
9494
# Directories
95-
SRC_DIRS = mesa glu
95+
SRC_DIRS = mesa glu
9696
GLU_DIRS = sgi
9797
DRIVER_DIRS = directfb
98-
PROGRAM_DIRS =
98+
PROGRAM_DIRS =
9999
```
100100

101101
Then do the following:

docs/README-dynapi.md

+54-54
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ Originally posted on Ryan's Google+ account.
44

55
Background:
66

7-
- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2,
8-
but developers are shipping their own SDL2 with individual Steam games.
9-
These games might stop getting updates, but a newer SDL2 might be needed later.
10-
Certainly we'll always be fixing bugs in SDL, even if a new video target isn't
7+
- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2,
8+
but developers are shipping their own SDL2 with individual Steam games.
9+
These games might stop getting updates, but a newer SDL2 might be needed later.
10+
Certainly we'll always be fixing bugs in SDL, even if a new video target isn't
1111
ever needed, and these fixes won't make it to a game shipping its own SDL.
12-
- Even if we replace the SDL2 in those games with a compatible one, that is to
13-
say, edit a developer's Steam depot (yuck!), there are developers that are
14-
statically linking SDL2 that we can't do this for. We can't even force the
12+
- Even if we replace the SDL2 in those games with a compatible one, that is to
13+
say, edit a developer's Steam depot (yuck!), there are developers that are
14+
statically linking SDL2 that we can't do this for. We can't even force the
1515
dynamic loader to ignore their SDL2 in this case, of course.
1616
- If you don't ship an SDL2 with the game in some form, people that disabled the
17-
Steam Runtime, or just tried to run the game from the command line instead of
17+
Steam Runtime, or just tried to run the game from the command line instead of
1818
Steam might find themselves unable to run the game, due to a missing dependency.
1919
- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target
20-
generic Linux boxes that may or may not have SDL2 installed, you have to ship
21-
the library or risk a total failure to launch. So now, you might have to have
22-
a non-Steam build plus a Steam build (that is, one with and one without SDL2
23-
included), which is inconvenient if you could have had one universal build
20+
generic Linux boxes that may or may not have SDL2 installed, you have to ship
21+
the library or risk a total failure to launch. So now, you might have to have
22+
a non-Steam build plus a Steam build (that is, one with and one without SDL2
23+
included), which is inconvenient if you could have had one universal build
2424
that works everywhere.
25-
- We like the zlib license, but the biggest complaint from the open source
26-
community about the license change is the static linking. The LGPL forced this
25+
- We like the zlib license, but the biggest complaint from the open source
26+
community about the license change is the static linking. The LGPL forced this
2727
as a legal, not technical issue, but zlib doesn't care. Even those that aren't
28-
concerned about the GNU freedoms found themselves solving the same problems:
29-
swapping in a newer SDL to an older game often times can save the day.
28+
concerned about the GNU freedoms found themselves solving the same problems:
29+
swapping in a newer SDL to an older game often times can save the day.
3030
Static linking stops this dead.
3131

3232
So here's what we did:
@@ -45,7 +45,7 @@ Except that is all done with a bunch of macro magic so we don't have to maintain
4545
every one of these.
4646
4747
What is jump_table.SDL_init()? Eventually, that's a function pointer of the real
48-
SDL_Init() that you've been calling all this time. But at startup, it looks more
48+
SDL_Init() that you've been calling all this time. But at startup, it looks more
4949
like this:
5050
5151
```c
@@ -56,83 +56,83 @@ Uint32 SDL_Init_DEFAULT(Uint32 flags)
5656
}
5757
```
5858

59-
SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function
60-
pointers, which means that this `_DEFAULT` function never gets called again.
59+
SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function
60+
pointers, which means that this `_DEFAULT` function never gets called again.
6161
First call to any SDL function sets the whole thing up.
6262

6363
So you might be asking, what was the value in that? Isn't this what the operating
64-
system's dynamic loader was supposed to do for us? Yes, but now we've got this
64+
system's dynamic loader was supposed to do for us? Yes, but now we've got this
6565
level of indirection, we can do things like this:
6666

6767
```bash
6868
export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0
6969
./MyGameThatIsStaticallyLinkedToSDL2
7070
```
7171

72-
And now, this game that is statically linked to SDL, can still be overridden
73-
with a newer, or better, SDL. The statically linked one will only be used as
72+
And now, this game that is statically linked to SDL, can still be overridden
73+
with a newer, or better, SDL. The statically linked one will only be used as
7474
far as calling into the jump table in this case. But in cases where no override
75-
is desired, the statically linked version will provide its own jump table,
75+
is desired, the statically linked version will provide its own jump table,
7676
and everyone is happy.
7777

7878
So now:
79-
- Developers can statically link SDL, and users can still replace it.
79+
- Developers can statically link SDL, and users can still replace it.
8080
(We'd still rather you ship a shared library, though!)
81-
- Developers can ship an SDL with their game, Valve can override it for, say,
82-
new features on SteamOS, or distros can override it for their own needs,
81+
- Developers can ship an SDL with their game, Valve can override it for, say,
82+
new features on SteamOS, or distros can override it for their own needs,
8383
but it'll also just work in the default case.
84-
- Developers can ship the same package to everyone (Humble Bundle, GOG, etc),
84+
- Developers can ship the same package to everyone (Humble Bundle, GOG, etc),
8585
and it'll do the right thing.
86-
- End users (and Valve) can update a game's SDL in almost any case,
86+
- End users (and Valve) can update a game's SDL in almost any case,
8787
to keep abandoned games running on newer platforms.
88-
- Everyone develops with SDL exactly as they have been doing all along.
88+
- Everyone develops with SDL exactly as they have been doing all along.
8989
Same headers, same ABI. Just get the latest version to enable this magic.
9090

9191

9292
A little more about SDL_InitDynamicAPI():
9393

94-
Internally, InitAPI does some locking to make sure everything waits until a
95-
single thread initializes everything (although even SDL_CreateThread() goes
94+
Internally, InitAPI does some locking to make sure everything waits until a
95+
single thread initializes everything (although even SDL_CreateThread() goes
9696
through here before spinning a thread, too), and then decides if it should use
97-
an external SDL library. If not, it sets up the jump table using the current
97+
an external SDL library. If not, it sets up the jump table using the current
9898
SDL's function pointers (which might be statically linked into a program, or in
99-
a shared library of its own). If so, it loads that library and looks for and
99+
a shared library of its own). If so, it loads that library and looks for and
100100
calls a single function:
101101

102102
```c
103103
SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize);
104104
```
105105
106106
That function takes a version number (more on that in a moment), the address of
107-
the jump table, and the size, in bytes, of the table.
108-
Now, we've got policy here: this table's layout never changes; new stuff gets
109-
added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all
107+
the jump table, and the size, in bytes, of the table.
108+
Now, we've got policy here: this table's layout never changes; new stuff gets
109+
added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all
110110
the needed functions if tablesize <= sizeof its own jump table. If tablesize is
111111
bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but
112112
if it's smaller, we know we can provide the entire API that the caller needs.
113113
114-
The version variable is a failsafe switch.
115-
Right now it's always 1. This number changes when there are major API changes
116-
(so we know if the tablesize might be smaller, or entries in it have changed).
117-
Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not
118-
inconceivable to have a small dispatch library that only supplies this one
114+
The version variable is a failsafe switch.
115+
Right now it's always 1. This number changes when there are major API changes
116+
(so we know if the tablesize might be smaller, or entries in it have changed).
117+
Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not
118+
inconceivable to have a small dispatch library that only supplies this one
119119
function and loads different, otherwise-incompatible SDL libraries and has the
120-
right one initialize the jump table based on the version. For something that
121-
must generically catch lots of different versions of SDL over time, like the
120+
right one initialize the jump table based on the version. For something that
121+
must generically catch lots of different versions of SDL over time, like the
122122
Steam Client, this isn't a bad option.
123123
124124
Finally, I'm sure some people are reading this and thinking,
125-
"I don't want that overhead in my project!"
125+
"I don't want that overhead in my project!"
126126
127-
To which I would point out that the extra function call through the jump table
128-
probably wouldn't even show up in a profile, but lucky you: this can all be
129-
disabled. You can build SDL without this if you absolutely must, but we would
130-
encourage you not to do that. However, on heavily locked down platforms like
127+
To which I would point out that the extra function call through the jump table
128+
probably wouldn't even show up in a profile, but lucky you: this can all be
129+
disabled. You can build SDL without this if you absolutely must, but we would
130+
encourage you not to do that. However, on heavily locked down platforms like
131131
iOS, or maybe when debugging, it makes sense to disable it. The way this is
132-
designed in SDL, you just have to change one #define, and the entire system
133-
vaporizes out, and SDL functions exactly like it always did. Most of it is
134-
macro magic, so the system is contained to one C file and a few headers.
135-
However, this is on by default and you have to edit a header file to turn it
136-
off. Our hopes is that if we make it easy to disable, but not too easy,
137-
everyone will ultimately be able to get what they want, but we've gently
132+
designed in SDL, you just have to change one #define, and the entire system
133+
vaporizes out, and SDL functions exactly like it always did. Most of it is
134+
macro magic, so the system is contained to one C file and a few headers.
135+
However, this is on by default and you have to edit a header file to turn it
136+
off. Our hopes is that if we make it easy to disable, but not too easy,
137+
everyone will ultimately be able to get what they want, but we've gently
138138
nudged everyone towards what we think is the best solution.

0 commit comments

Comments
 (0)