Simple DirectMedia Layer: Difference between revisions
m David moved page SDL to Simple DirectMedia Layer |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
==Getting Started== | ==Getting Started== | ||
===Installation=== | ===Installation=== | ||
I suggest including SDL2 as a git submodule so you don't need to install it. | I suggest including SDL2 as a git submodule so you don't need to install it.<br> | ||
Simply clone SDL2 into a folder such as <code>extern</code> and include the following in your CMakeLists: | |||
<syntaxhighlight lang="cmake"> | |||
add_subdirectory(extern/SDL EXCLUDE_FROM_ALL) | |||
include_directories(${SDL2_BINARY_DIR}/include) | |||
# add_executable(my_app src/main.cpp) | |||
target_link_libraries(my_app SDL2::SDL2-static) | |||
</syntaxhighlight> | |||
Then you can include SDL in your source: <code>#include <SDL.h></code>. | |||
You may also want [https://github.com/libSDL2pp/libSDL2pp libSDL2pp/libSDL2pp] for C++ bindings. | |||
==Resources== | ==Resources== | ||
* [https://lazyfoo.net/tutorials/SDL/ Lazy Foo's Beginning Game Programming v2.0] | * [https://lazyfoo.net/tutorials/SDL/ Lazy Foo's Beginning Game Programming v2.0] |
Latest revision as of 22:04, 15 June 2022
Simple Directmedia Layer (SDL) is a library to access audio, graphics, and controllers.
It can be used for developing games and graphics applications without a full-blown game engine like Unity.
The current version is SDL2.
Getting Started
Installation
I suggest including SDL2 as a git submodule so you don't need to install it.
Simply clone SDL2 into a folder such as extern
and include the following in your CMakeLists:
add_subdirectory(extern/SDL EXCLUDE_FROM_ALL)
include_directories(${SDL2_BINARY_DIR}/include)
# add_executable(my_app src/main.cpp)
target_link_libraries(my_app SDL2::SDL2-static)
Then you can include SDL in your source: #include <SDL.h>
.
You may also want libSDL2pp/libSDL2pp for C++ bindings.