Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 1392-2-2-15-attempting-to-draw-a-hud-graphic-with-the-same-lump-name-as-a-lua-script-crashes-the
  • 21-installer-nodd
  • 2210-pre1
  • 2210-pre2
  • 2210-rc1
  • 2210-rc2
  • 2210-rc3
  • 2211-pre1
  • 2211-pre2
  • 2211-rc1
  • 2212-pre1
  • 2212-pre2
  • 2212-pre3
  • 2212-rc1
  • 2213
  • 2214-pre1
  • 2214-pre2
  • 2214-pre3
  • 2214-pre4
  • 2_2_12
  • 64-gl-log
  • COM_ImmedExecute-lua
  • DJGPP
  • accel-momentum
  • acs
  • action-args
  • alpha-fixes
  • any-resolution
  • appveyor
  • blend-locking
  • blentran
  • blua-unary-not-fix
  • boost-tickrate
  • bustablesoundz
  • cleanup-opengl
  • cleanupmusic
  • clipmidtex
  • cmake-valgrind
  • crawlacommander-sprites
  • custom-map-names
  • custom-teams
  • cutscene-cleanup
  • dd-music-bypass
  • dd-music-fix
  • delfile2
  • deprecate-lua-dedicated-server
  • dpl-2
  • dropshadows-spawning
  • dynabsp
  • emblem-drawing
  • exchndl-xp-fix
  • extra-textures
  • few-kart-lua-changes
  • ffloorclip
  • fix-167
  • fix-cvar-conflicts
  • fix-opengl-parameter-crash
  • fix-opengl-shear-roll
  • flipfuncpointers
  • fof-lightlist-fixes
  • font-FUCK
  • frictionrefactor
  • fuck-macros-1
  • gamepad-luakeydown
  • gamepad-morefixes
  • gamepad_experiments
  • gametype-refactor
  • gametype-refactor-1
  • gametype-refactor-player-spawns
  • ghost-networking
  • gif-splitting
  • grr-lj
  • hitboxviewer
  • hwr-texture-cache-refactor
  • hwrender2
  • improve-439
  • increase-maxconditionsets
  • increase-packet-tics
  • input-display
  • input-display-translucency
  • io
  • joystick-juggling-maz
  • just-in-case
  • keycodes-only
  • ksf-wadfiles
  • ld413-mp-fix
  • levelstruct
  • libpng-version-support
  • linedef-actions
  • lj-test
  • lol-states
  • loopedsounds
  • lower-unpegged-fix
  • lua-change-gametype
  • lua-command-netids
  • lua-gfx-2
  • lua-gfx-sprites
  • lua-local
  • makefile-auto-mingw-gcc
  • makefile-tinkering
  • SRB2_release_2.1
  • SRB2_release_2.1.1
  • SRB2_release_2.1.10
  • SRB2_release_2.1.11
  • SRB2_release_2.1.12
  • SRB2_release_2.1.14
  • SRB2_release_2.1.15
  • SRB2_release_2.1.16
  • SRB2_release_2.1.16a
  • SRB2_release_2.1.17
  • SRB2_release_2.1.18
  • SRB2_release_2.1.19
  • SRB2_release_2.1.2
  • SRB2_release_2.1.20
  • SRB2_release_2.1.21
  • SRB2_release_2.1.22
  • SRB2_release_2.1.23
  • SRB2_release_2.1.24
  • SRB2_release_2.1.25
  • SRB2_release_2.1.3
  • SRB2_release_2.1.4
  • SRB2_release_2.1.5
  • SRB2_release_2.1.6
  • SRB2_release_2.1.7
  • SRB2_release_2.1.8
  • SRB2_release_2.1.9
  • SRB2_release_2.2.0
  • SRB2_release_2.2.1
  • SRB2_release_2.2.10
  • SRB2_release_2.2.11
  • SRB2_release_2.2.12
  • SRB2_release_2.2.13
  • SRB2_release_2.2.15
  • SRB2_release_2.2.2
  • SRB2_release_2.2.3
  • SRB2_release_2.2.4
  • SRB2_release_2.2.5
  • SRB2_release_2.2.6
  • SRB2_release_2.2.7
  • SRB2_release_2.2.8
  • SRB2_release_2.2.9
  • td-release-v1.0.0
