I want to introduce you my first SDL2 application. It is a clone of a famous amiga game.
C source code and a window-exe file for the game is included.
if you want to compile under linux there is also a make file included. Hope you enjoy this little game/demo.
game sound is realised with a very very small piece of sdl_mixer.
levelgroups and configuration files are stored in XML format. Ezxml by Aaron Voisineis is used as a XML parser.
level data is compressed with miniz by Rich Geldreich.
own buttons, radiobuttons and checkboxes
supported input devices: keyboard, game controller (tested with XBox controller) and joystick (tested with competition pro usb)
linux compilation: a simple makefile is included.
windows compilation: a code:blocks project is included, but the toolschain mingw64 should be sufficient, a windows exe file is included in the package.
level editor and many levels included
project was started in september 2022
Maybe this project is helpful for other SDL beginners like me.
I use only mono sound samples for the game and the game music is played in stereo.
Iām pretty sure that SDL2 doesnāt support āspatialized soundā / surround / 7.1 sound āout of the boxā.
I canāt found surround support even in the SDL_mixer library.
If Iām wrong, someone could please correct me.
OK, if āspatialized soundā with two channels is sufficient then you can use SDL_mixer.
There are some functions in SDL_mixer for your purpose:
panning: int Mix_SetPanning(int channel, Uint8 left, Uint8 right);
position: int Mix_SetPosition(int channel, Sint16 angle, Uint8 distance);
distance: int Mix_SetDistance(int channel, Uint8 distance);
I recommend to play around with these functions. Before you can do it you should be able to play a wav sound with SDL_mixer. wav data must be first āconvertedā into chunks and can then be played with Mix_PlayChannel(channel,&chunk,0) SDL2_mixer/Mix_PlayChannel - SDL Wiki.