The SDL wrapper is composed of two projects:
gnat_sdl
provides a thin wrapper around the SDL API. It is not meant to be used directly, but rather through thegame_support
project.game_support
provides some Ada constructs that sit on top of the SDL wrapper.
You'll need to have the base libraries properly installed on your system, as well as the SDL itself.
For Windows users, you must download the DLL for the following libraries
- SDL2.
- SDL2 ttf, zlib, and libfreetype
- Extract all the DLL files to a the target directory
- Add the DLL directory to your
LIBRARY_PATH
environment variable:
For Linux users, you'll need to install
- libsdl2-dev
- libglu1-mesa-dev
- freeglut3-dev
- libsdl2-ttf-dev
Please note: These instruction were tested on Ubuntu and may change depending on your OS, in case of doubts always refer to your distribution's documentation.
You'll need to set your GPR_PROJECT_PATH
environment variable to
<gnat_sdl/ directory>:<game_support/ directory>
.
Add export GPR_PROJECT_PATH=<gnat_sdl/ directory>:<game_support/ directory>:$GPR_PROJECT_PATH
to
your ~/.profile
.
Set GPR_PROJECT_PATH
to the value above.
Once the environment variables and libraries are installed properly, you should be able to start compilation for any GPR file that uses the API, with minimal configuration:
You need to select a SDL Backend build option that fits your install.
For example, if you installed the SDL2 library as recommended, you need to
select gnat_sdl2
as sdl_backend
in the GNAT Studio projects scenario editor:
For manual GPR Build, use the -Xsdl_backend=SDL2
option
gprbuild -Xsdl_backend=gnat_sdl2 project.gpr
Examples of the use can be found in courses/fundamentals_of_ada/labs/solar_system
.
Validate by clicking the checkmark on the side.
In case of issues, try changing the backend
option to different values.
The LOADER
should be ROM
and check that HOST
is set to your current OS.