1 unstable release
0.1.0 | Feb 23, 2023 |
---|
#799 in Graphics APIs
29 downloads per month
Used in 2 crates
5KB
99 lines
A library for making 2D games with rust, uses SDL2.
This library is made out of three crates:
- nze_game_sdl - for hiding the implementation details of sdl2 in rust. Load resources (texture, font, audio), rendering, 2D camera, audio playback, drawing tilemaps User Input, Windowing
- nze_tiled - (in lib dir) for loading Tiled maps
- nze_geometry - (in lib dir) for 2D geometry types and functions
Check out the examples folder for how you might use the library
Features
- window creation and keyboard/mouse/controller input
- loading and drawing textures and fonts to the screen
- loading and drawing Tiled maps
- 2D camera for scaling and moving drawn textures and fonts
- loading and playing music and sound effect
Setup
- Clone this repository
- Install Rust if you haven't already
- Install SDL2, SDL2_image, SDL2_mixer, SDL2_ttf (see sections below for details)
- go to the root directory of this project and run
$ cargo run --example main
to make sure everything is working.
Installing SDL2 on debian-based systems
Run the following command
$ sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
Installing SDL2 on other systems
Follow the instructions for your system given in the repo for rust-sdl2, but remember you also need to get sdl2_mixer, sdl2_ttf and sdl2_image libraries.
Dependancies
- rust-sdl2 for windowing, rendering, input, resource loading (also need the SDL2 C libraries installed on the system, see Setup for details)
- quick_xml for loading tiled maps
Projects using this framework
- DeliCatEssen - for DSJ2023 - Falling Puzzle
- Bunny Patch - for GGJ2023 - Simulation - outdated version of lib
- Coupled Explorers - for LD51 - Platformer - very outdated version of lib
- Hex - for a 48hr Jam - Falling Block Puzzle - very outdated version lib
TODO
- Better resolution controls
- Fade effects for audio
- Add point/line render options
- make (tiled, font, audio) dependancies optional