Thanks to visit codestin.com
Credit goes to github.com

Skip to content

s4h1r/SDL_snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 SDL Snake Game

A classic snake game written in C using SDL2, with a focus on SDL2 rendering and event handling. This project contains multiple builds and test files, but the main game logic lives in main2_actual_main.c.

🧠 About the Project

This is a personal SDL2 game project structured to make building and running on Windows easy without needing to install SDL2 system-wide. SDL2 includes and libraries are bundled inside the project.

📁 Project Structure


SDL_proj/
├── SDL2.dll
├── snake.c
├── snake.exe
├── test_sdl.c / test_sdl.exe
│
├── bgtsdl2/
│   ├── main2_actual_main.c       ✅ Main game source file
│   ├── SDL2.dll
│   ├── main.c, main2.c           Test files
│   ├── bin/
│   │   ├── main2_actual_main.exe ✅ Main game executable
│   ├── inc/                      SDL2 header files
│   └── lib/                      SDL2 libraries
│
├── inc/                          Duplicate headers
└── lib/                          Duplicate libs
  

▶️ How to Run

On Windows:

  1. Navigate to bgtsdl2/bin/
  2. Double-click main2_actual_main.exe
  3. Ensure SDL2.dll is present in the same folder

✅ No installation or compilation required.

🔧 How to Build (Optional)

Requirements: MinGW or another GCC compiler

gcc bgtsdl2/main2_actual_main.c -Ibgtsdl2/inc -Lbgtsdl2/lib -lmingw32 -lSDL2main -lSDL2 -o bgtsdl2/bin/main2_actual_main.exe -mwindows

📌 Notes

  • main2_actual_main.c is the main entry point.
  • Files like main.c and snake.c are test builds.
  • Top-level inc/ and lib/ folders are duplicates.

👤 Author

@s4h1r

📜 License

This project is provided as-is for learning/demo purposes. Feel free to fork and modify.

🧾 Commands Used

Commands used for compiling and executing the files in the terminal (PowerShell on Windows):


cd "c:\Users\user\SDL proj\bgtsdl2\" ; if ($?) { gcc main2.c -o bin/main2 } ; if ($?) { bin/main2 }

gcc main2_actual_main.c -Iinc -Llib -lmingw32 -lSDL2main -lSDL2 -o bin/main2_actual_main.exe

.\bin\main2_actual_main.exe

About

A basic snake game written in C using the SDL2 library.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages