2019-02-04 00:06:04 +01:00
|
|
|
# Basic C SDL2 project
|
2018-10-28 15:06:27 +01:00
|
|
|
|
2019-02-04 00:06:04 +01:00
|
|
|
This project is a basic C [SDL2][SDL] project that uses [CMake][] as a build system.
|
2018-10-28 15:06:27 +01:00
|
|
|
|
2018-10-28 15:08:50 +01:00
|
|
|
## Dependencies
|
|
|
|
|
|
2018-10-28 18:46:41 +01:00
|
|
|
- [Git][]
|
2018-10-28 15:08:50 +01:00
|
|
|
- C Compiler (gcc, ...)
|
2018-10-28 18:46:41 +01:00
|
|
|
- [CMake][]
|
|
|
|
|
- [SDL2][SDL] library
|
2018-10-28 15:08:50 +01:00
|
|
|
|
|
|
|
|
**On Debian/Ubuntu based distributions, use the following command:**
|
|
|
|
|
|
|
|
|
|
```sh
|
2018-11-24 14:22:10 +01:00
|
|
|
sudo apt install git build-essential pkg-config cmake cmake-data libsdl2-dev
|
2018-10-28 15:08:50 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Optional packages:**
|
|
|
|
|
|
2018-10-28 18:46:41 +01:00
|
|
|
- [SDL2_image][] library
|
|
|
|
|
- [SDL2_ttf][] library
|
2019-02-04 00:06:04 +01:00
|
|
|
- [SDL2_net][] library
|
|
|
|
|
- [SDL2_mixer][] library
|
2018-10-28 18:46:41 +01:00
|
|
|
- [SDL2_gfx][] library
|
2018-10-28 15:08:50 +01:00
|
|
|
|
|
|
|
|
```sh
|
2019-02-04 00:06:04 +01:00
|
|
|
sudo apt install libsdl2-image-dev libsdl2-ttf-dev libsdl2-net-dev libsdl2-mixer-dev libsdl2-gfx-dev
|
2018-10-28 15:08:50 +01:00
|
|
|
```
|
|
|
|
|
|
2018-10-28 15:09:31 +01:00
|
|
|
## Build instructions
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
# Clone this repo
|
2019-02-04 00:06:04 +01:00
|
|
|
git clone --recurse-submodules https://gitlab.com/aminosbh/basic-c-sdl-project.git
|
2018-10-28 15:09:31 +01:00
|
|
|
cd basic-c-sdl-project
|
|
|
|
|
|
|
|
|
|
# Create a build folder
|
|
|
|
|
mkdir build
|
|
|
|
|
cd build
|
|
|
|
|
|
|
|
|
|
# Build
|
|
|
|
|
cmake ..
|
|
|
|
|
make
|
|
|
|
|
|
|
|
|
|
# Run
|
|
|
|
|
./basic-c-sdl-project
|
|
|
|
|
```
|
|
|
|
|
|
2019-02-04 00:06:04 +01:00
|
|
|
***Note:*** To use SDL2_image, SDL2_ttf, SDL2_net, SDL2_mixer or SDL2_gfx, you
|
|
|
|
|
should uncomment some instructions in the CMakeLists.txt file and re-execute
|
|
|
|
|
the `make` command.
|
2018-10-28 15:09:31 +01:00
|
|
|
|
2018-10-28 18:50:35 +01:00
|
|
|
### Open the project with an IDE under Linux
|
|
|
|
|
|
2018-11-20 08:28:27 +01:00
|
|
|
See [IDE_USAGE.md](IDE_USAGE.md) for details.
|
2018-10-28 18:54:03 +01:00
|
|
|
|
2018-10-28 15:06:27 +01:00
|
|
|
## License
|
|
|
|
|
|
2018-11-08 21:36:47 +01:00
|
|
|
Author: Amine B. Hassouna [@aminosbh](https://gitlab.com/aminosbh)
|
|
|
|
|
|
2018-10-28 15:06:27 +01:00
|
|
|
This project is distributed under the terms of the MIT license
|
|
|
|
|
[<LICENSE>](LICENSE).
|
2018-10-27 21:31:08 +00:00
|
|
|
|
2018-10-28 18:46:41 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
[SDL]: https://www.libsdl.org
|
|
|
|
|
[CMake]: https://cmake.org
|
|
|
|
|
[Git]: https://git-scm.com
|
|
|
|
|
[SDL2_image]: https://www.libsdl.org/projects/SDL_image
|
|
|
|
|
[SDL2_ttf]: https://www.libsdl.org/projects/SDL_ttf
|
2019-02-04 00:06:04 +01:00
|
|
|
[SDL2_net]: https://www.libsdl.org/projects/SDL_net
|
|
|
|
|
[SDL2_mixer]: https://www.libsdl.org/projects/SDL_mixer
|
2018-10-28 18:46:41 +01:00
|
|
|
[SDL2_gfx]: http://www.ferzkopp.net/wordpress/2016/01/02/sdl_gfx-sdl2_gfx
|