Skip to content

eiffel-wrap-c/wrap_sdl

Repository files navigation

wrap_sdl

wrap_sdl is an Eiffel binding of SDL API using WrapC tool.

Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.

Requirements

Download and Install

Check the following link to learn more about SDL installation https://wiki.libsdl.org/Installation

Linux

SDL

Download the release-2.0.12 https://hg.libsdl.org/SDL

tar -xvf SDL-355a4f94a782.tar.gz

cd  SDL-355a4f94a782

mkdir build
cd build
../configure
make
sudo make install

Rebuild the ldconfig cache using

sudo ldconfig 

SDL_image

Download the release-2.0.12 https://hg.libsdl.org/SDL_image/

tar -xvf SDL_image-59a4c1ea96f3.tar.gz

cd  SDL_image-59a4c1ea96f3

mkdir build
cd build
../configure
make
sudo make install

Rebuild the ldconfig cache using

sudo ldconfig 

Optionally you can use vckpg, a C++ Library Manager for Windows, Linux, and MacOS.

Windows

Using vcpkg (https://github.com/microsoft/vcpkg) tool, you can install lib sdl2 library

vcpkg install sdl2:x64-windows
vcpkg install sdl2-image:x64-windows

On windows you will need to copy SDL2.lib to PROJECT_PATH\sdl\C\lib and SDL2_image.lib to PROJECT_PATH\sdl_image\C\lib Be sure to have the dll's on th PATH before to run the example. At the moment there is no support for static linking with wrap_sdl project.

Status

Work in progress

Generate the SDL Eiffel wrapper code.

It's recommended to generate the code yourself instead of use the generated code. To do that just run the following script. Before to run it, double check you have the required dependencies.

Windows

install.bat

Linux

./install.sh

This script will generate the wrapper and also will compile the C library glue code, required to execute the examples.

Examples

The examples are based on the following SDL tutorial http://lazyfoo.net/tutorials/SDL/index.php

How to compile the C library glue code.

Before to use the examples you will need to compile the C glue code, go to

sld/generated_wrapper/c/src

and

sld_image/generated_wrapper/c/src

and run

finish_freezing --library

It will copy the C lib eif_sdl.a to $ECF_CONFIG_PATH/C/spec/$(ISE_PLATFORM)/lib/ or eif_sdl.lib to $ECF_CONFIG_PATH/C/spec/$ISE_C_COMPILER/$ISE_PLATFORM/lib

Releases

No releases published

Packages

No packages published

Languages