3 releases

0.1.2 Nov 26, 2020
0.1.1 Aug 17, 2020
0.1.0 Feb 11, 2020

#171 in Game dev

Download history 51/week @ 2020-12-31 67/week @ 2021-01-07 106/week @ 2021-01-14 84/week @ 2021-01-21 95/week @ 2021-01-28 90/week @ 2021-02-04 102/week @ 2021-02-11 114/week @ 2021-02-18 132/week @ 2021-02-25 78/week @ 2021-03-04 140/week @ 2021-03-11 168/week @ 2021-03-18 159/week @ 2021-03-25 111/week @ 2021-04-01 258/week @ 2021-04-08 108/week @ 2021-04-15

395 downloads per month
Used in 12 crates (via macroquad)


96 lines


Github Actions Docs Crates.io version Discord chat

macroquad is a simple and easy to use game library for Rust programming language, heavily inspired by raylib.

macroquad attempts to avoid any Rust-specific programming concepts like lifetimes/borrowing, making it very friendly for Rust beginners. See the docs.

Supported platforms

  • PC: Windows/Linux/MacOs
  • HTML5
  • Android
  • IOS


  • Same code for all supported platforms, no platform dependent defines required
  • Efficient 2D rendering with automatic geometry batching
  • Minimal amount of dependencies: build after cargo clean takes only 16s on x230(~6years old laptop)
  • Immediate mode UI library included
  • Single command deploy for both WASM and Android build instructions
tips Adding the following snippet to your Cargo.toml ensures that all dependencies compile in release even in debug mode. In macroquad, this has the effect of making images load several times faster and your applications much more performant, while keeping compile times miraculously low.
opt-level = 3


While macroquad attempts to use as few Rust-specific concepts as possible, .await in all examples looks a bit scary. Rust's async/await is used to solve just one problem - cross platform main loop organisation.


The problem: on WASM and android its not really easy to organize main loop like this:

fn main() {
    // do some initilization
    // start main loop
    loop {
        // handle input 

        // update logic

        // draw frame

It is fixable on Android with threads, but on web there is not way to "pause" and "resume" WASM execution, so no WASM code should block ever. While that loop is blocking for the entire game execution! The C++ solution for that problem: https://kripken.github.io/blog/wasm/2019/07/16/asyncify.html

But in Rust we have async/await. Rust's futures is basically a continuations - future's stack may be store into a variable to later pause/resume execution of future's code.

async/await in macroquad is used without any external dependencies - no runtime, executor or even futures-rs are involved. It's just a way to preserve main's stack on WASM and keep the code cross platform without any WASM-specific main loop.

Platinum sponsors

Macroquad is supported by:

No runtime deps