https://github.com/0jc1/sdl2-raycaster
A basic SDL2 C++ Raycaster
https://github.com/0jc1/sdl2-raycaster
cpp cpp-sdl2 raycaster sdl2
Last synced: 9 months ago
JSON representation
A basic SDL2 C++ Raycaster
- Host: GitHub
- URL: https://github.com/0jc1/sdl2-raycaster
- Owner: 0jc1
- Created: 2023-08-17T16:09:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-19T07:13:10.000Z (about 1 year ago)
- Last Synced: 2025-02-12T10:53:08.566Z (11 months ago)
- Topics: cpp, cpp-sdl2, raycaster, sdl2
- Language: C++
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SDL2 Raycaster
A basic SDL2 raycasting engine written in C++. Raycasting is a rendering technique to create a puedo 3D game from a 2D map. This was done by casting rays for each horizontal screen pixel and calculating the length of the rays using DDA algorithm.
## Screenshot

## Setup
### Linux:
First, make sure you have a C++ compiler installed. Then, install SDL2 and CMake:
```
sudo apt-get install libsdl2-dev cmake make g++
```
Build and compile:
```
cmake
make
```
### Windows:
Download and install VS with C++ or MinGW-w64. You also will need to download SDL2 for Windows. Then, change the path in CMakeLists.txt to your /SDL2/ folder.
Make sure `SDL2.dll` is in the right directory.
Build and compile:
```
cmake .. -G "Visual Studio 16 2019" -A x64
cmake --build . --config Release
```
Replace "Visual Studio 16 2019" with your version of Visual Studio.
## References
https://lodev.org/cgtutor/raycasting.html
https://lazyfoo.net/tutorials/SDL/