A lightweight C-based raycasting engine inspired by the classic Wolfenstein 3D, built with SDL2 and SDL2_image.
- Wolfenstein 3D rendering
- Map drawing with textured walls
- Basic movement & camera rotation
- Configurable window size
- Proper cleanup on exit (frees textures, destroys renderer/window, calls
SDL_Quit()
)
Make sure you have:
- SDL2
- SDL2_image
- gcc (or any C compiler)
Ubuntu/Debian:
sudo apt install libsdl2-dev libsdl2-image-dev
macOS (Homebrew):
brew install sdl2 sdl2_image
make clean
make
./game
Key | Action |
---|---|
W / S | Move forward / backward |
A / D | Rotate left / right |
ESC | Exit game |
When you quit the game, it:
- Frees all loaded textures
- Destroys the SDL renderer and window
- Calls
SDL_Quit()
to release resources
-
SDL2/SDL.h: No such file or directory
→ Install SDL2 and SDL2_image, then check include paths. On macOS, you may need:make CFLAGS="-I/opt/homebrew/include/SDL2" LDFLAGS="-L/opt/homebrew/lib"
-
Duplicate symbol linker errors → Ensure shared functions are declared in headers with
extern
and defined in exactly one.c
file.