Skip to content
No description, website, or topics provided.
Rust
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets
deps
src
.gitattributes
.gitignore
.gitmodules
Cargo.toml
README.md

README.md

Overview

This is a template for starting 2D game projects in Rust. The choice of libraries are only meant as examples, but they have been carefully chosen such that:

  • We get cross-platform support (defined to be at least Linux, Windows, and OSX)
  • They are compatible with each other

Furthermore, we define the minimal requirements of 2D games as follows:

  • HUD elements -> font rendering, orthographic textured quads, etc
  • GUI elements -> font rendering, click events, text entry fields, buttons, that sort of thing
  • Audio -> sound effects and background music
  • Mouse events
  • Keyboard events

In addition to the minimal requirements we also hope to reuse this template for starting 3D game projects. As such we also include full OpenGL support.

Building

Windows

  1. Visit SDL download page and grab the correct SDL development libraries. I use the msvc toolchain, so I grab the Visual C++ development libraries.

If you're on msvc you'll need to set LIB to point to SDL2.lib. In my case, I unzipped the files to my desktop and I set the following path:

export LIB="C:\Users\dagit\Desktop\SDL2-2.0.5\lib\x64"

On the GNU toolchain you set LIBRARY_PATH instead of LIB.

  1. Copy SDL2.dll into the top of your crate (next to Cargo.toml).

  2. Checkout/update git submodules:

    $ git submodule update --init --recursive

If you encounter an error during this step, I may need to give you access to the scene-rs repository.

  1. Use cargo as normal, eg., cargo build

Linux

TODO

OSX

  1. Checkout/update git submodules:

    $ git submodule update --init --recursive
  2. Follow the instructions for rust-sdl2 for OSX: https://github.com/AngryLawyer/rust-sdl2#mac-os-x

    For homebrew users this is roughly:

    $ brew install sdl2
    $ export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/lib"
  3. Use cargo as normal, eg., cargo build

You can’t perform that action at this time.