142 results

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Hanicef/SRB2Classic
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Jisk/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
118 results
Select Git revision
  • 21-installer-nodd
  • 2210-pre1
  • 2210-pre2
  • 2210-rc1
  • 2210-rc2
  • 2210-rc3
  • 2211-pre1
  • 2211-pre2
  • 2211-rc1
  • 622-teamlives-hud
  • 64-gl-log
  • COM_ImmedExecute-lua
  • DJGPP
  • accel-momentum
  • alien-breed-3d
  • appveyor
  • bbox
  • blend-locking
  • blentran
  • blua-unary-not-fix
  • boost-tickrate
  • bosszero
  • bustablemobjzfix
  • bustablesoundz
  • cleanup-opengl
  • cleanupmusic
  • cmake-clang-tidy
  • cmake-enable-cxx
  • cmake-valgrind
  • crawlacommander-sprites
  • cutscene-cleanup
  • dd-music-bypass
  • dd-music-fix
  • delfile
  • deprecate-lua-dedicated-server
  • dpl-2
  • dropshadows-spawning
  • dynabsp
  • emblem-drawing
  • exchndl-xp-fix
  • few-kart-lua-changes
  • ffloorclip
  • fix-cvar-conflicts
  • fix-opengl-shear-roll
  • flipfuncpointers
  • floorsprite-and-shadow-fake-planes-fix
  • fof-lightlist-fixes
  • font-FUCK
  • font_drawer
  • frictionrefactor
  • fuck-macros-1
  • fullscreen-toggle
  • gamepad-luakeydown
  • gamepad-morefixes
  • gamepad_experiments
  • ghost-networking
  • gif-splitting
  • gitlab-ci
  • grr-lj
  • hitboxviewer
  • hwr-texture-cache-refactor
  • hwrender2
  • improve-439
  • increase-packet-tics
  • increasemaxunlockables
  • input-display
  • input-display-translucency
  • io
  • joystick-juggling-maz
  • keycodes-only
  • ksf-wadfiles
  • ld413-mp-fix
  • levelstruct
  • libpng-version-support
  • linedef-actions
  • lj-test
  • lol-states
  • loopedsounds
  • lower-unpegged-fix
  • lua-command-netids
  • lua-local
  • lua-minmax-plus-bruh-moments
  • makefile-auto-mingw-gcc
  • makefile-tinkering
  • map-components-signedness-fixes
  • master
  • menu-edits
  • mobj-dispoffset
  • models-plus-final
  • more-cleanup
  • multithread
  • musicdef-lua
  • net-test
  • netcode-refactor
  • netcode-tests
  • netxcmd-refactor
  • next
  • next-test
  • next-test-2021-7-11
  • nextmapspecialoverride
  • SRB2_release_2.1
  • SRB2_release_2.1.1
  • SRB2_release_2.1.10
  • SRB2_release_2.1.11
  • SRB2_release_2.1.12
  • SRB2_release_2.1.14
  • SRB2_release_2.1.15
  • SRB2_release_2.1.16
  • SRB2_release_2.1.16a
  • SRB2_release_2.1.17
  • SRB2_release_2.1.18
  • SRB2_release_2.1.19
  • SRB2_release_2.1.2
  • SRB2_release_2.1.20
  • SRB2_release_2.1.21
  • SRB2_release_2.1.22
  • SRB2_release_2.1.23
  • SRB2_release_2.1.24
  • SRB2_release_2.1.25
  • SRB2_release_2.1.3
  • SRB2_release_2.1.4
  • SRB2_release_2.1.5
  • SRB2_release_2.1.6
  • SRB2_release_2.1.7
  • SRB2_release_2.1.8
  • SRB2_release_2.1.9
  • SRB2_release_2.2.0
  • SRB2_release_2.2.1
  • SRB2_release_2.2.10
  • SRB2_release_2.2.11
  • SRB2_release_2.2.2
  • SRB2_release_2.2.3
  • SRB2_release_2.2.4
  • SRB2_release_2.2.5
  • SRB2_release_2.2.6
  • SRB2_release_2.2.7
  • SRB2_release_2.2.8
  • SRB2_release_2.2.9
  • td-release-v1.0.0
