An open API service indexing awesome lists of open source software.

https://github.com/dpasca/dpasca-sdl2-template

Simple template to build SDL2 demos on Windows, Linux and Mac
https://github.com/dpasca/dpasca-sdl2-template

3d ai neural-network opengl sdl2 template-project

Last synced: about 12 hours ago
JSON representation

Simple template to build SDL2 demos on Windows, Linux and Mac

Awesome Lists containing this project

README

          

## Demos

| | |
|---|---|
| **Demo1**: A moving red rectangle ![](Docs/demo1_sshot.png) | **Demo2**: A 3D starfield (no *glm* for 3D) ![](Docs/demo2_sshot.png) |
| **Demo3**: A wire-frame cube made of particles ![](Docs/demo3_sshot.png) | **Demo4**: A cube made with random particles ![](Docs/demo4_sshot.png) |
| **Demo5**: A 2D rotating quad ![](Docs/demo5_sshot.png) | **Demo6**: A simple voxel scene ![](Docs/demo6_sshot.png) |
| **Demo7**: A voxelized fractal terrain ![](Docs/demo7_sshot.png) | **Demo8**: Rudimentary texture sampling ![](Docs/demo8_sshot.png) |
| **Demo9**: Simple self-driving using neural-networks ![](Docs/demo9_sshot.png) | |

## Required Tools

- [CMake](https://cmake.org/download/) 3.21 or newer
- A C++20 compiler
- Git, used by CMake to fetch pinned third-party dependencies
- Windows: Visual Studio 2022 or newer
- macOS: Xcode command line tools or Xcode
- Linux: gcc/clang and standard OpenGL development packages

## Quick Start

Dependencies are fetched by CMake and built statically by default. There is no
separate externals step.

### Linux/macOS

```bash
./build.sh
```

For Debug:

```bash
./build.sh Debug
```

### Windows

```bat
build.bat
```

For Debug:

```bat
build.bat Debug
```

Executables are written under `_bin`.

## CMake Presets

You can also build without the wrapper scripts:

```bash
cmake --preset release
cmake --build --preset release
```

Useful presets:

- `release`
- `debug`
- `xcode`
- `vs2022`

## Static Dependencies

The default build uses pinned vendored revisions of SDL2, glm, and Dear ImGui,
and builds third-party libraries statically:

```bash
cmake -S . -B _build/Release -DCMAKE_BUILD_TYPE=Release
```

System packages are opt-in:

```bash
cmake -S . -B _build/system -DDPASCA_USE_SYSTEM_DEPS=ON
```

For distribution builds, keep `DPASCA_USE_SYSTEM_DEPS` disabled. macOS and Linux
will still link to platform system libraries/frameworks such as OpenGL, Cocoa,
pthread, or libc, but SDL2/ImGui/glm are not pulled from Homebrew, apt, or other
machine-local package managers by default.

## IDE Projects

### Xcode

```bash
cmake --preset xcode
cmake --build --preset xcode-release
```

The Xcode project is generated under `_build/xcode`.

### Visual Studio

```bat
cmake --preset vs2022
cmake --build --preset vs2022-release
```

The Visual Studio solution is generated under `_build\vs2022`.