https://github.com/cuchi/snek.rs
Small snake game written in Rust + SDL2
https://github.com/cuchi/snek.rs
Last synced: 11 months ago
JSON representation
Small snake game written in Rust + SDL2
- Host: GitHub
- URL: https://github.com/cuchi/snek.rs
- Owner: cuchi
- Created: 2022-11-23T21:06:24.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-23T21:49:38.000Z (over 3 years ago)
- Last Synced: 2025-01-28T11:48:28.641Z (over 1 year ago)
- Language: Rust
- Size: 52.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Snek.rs
Just another minimal implementation of the snake game, this time using in Rust + SDL2.

# Running & local development
1. I tested this with `rustc 1.65.0`, so make sure you have a compatible version.
2. Also make sure your system has the [SDL2 dev libraries](https://github.com/Rust-SDL2/rust-sdl2#sdl20-development-libraries).
3. Clone this repo.
4. `cargo run` it.
5. **Enjoy!**
Keybindings:
- **WASD** to move
- **Escape** to pause/unpause/restart.
# The code
- [./src/context.rs](./src/context.rs) - Controls the game state and mechanics.
- [./src/renderer.rs](./src/renderer.rs) - Draws the game state into the sdl canvas.
- [./src/main.rs](./src/main.rs) - Keybindings + game loop and ticks.