139 results
Show changes
Showing
with 914 additions and 479 deletions
# SDL2 CMake configuration file:
# This file is meant to be placed in a cmake subfolder of SDL2-devel-2.x.y-VC
cmake_minimum_required(VERSION 3.0...3.5)
include(FeatureSummary)
set_package_properties(SDL2 PROPERTIES
URL "https://www.libsdl.org/"
DESCRIPTION "low level access to audio, keyboard, mouse, joystick, and graphics hardware"
)
# Copied from `configure_package_config_file`
macro(set_and_check _var _file)
set(${_var} "${_file}")
if(NOT EXISTS "${_file}")
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
endif()
endmacro()
# Copied from `configure_package_config_file`
macro(check_required_components _NAME)
foreach(comp ${${_NAME}_FIND_COMPONENTS})
if(NOT ${_NAME}_${comp}_FOUND)
if(${_NAME}_FIND_REQUIRED_${comp})
set(${_NAME}_FOUND FALSE)
endif()
endif()
endforeach()
endmacro()
set(SDL2_FOUND TRUE)
if(CMAKE_SIZEOF_VOID_P STREQUAL "4")
set(_sdl_arch_subdir "x86")
elseif(CMAKE_SIZEOF_VOID_P STREQUAL "8")
set(_sdl_arch_subdir "x64")
else()
set(SDL2_FOUND FALSE)
return()
endif()
# For compatibility with autotools sdl2-config.cmake, provide SDL2_* variables.
set_and_check(SDL2_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..")
set_and_check(SDL2_EXEC_PREFIX "${CMAKE_CURRENT_LIST_DIR}/..")
set_and_check(SDL2_INCLUDE_DIR "${SDL2_PREFIX}/include")
set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIR}")
set_and_check(SDL2_BINDIR "${SDL2_PREFIX}/lib/${_sdl_arch_subdir}")
set_and_check(SDL2_LIBDIR "${SDL2_PREFIX}/lib/${_sdl_arch_subdir}")
set(SDL2_LIBRARIES SDL2::SDL2main SDL2::SDL2)
set(SDL2MAIN_LIBRARY SDL2::SDL2main)
set(SDL2TEST_LIBRARY SDL2::SDL2test)
# All targets are created, even when some might not be requested though COMPONENTS.
# This is done for compatibility with CMake generated SDL2-target.cmake files.
set(_sdl2_library "${SDL2_LIBDIR}/SDL2.lib")
set(_sdl2_dll_library "${SDL2_BINDIR}/SDL2.dll")
if(EXISTS "${_sdl2_library}" AND EXISTS "${_sdl2_dll_library}")
if(NOT TARGET SDL2::SDL2)
add_library(SDL2::SDL2 SHARED IMPORTED)
set_target_properties(SDL2::SDL2
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
IMPORTED_IMPLIB "${_sdl2_library}"
IMPORTED_LOCATION "${_sdl2_dll_library}"
COMPATIBLE_INTERFACE_BOOL "SDL2_SHARED"
INTERFACE_SDL2_SHARED "ON"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL2"
)
endif()
set(SDL2_SDL2_FOUND TRUE)
else()
set(SDL2_SDL2_FOUND FALSE)
endif()
unset(_sdl2_library)
unset(_sdl2_dll_library)
set(_sdl2main_library "${SDL2_LIBDIR}/SDL2main.lib")
if(EXISTS "${_sdl2main_library}")
if(NOT TARGET SDL2::SDL2main)
add_library(SDL2::SDL2main STATIC IMPORTED)
set_target_properties(SDL2::SDL2main
PROPERTIES
IMPORTED_LOCATION "${_sdl2main_library}"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL2"
)
endif()
set(SDL2_SDL2main_FOUND TRUE)
else()
set(SDL2_SDL2_FOUND FALSE)
endif()
unset(_sdl2main_library)
set(_sdl2test_library "${SDL2_LIBDIR}/SDL2test.lib")
if(EXISTS "${_sdl2test_library}")
if(NOT TARGET SDL2::SDL2test)
add_library(SDL2::SDL2test STATIC IMPORTED)
set_target_properties(SDL2::SDL2test
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIRS}"
IMPORTED_LOCATION "${_sdl2test_library}"
COMPATIBLE_INTERFACE_STRING "SDL_VERSION"
INTERFACE_SDL_VERSION "SDL2"
)
endif()
set(SDL2_SDL2test_FOUND TRUE)
else()
set(SDL2_SDL2_FOUND FALSE)
endif()
unset(_sdl2test_library)
check_required_components(SDL2)
# 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.
**Table Of Contents**
- [Filing a GitHub issue](#filing-a-github-issue)
- [Reporting a bug](#reporting-a-bug)
- [Suggesting enhancements](#suggesting-enhancements)
- [Contributing code](#contributing-code)
- [Forking the project](#forking-the-project)
- [Following the style guide](#following-the-style-guide)
- [Running the tests](#running-the-tests)
- [Opening a pull request](#opening-a-pull-request)
- [Contributing to the documentation](#contributing-to-the-documentation)
- [Editing a function documentation](#editing-a-function-documentation)
- [Editing the wiki](#editing-the-wiki)
## Filing a GitHub issue
### Reporting a bug
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).
- 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.
- If possible, provide a small example that reproduces your bug.
### Suggesting enhancements
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:
- the [issue tracker](https://github.com/libsdl-org/SDL/issues);
- the [discourse forum](https://discourse.libsdl.org/);
- 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).
- Describe what change you would like to happen.
## Contributing code
This section will cover how the process of forking the project, making a change and opening a pull request.
### Forking the project
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`.
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.
### 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).
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:
- 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.
For example:
```
Fix crash in SDL_FooBar.
This addresses the issue #123456 by making sure Foo was successful
before calling Bar.
```
### Running the tests
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.
- After pushing to your fork, Continuous Integration (GitHub Actions) will ensure compilation and tests still pass on other systems.
### Opening a pull request
- Head over to your fork's GitHub page.
- Click on the `Contribute` button and `Open Pull Request`.
- 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.
## Contributing to the 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.
### Editing the wiki
Other changes to the wiki should done directly from https://wiki.libsdl.org/
...@@ -13,22 +13,22 @@ supported, but you can use the "android-project-ant" directory as a template. ...@@ -13,22 +13,22 @@ supported, but you can use the "android-project-ant" directory as a template.
Requirements Requirements
================================================================================ ================================================================================
Android SDK (version 26 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: 16 (Android 4.1) 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
...@@ -68,14 +68,22 @@ Finally, a word of caution: re running androidbuild.sh wipes any changes you may ...@@ -68,14 +68,22 @@ Finally, a word of caution: re running androidbuild.sh wipes any changes you may
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. Copy the android-project directory wherever you want to keep your projects
and rename it to the name of your project.
2. Move or symlink this SDL directory into the "<project>/app/jni" directory
3. Edit "<project>/app/jni/src/Android.mk" to include your source files
4a. If you want to use Android Studio, simply open your <project> directory and start building. 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.)
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)
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)
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
...@@ -83,9 +91,9 @@ For more complex projects, follow these instructions: ...@@ -83,9 +91,9 @@ For more complex projects, follow these instructions:
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 "<project>/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 "<project>/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
...@@ -132,15 +140,15 @@ Here's an example of a minimal class file: ...@@ -132,15 +140,15 @@ 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
...@@ -179,7 +187,7 @@ may want to keep this fact in mind when building your APK, specially when large ...@@ -179,7 +187,7 @@ 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/
...@@ -206,6 +214,9 @@ You should not use the SDL renderer API while the app going in background: ...@@ -206,6 +214,9 @@ You should not use the SDL renderer API while the app going in background:
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.
(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).
...@@ -347,7 +358,7 @@ I get output from addr2line showing that it's in the quit function, in testsprit ...@@ -347,7 +358,7 @@ I get output from addr2line showing that it's in the quit function, in testsprit
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
...@@ -420,13 +431,13 @@ The Tegra Graphics Debugger is available from NVidia here: ...@@ -420,13 +431,13 @@ 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 16 the minimum required? Why is API level 19 the minimum required?
================================================================================ ================================================================================
The latest NDK toolchain doesn't support targeting earlier than API level 16. The latest NDK toolchain doesn't support targeting earlier than API level 19.
As of this writing, according to https://developer.android.com/about/dashboards/index.html As of this writing, according to https://www.composables.com/tools/distribution-chart
about 99% of the Android devices accessing Google Play support API level 16 or about 99.7% of the Android devices accessing Google Play support API level 19 or
higher (January 2018). 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
...@@ -437,7 +448,7 @@ where you only update a portion of the screen on each frame, you may notice a ...@@ -437,7 +448,7 @@ 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
...@@ -456,7 +467,7 @@ Two legitimate ways: ...@@ -456,7 +467,7 @@ Two legitimate ways:
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.
......
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 is under development. To solve these problems, a new build system based on CMake was introduced.
It works in parallel to the legacy system, so users can experiment with it It is developed in parallel to the legacy autotools build system, so users
without complication. can experiment with it without complication.
While still experimental, the build system should be usable on the following
platforms: The CMake build system is supported on the following platforms:
* FreeBSD * FreeBSD
* Linux * Linux
* VS.NET 2010 * 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
* Emscripten
* RiscOS
* Playstation Vita
## Building SDL
Assuming the source for SDL is located at `~/sdl`
```sh
cd ~
mkdir build
cd build
cmake ~/sdl
cmake --build .
```
This will build the static and dynamic versions of SDL in the `~/build` directory.
Installation can be done using:
```sh
cmake --install . # '--install' requires CMake 3.15, or newer
```
## Including SDL in your project
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 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`.
```cmake
cmake_minimum_required(VERSION 3.5)
project(mygame)
# Create an option to switch between a system sdl library and a vendored sdl library
option(MYGAME_VENDORED "Use vendored libraries" OFF)
================================================================================ if(MYGAME_VENDORED)
Usage add_subdirectory(vendored/sdl EXCLUDE_FROM_ALL)
================================================================================ else()
# 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)
Assuming the source for SDL is located at ~/sdl # 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)
endif()
cd ~ # Create your game executable target as usual
mkdir build add_executable(mygame WIN32 mygame.c)
cd build
cmake ../sdl
This will build the static and dynamic versions of SDL in the ~/build directory. # SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications
if(TARGET SDL2::SDL2main)
# 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)
endif()
# 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)
```
================================================================================ ### A system SDL library
Usage, iOS/tvOS
================================================================================ 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`.
| Component name | Description |
|----------------|--------------------------------------------------------------------------------------------|
| 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 |
| SDL2main | The SDL2main static library, available through the `SDL2::SDL2main` target |
| SDL2test | The SDL2test static library, available through the `SDL2::SDL2test` target |
### Using a vendored SDL
This only requires a copy of SDL in a subdirectory.
## CMake configuration options for platforms
### 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.
...@@ -53,32 +115,49 @@ To use, set the following CMake variables when running CMake's configuration sta ...@@ -53,32 +115,49 @@ To use, set the following CMake variables when running CMake's configuration sta
- `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 (for iOS/tvOS): #### Examples
- for iOS-Simulator, using the latest, installed SDK: - for iOS-Simulator, using the latest, installed SDK:
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64` ```bash
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
`cmake ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES=arm64` ```bash
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 ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos -DCMAKE_OSX_ARCHITECTURES="arm64;armv7s"` ```cmake
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 ~/sdl -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphoneos12.4 -DCMAKE_OSX_ARCHITECTURES=arm64` ```cmake
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 ~/sdl -DSDL_TEST=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_SYSROOT=iphonesimulator -DCMAKE_OSX_ARCHITECTURES=x86_64` ```cmake
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 ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvsimulator -DCMAKE_OSX_ARCHITECTURES=x86_64` ```cmake
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 ~/sdl -DCMAKE_SYSTEM_NAME=tvOS -DCMAKE_OSX_SYSROOT=appletvos -DCMAKE_OSX_ARCHITECTURES=arm64` ```cmake
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.
...@@ -12,40 +12,47 @@ Supports: ...@@ -12,40 +12,47 @@ Supports:
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
/etc/directfbrc The `/etc/directfbrc` file should contain the following lines to make
This 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.
...@@ -54,14 +61,18 @@ Simple Window Manager ...@@ -54,14 +61,18 @@ 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
============== ==============
...@@ -71,21 +82,25 @@ works at least on all directfb supported platforms. ...@@ -71,21 +82,25 @@ 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 ```
------------------------
# 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:
```
make linux-directfb make linux-directfb
make make
...@@ -95,13 +110,14 @@ sudo make install INSTALL_DIR=/usr/local/dfb_GL ...@@ -95,13 +110,14 @@ 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
```
...@@ -4,29 +4,29 @@ Originally posted on Ryan's Google+ account. ...@@ -4,29 +4,29 @@ 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:
...@@ -45,7 +45,7 @@ Except that is all done with a bunch of macro magic so we don't have to maintain ...@@ -45,7 +45,7 @@ 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
...@@ -56,12 +56,12 @@ Uint32 SDL_Init_DEFAULT(Uint32 flags) ...@@ -56,12 +56,12 @@ Uint32 SDL_Init_DEFAULT(Uint32 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
...@@ -69,34 +69,34 @@ export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0 ...@@ -69,34 +69,34 @@ 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
...@@ -104,35 +104,35 @@ SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize); ...@@ -104,35 +104,35 @@ 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.
Emscripten # Emscripten
================================================================================
(This documentation is not very robust; we will update and expand this later.)
## A quick note about audio
Modern web browsers will not permit web pages to produce sound before the
user has interacted with them; 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.
To solve this, most browsers will refuse to let a web app use the audio
subsystem at all before the user has interacted with (clicked on) the page
in a meaningful way. SDL-based apps also have to deal with this problem; if
the user hasn't interacted with the page, SDL_OpenAudioDevice will fail.
There are two reasonable ways to deal with this: 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, the user can
reasonably opt-in to listening, and you never get access denied to the audio
device.
Many games do not have this sort of UI, and are more rigid about starting
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.
## Building SDL/emscripten
SDL currently requires at least Emscripten 3.1.35 to build. Newer versions
are likely to work, as well.
Build: Build:
......
GDK
=====
This port allows SDL applications to run via Microsoft's Game Development Kit (GDK).
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
------------
* 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))
* 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
------
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:
* 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:
* 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.
* 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`).
* 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:
* Compilation with anything other than through the included Visual C++ solution file
## VisualC-GDK Solution
The included `VisualC-GDK/SDL.sln` solution includes the following targets for the Gaming.Desktop.x64 configuration:
* SDL2 (DLL) - This is the typical SDL2.dll, but for Gaming.Desktop.x64.
* 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.
* 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.
If you set one of the test programs as a startup project, you can run it directly from Visual Studio.
Windows GDK Setup, Detailed Steps
---------------------
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.
### 1. Add a Gaming.Desktop.x64 Configuration ###
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 ###
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.
*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.
### 3. Configuring Project Settings ###
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:
* Under C/C++ > General > Additional Include Directories, make sure the `SDL/include` path is referenced
* 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:
* `SDL2.lib`
* `SDL2main.lib` (unless not using)
* `xgameruntime.lib`
* `../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib`
* 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.
### 4. Setting up SDL_main ###
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.
### 5. Required DLLs ###
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:
* Your SDL2.dll
* "$(Console_GRDKExtLibRoot)Xbox.Services.API.C\DesignTime\CommonConfiguration\Neutral\Lib\Release\Microsoft.Xbox.Services.141.GDK.C.Thunks.dll"
* XCurl.dll
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.
### 6. Setting up MicrosoftGame.config ###
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.
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.
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.
Then, you need to set the following values to the values from Partner Center:
* Identity tag - Name and Publisher attributes
* TitleId
* MSAAppId
### 7. Adding Required Logos
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.
### 8. Copying any Data Files ###
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.
### 9. Build and Run from Visual Studio ###
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.
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
2. Switch the sandbox name with:
`XblPCSandbox SANDBOX.#`
3. (To switch back to the retail sandbox):
`XblPCSandbox RETAIL`
### 10. Packaging and Installing Locally
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.
To create the package:
1. Run "Desktop VS 2022 Gaming Command Prompt" 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)
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`
5. To install the package, use:
`wdapp install PACKAGENAME.msixvc`
6. Once the package is installed, you can run it from the start menu.
7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox.
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).
...@@ -2,7 +2,7 @@ Dollar Gestures ...@@ -2,7 +2,7 @@ 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.
...@@ -42,7 +42,7 @@ Both functions return the number of gestures successfully saved. ...@@ -42,7 +42,7 @@ 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.
...@@ -51,7 +51,7 @@ SDL_LoadDollarTemplates returns the number of templates successfully loaded. ...@@ -51,7 +51,7 @@ 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.
......
iOS iOS
====== ======
Building the Simple DirectMedia Layer for iOS 5.1+ Building the Simple DirectMedia Layer for iOS 9.0+
============================================================================== ==============================================================================
Requirements: Mac OS X 10.8 or later and the iOS 7+ SDK. Requirements: Mac OS X 10.9 or later and the iOS 9.0 or newer SDK.
Instructions: Instructions:
...@@ -111,17 +111,17 @@ e.g. ...@@ -111,17 +111,17 @@ e.g.
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
============================================================================== ==============================================================================
...@@ -185,12 +185,44 @@ Once your application is installed its directory tree looks like: ...@@ -185,12 +185,44 @@ Once your application is installed its directory tree looks like:
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
==============================================================================
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.
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.
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
#ifdef main
#undef main
#endif
int
main(int argc, char *argv[])
{
return SDL_UIKitRunApp(argc, argv, SDL_main);
}
#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:
#include "SDL_main.h"
#include <SDL.h>
#include <SDL_main.h>
Notes -- iPhone SDL limitations Notes -- iPhone SDL limitations
============================================================================== ==============================================================================
...@@ -220,7 +252,7 @@ to your Info.plist: ...@@ -220,7 +252,7 @@ to your Info.plist:
<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:
...@@ -236,15 +268,15 @@ e.g. ...@@ -236,15 +268,15 @@ e.g.
{ {
... 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 ...
#if __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);
...@@ -261,7 +293,7 @@ e.g. ...@@ -261,7 +293,7 @@ e.g.
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 6.1 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
......
...@@ -3,36 +3,36 @@ Linux ...@@ -3,36 +3,36 @@ 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 Xinerama support and the target system. So, for example if you built SDL with XRandR support and the target
system does not have the Xinerama 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 20.04, all available features enabled: Ubuntu 18.04, all available features enabled:
sudo apt-get install build-essential git make cmake autoconf automake \ sudo apt-get install build-essential git make autoconf automake libtool \
libtool pkg-config libasound2-dev libpulse-dev libaudio-dev libjack-dev \ pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev \ libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev \
libxinerama-dev libxxf86vm-dev libxss-dev libgl1-mesa-dev libdbus-1-dev \ libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libwayland-dev \
libudev-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \ libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
fcitx-libs-dev libsamplerate0-dev libsndio-dev libwayland-dev \ libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
libxkbcommon-dev libdrm-dev libgbm-dev
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 libXinerama-devel libXxf86vm-devel libXScrnSaver-devel \ libXi-devel libXScrnSaver-devel dbus-devel ibus-devel fcitx-devel \
dbus-devel ibus-devel fcitx-devel systemd-devel mesa-libGL-devel \ systemd-devel mesa-libGL-devel libxkbcommon-devel mesa-libGLES-devel \
libxkbcommon-devel mesa-libGLES-devel mesa-libEGL-devel vulkan-devel \ mesa-libEGL-devel vulkan-devel wayland-devel wayland-protocols-devel \
wayland-devel wayland-protocols-devel libdrm-devel mesa-libgbm-devel \ libdrm-devel mesa-libgbm-devel libusb-devel libdecor-devel \
libusb-devel pipewire-jack-audio-connection-kit-devel libdecor-devel \ libsamplerate-devel pipewire-jack-audio-connection-kit-devel \
libsamplerate-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
...@@ -43,7 +43,7 @@ NOTES: ...@@ -43,7 +43,7 @@ NOTES:
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. :)
...@@ -55,42 +55,42 @@ there's a few issues that may cause SDL to fail to detect your joystick. To ...@@ -55,42 +55,42 @@ 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"
...@@ -43,15 +43,14 @@ make ...@@ -43,15 +43,14 @@ make
sudo make install sudo make install
``` ```
This script builds SDL with 10.6 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 4.6 and the 10.7 SDK Please note that building SDL requires at least Xcode 6 and the 10.9 SDK.
(even if you target back to 10.6 systems). PowerPC support for Mac OS X has PowerPC support for macOS has been officially dropped as of SDL 2.0.2.
been officially dropped as of SDL 2.0.2. 32-bit Intel, using an older Xcode 32-bit Intel and macOS 10.8 runtime support has been officially dropped as
release, is still supported at the time of this writing, but current Xcode of SDL 2.24.0.
releases no longer support it, and eventually neither will SDL.
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.
...@@ -75,10 +74,10 @@ NSApplicationDelegate implementation: ...@@ -75,10 +74,10 @@ NSApplicationDelegate implementation:
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) {
...@@ -87,7 +86,7 @@ NSApplicationDelegate implementation: ...@@ -87,7 +86,7 @@ NSApplicationDelegate implementation:
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;
} }
``` ```
...@@ -197,12 +196,12 @@ normally from the Finder. ...@@ -197,12 +196,12 @@ normally from the Finder.
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:
...@@ -254,7 +253,7 @@ Use `xcode-build` in the same directory as your .pbxproj file ...@@ -254,7 +253,7 @@ Use `xcode-build` in the same directory as your .pbxproj file
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...
......
Mac OS X
==============================================================================
These instructions are for people using Apple's Mac OS X (pronounced
"ten").
From the developer's point of view, OS X is a sort of hybrid Mac and
Unix system, and you have the option of using either traditional
command line tools or Apple's IDE Xcode.
Command Line Build
==================
To build SDL using the command line, use the standard configure and make
process:
./configure
make
sudo make install
You can also build SDL as a Universal library (a single binary for both
32-bit and 64-bit Intel architectures), on Mac OS X 10.7 and newer, by using
the gcc-fat.sh script in build-scripts:
mkdir mybuild
cd mybuild
CC=$PWD/../build-scripts/gcc-fat.sh CXX=$PWD/../build-scripts/g++-fat.sh ../configure
make
sudo make install
This script builds SDL with 10.5 ABI compatibility on i386 and 10.6
ABI compatibility on x86_64 architectures. For best compatibility you
should compile your application the same way.
Please note that building SDL requires at least Xcode 4.6 and the 10.7 SDK
(even if you target back to 10.5 systems). PowerPC support for Mac OS X has
been officially dropped as of SDL 2.0.2.
To use the library once it's built, you essential have two possibilities:
use the traditional autoconf/automake/make method, or use Xcode.
==============================================================================
Caveats for using SDL with Mac OS X
==============================================================================
Some things you have to be aware of when using SDL on Mac OS X:
- If you register your own NSApplicationDelegate (using [NSApp setDelegate:]),
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
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
NSApplicationDelegate implementation:
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
{
if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) {
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
}
return NSTerminateCancel;
}
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
{
if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) {
SDL_Event event;
event.type = SDL_DROPFILE;
event.drop.file = SDL_strdup([filename UTF8String]);
return (SDL_PushEvent(&event) > 0);
}
return NO;
}
==============================================================================
Using the Simple DirectMedia Layer with a traditional Makefile
==============================================================================
An existing autoconf/automake build system for your SDL app has good chances
to work almost unchanged on OS X. However, to produce a "real" Mac OS X binary
that you can distribute to users, you need to put the generated binary into a
so called "bundle", which basically is a fancy folder with a name like
"MyCoolGame.app".
To get this build automatically, add something like the following rule to
your Makefile.am:
bundle_contents = APP_NAME.app/Contents
APP_NAME_bundle: EXE_NAME
mkdir -p $(bundle_contents)/MacOS
mkdir -p $(bundle_contents)/Resources
echo "APPL????" > $(bundle_contents)/PkgInfo
$(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/
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
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 package
name as specified in your configure.ac file.
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.
If you want the created bundles to be installed, you may want to add this
rule to your Makefile.am:
install-exec-hook: APP_NAME_bundle
rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app
mkdir -p $(DESTDIR)$(prefix)/Applications/
cp -r $< /$(DESTDIR)$(prefix)Applications/
This rule takes the Bundle created by the rule from step 3 and installs them
into "$(DESTDIR)$(prefix)/Applications/".
Again, if you want to install multiple applications, you will have to augment
the make rule accordingly.
But beware! That is only part of the story! With the above, you end up with
a bare bone .app bundle, which is double clickable from the Finder. But
there are some more things you should do before shipping your product...
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*,
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
achieve that by linking against the libraries listed by
sdl-config --static-libs
instead of those listed by
sdl-config --libs
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
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
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
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.
As a final remark, let me add that I use some of the techniques (and some
variations of them) in Exult and ScummVM; both are available in source on
the net, so feel free to take a peek at them for inspiration!
==============================================================================
Using the Simple DirectMedia Layer with Xcode
==============================================================================
These instructions are for using Apple's Xcode IDE to build SDL applications.
- First steps
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).
Because Stuffit Expander will unpack the archive into a subdirectory,
you should unpack the archive manually from the command line:
cd [path_to_SDL_source]
tar zxf Xcode.tar.gz
This will create a new folder called Xcode, which you can browse
normally from the Finder.
- Building the Framework
The SDL Library is packaged as a framework bundle, an organized
relocatable folder hierarchy of executable code, interface headers,
and additional resources. For practical purposes, you can think of a
framework as a more user and system-friendly shared library, whose library
file behaves more or less like a standard UNIX shared library.
To build the framework, simply open the framework project and build it.
By default, the framework bundle "SDL.framework" is installed in
/Library/Frameworks. Therefore, the testers and project stationary expect
it to be located there. However, it will function the same in any of the
following locations:
~/Library/Frameworks
/Local/Library/Frameworks
/System/Library/Frameworks
- Build Options
There are two "Build Styles" (See the "Targets" tab) for SDL.
"Deployment" should be used if you aren't tweaking the SDL library.
"Development" should be used to debug SDL apps or the library itself.
- Building the Testers
Open the SDLTest project and build away!
- Using the Project Stationary
Copy the stationary to the indicated folders to access it from
the "New Project" and "Add target" menus. What could be easier?
- Setting up a new project by hand
Some of you won't want to use the Stationary so I'll give some tips:
* Create a new "Cocoa Application"
* Add src/main/macosx/SDLMain.m , .h and .nib to your project
* Remove "main.c" from your project
* Remove "MainMenu.nib" from your project
* Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path
* Add "$(HOME)/Library/Frameworks" to the frameworks search path
* Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS"
* Set the "Main Nib File" under "Application Settings" to "SDLMain.nib"
* Add your files
* Clean and build
- Building from command line
Use pbxbuild in the same directory as your .pbproj file
- Running your app
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
"Executables" panel of the target settings.
- Implementation Notes
Some things that may be of interest about how it all works...
* Working directory
As defined in the SDL_main.m file, the working directory of your SDL app
is by default set to its parent. You may wish to change this to better
suit your needs.
* You have a Cocoa App!
Your SDL app is essentially a Cocoa application. When your app
starts up and the libraries finish loading, a Cocoa procedure is called,
which sets up the working directory and calls your main() method.
You are free to modify your Cocoa app with generally no consequence
to SDL. You cannot, however, easily change the SDL window itself.
Functionality may be added in the future to help this.
Known bugs are listed in the file "BUGS.txt".
# Nintendo 3DS
SDL port for the Nintendo 3DS [Homebrew toolchain](https://devkitpro.org/) contributed by:
- [Pierre Wendling](https://github.com/FtZPetruska)
Credits to:
- The awesome people who ported SDL to other homebrew platforms.
- The Devkitpro team for making all the tools necessary to achieve this.
## Building
To build for the Nintendo 3DS, make sure you have devkitARM and cmake installed and run:
```bash
cmake -S. -Bbuild -DCMAKE_TOOLCHAIN_FILE="$DEVKITPRO/cmake/3DS.cmake" -DCMAKE_BUILD_TYPE=Release
cmake --build build
cmake --install build
```
## Notes
- Currently only software rendering is supported.
- 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.
- `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.
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!
================================================================================ ================================================================================
...@@ -17,15 +17,15 @@ Building SDL for NaCl ...@@ -17,15 +17,15 @@ 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".
As an example of how to create a deployable app a Makefile project is provided Then "make".
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 As an example of how to create a deployable app a Makefile project is provided
path can't be modified externally, so the linker won't find SDL's binaries unless 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
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),
...@@ -38,20 +38,20 @@ Running tests ...@@ -38,20 +38,20 @@ 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).
...@@ -60,28 +60,28 @@ RWops and nacl_io ...@@ -60,28 +60,28 @@ 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
......
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).
Compiling
---------
SDL is part of the [N-Gage SDK.](https://github.com/ngagesdk) project.
The library is included in the
[toolchain](https://github.com/ngagesdk/ngage-toolchain) as a
sub-module.
A complete example project based on SDL2 can be found in the GitHub
account of the SDK: [Wordle](https://github.com/ngagesdk/wordle).
Current level of implementation
-------------------------------
The video driver currently provides full screen video support with
keyboard input.
At the moment only the software renderer works.
Audio is not yet implemented.
Acknowledgements
----------------
Thanks to Hannu Viitala, Kimmo Kinnunen and Markus Mertama for the
valuable insight into Symbian programming. Without the SDL 1.2 port
which was specially developed for CDoom (Doom for the Nokia 9210), this
adaptation would not have been possible.
I would like to thank my friends
[Razvan](https://twitter.com/bewarerazvan) and [Dan
Whelan](https://danwhelan.ie/), for their continuous support. Without
you and the [N-Gage community](https://discord.gg/dbUzqJ26vs), I would
have lost my patience long ago.
Last but not least, I would like to thank the development team of
[EKA2L1](https://12z1.com/) (an experimental Symbian OS emulator). Your
patience and support in troubleshooting helped me a lot.
...@@ -3,7 +3,7 @@ Simple DirectMedia Layer 2 for OS/2 & eComStation ...@@ -3,7 +3,7 @@ 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 and audio capture not supported by this port. OpenGL not supported by this port.
Additional optional environment variables: Additional optional environment variables:
......
Pandora Pandora
===================================================================== =====================================================================
( http://openpandora.org/ ) ( http://openpandora.org/ )
......
PS2
======
SDL2 port for the Sony Playstation 2 contributed by:
- Francisco Javier Trujillo Mata
Credit to
- 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.
## Building
To build SDL2 library for the PS2, make sure you have the latest PS2Dev status and run:
```bash
cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PS2DEV/ps2sdk/ps2dev.cmake
cmake --build build
cmake --install build
```
## Hints
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.
## 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.
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:
```c
.....
SDL_PS2_SKIP_IOP_RESET();
int main(int argc, char *argv[])
{
.....
```
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.
## Getting PS2 Dev
[Installing PS2 Dev](https://github.com/ps2dev/ps2dev)
## Running on PCSX2 Emulator
[PCSX2](https://github.com/PCSX2/pcsx2)
[More PCSX2 information](https://pcsx2.net/)
## To Do
- PS2 Screen Keyboard
- Dialogs
- Others
PSP PSP
====== ======
SDL port for the Sony PSP contributed by SDL2 port for the Sony PSP contributed by:
Captian Lex - Captian Lex
- Francisco Javier Trujillo Mata
- 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 psp-config is in the path and run: ```bash
make -f Makefile.psp cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$PSPDEV/psp/share/pspdev.cmake
cmake --build build
cmake --install build
```
## Getting PSP Dev
[Installing PSP Dev](https://github.com/pspdev/pspdev)
## Running on PPSSPP Emulator
[PPSSPP](https://github.com/hrydgard/ppsspp)
Getting PSP toolchain [Build Instructions](https://github.com/hrydgard/ppsspp/wiki/Build-instructions)
---------------------
https://github.com/pspdev/psptoolchain
Running on PPSSPP Emulator
--------------------------
https://github.com/hrydgard/ppsspp
( https://github.com/hrydgard/ppsspp/wiki/Build-instructions )
Compiling an HelloWorld ## Compiling a HelloWorld
----------------------- [PSP Hello World](https://psp-dev.org/doku.php?id=tutorial:hello_world)
https://psp-dev.org/doku.php?id=tutorial:hello_world
To Do ## To Do
------ - PSP Screen Keyboard
PSP Screen Keyboard - Dialogs