Skip to content

Latest commit

 

History

History
73 lines (45 loc) · 2.53 KB

README.md

File metadata and controls

73 lines (45 loc) · 2.53 KB

How to use the SDL wrapper

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 the game_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.

SDL install

Windows

For Windows users, you must download the DLL for the following libraries

Linux

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.

Ada Libraries Install

You'll need to set your GPR_PROJECT_PATH environment variable to <gnat_sdl/ directory>:<game_support/ directory>.

Linux

Add export GPR_PROJECT_PATH=<gnat_sdl/ directory>:<game_support/ directory>:$GPR_PROJECT_PATH to your ~/.profile.

Windows

Set GPR_PROJECT_PATH to the value above.

Running examples

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 SDL2, select gnat_sdl2 as sdl_backend

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.

Troubleshooting

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.