Simple DirectMedia Layer

From David's Wiki
(Redirected from SDL)
\( \newcommand{\P}[]{\unicode{xB6}} \newcommand{\AA}[]{\unicode{x212B}} \newcommand{\empty}[]{\emptyset} \newcommand{\O}[]{\emptyset} \newcommand{\Alpha}[]{Α} \newcommand{\Beta}[]{Β} \newcommand{\Epsilon}[]{Ε} \newcommand{\Iota}[]{Ι} \newcommand{\Kappa}[]{Κ} \newcommand{\Rho}[]{Ρ} \newcommand{\Tau}[]{Τ} \newcommand{\Zeta}[]{Ζ} \newcommand{\Mu}[]{\unicode{x039C}} \newcommand{\Chi}[]{Χ} \newcommand{\Eta}[]{\unicode{x0397}} \newcommand{\Nu}[]{\unicode{x039D}} \newcommand{\Omicron}[]{\unicode{x039F}} \DeclareMathOperator{\sgn}{sgn} \def\oiint{\mathop{\vcenter{\mathchoice{\huge\unicode{x222F}\,}{\unicode{x222F}}{\unicode{x222F}}{\unicode{x222F}}}\,}\nolimits} \def\oiiint{\mathop{\vcenter{\mathchoice{\huge\unicode{x2230}\,}{\unicode{x2230}}{\unicode{x2230}}{\unicode{x2230}}}\,}\nolimits} \)

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.

Resources