This is an example application for sdl2.
Click on the SDL module in the link for a tutorial on how to get started with sdl2.
You will need to install Stack.
You will also need sdl2 libraries:
Note: You don't have to install ttf, image and mixer for this snake game to work, but you might want to use fonts, images and sounds later.
sudo apt install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev
brew install sdl2 sdl2_ttf sdl2_image sdl2_mixer
stack exec -- pacman -Syu
stack exec -- pacman -S mingw-w64-x86_64-pkg-config mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_image mingw-w64-x86_64-SDL2_ttf mingw-w64-x86_64-SDL2_mixer
stack build && stack exec app
- Do nothing when the user tries to move to the direction the snake is coming from instead of failing
- Change the snake's speed
- Add a key to restart the game
- Keep score and report to the user
- Add obstacles
- Play a sound when the snake eats the apple
- Report game over to the game window instead of to the console