Macroquad: a Rust game library with an async main loop
Cross-platform game engine in Rust.
At a glance
- What is it?
- Macroquad is a small Rust game library built on miniquad that keeps one codebase across desktop, WASM, Android and iOS. It trades ECS architecture and a visual editor for immediate mode drawing and a single async main function.
- Who is it for?
- Macroquad suits Rust developers building small 2D games or prototypes who want one codebase across desktop, WASM, Android and iOS, and who are comfortable with an async main function. It is the wrong tool if you need a scene editor, an ECS, or a large third-party plugin ecosystem; Bevy covers that ground with a very different architecture.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 96 days ago.
- What is it written in?
- Mainly Rust, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 22, 2026, and from our analysis. They are not legal advice.
Star history
- not-fl3/macroquad4,736 ★ · +105
| Repository | 2026-09-23 | 2026-11-22 |
|---|---|---|
| not-fl3/macroquad | 4.6k | 4.7k |
105 Stars in the last 60 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What macroquad solves, and for whom
Shipping a small game in Rust normally means deciding early which platforms you care about, because the main loop differs between a native window and a browser tab. Macroquad's stated goal is the opposite: the README says the same code runs on all supported platforms with no platform dependent defines required. That is the whole pitch. You write one main function, and the library handles the window, the renderer and the input on Windows, Linux, macOS, HTML5, Android and iOS.
The audience is narrow and specific. It is not a studio pipeline. It is a Rust programmer who wants to draw rectangles, play a sound and read a key press without adopting an entity component system, a plugin registry or a scene graph. The README describes the library as "simple and easy to use" and names raylib as its inspiration, which tells you the design lineage: a flat set of drawing calls, immediate mode style, no retained scene objects.
That choice has consequences you should weigh before starting. Immediate mode means you re-issue every draw call every frame. For a 2D game with a few hundred sprites this is fine, and the README points to automatic geometry batching as the reason. For a scene with tens of thousands of objects, a retained renderer will usually be the better fit.
The async main loop and why it exists
The most distinctive mechanism in macroquad is that main is an async function. The README devotes a section to this, and the reasoning is concrete: on WASM you cannot pause and resume execution, so no WASM code may block, and a traditional blocking loop would block for the entire life of the game. Android has the same problem, fixable with threads but not on the web.
Macroquad's answer is Rust's async/await, used only to preserve the stack of main across frames. The README states that this support comes without any external dependencies: no runtime, no executors, and futures-rs is not involved. The macroquad::main attribute macro rewrites the entry point so that next_frame().await yields control back to the platform, and the next call resumes where the previous frame left off.
In practice this means your game state lives across await points and you call next_frame().await once per frame. The README's own example draws a line, a rectangle, a circle and some text, then awaits the next frame. There is no separate update and render phase unless you write one. If you have written a game loop before, this reads as a normal loop with one keyword inserted; if you have not, the await is the part that will look strange, and the README acknowledges as much by calling it "a bit scary".
Installing macroquad and drawing your first frame
Macroquad is a normal Rust dependency. The README's path is to create an empty binary project with cargo init --bin, add the crate to Cargo.toml, and put macroquad code in src/main.rs. The version line the README shows is the 0.4 series; the repository's own Cargo.toml declares version 0.4.16.
[dependencies]
macroquad = "0.4"With the dependency in place, the README's minimal program clears the background, draws a few primitives, prints text and awaits the next frame. Copy this into src/main.rs.
use macroquad::prelude::*;
#[macroquad::main("BasicShapes")]
async fn main() {
loop {
clear_background(RED);
draw_line(40.0, 40.0, 100.0, 200.0, 15.0, BLUE);
draw_rectangle(screen_width() / 2.0 - 60.0, 100.0, 120.0, 60.0, GREEN);
draw_circle(screen_width() - 30.0, screen_height() - 30.0, 15.0, YELLOW);
draw_text("IT WORKS!", 20.0, 20.0, 30.0, DARKGRAY);
next_frame().await
}
}Run it with cargo run. You should get a window titled BasicShapes with a red background and the three shapes and the text drawn on it. On Linux the README lists system packages that must be present first, including pkg-config, libx11-dev, libxi-dev, libgl1-mesa-dev and libasound2-dev on Ubuntu, with dnf and pacman equivalents for Fedora and Arch. On Windows the README says both MSVC and GNU targets work with no additional dependencies.
The repository ships an examples/ directory with files such as basic_shapes.rs, camera.rs, input_keys.rs, audio.rs, 3d.rs and particles_example.rs. Reading those is the fastest way to see how a feature is meant to be wired up, since the README itself is short.
Building for the browser and for phones
WASM is the platform where macroquad's async design pays off, and the README gives the full path. Add the target, build, then load the resulting .wasm file from an HTML page that pulls in a script from the project's own hosted bundle.
rustup target add wasm32-unknown-unknown
cargo build --target wasm32-unknown-unknownThe build produces target/wasm32-unknown-unknown/debug/CRATENAME.wasm, or the release path if you pass --release. The README's index.html loads a minified, statically hosted version of the project's js/mq_js_bundle.js. For serving the files locally the README suggests cargo install basic-http-server followed by basic-http-server.
Android and iOS are supported but the README is thinner on them. It notes a single command deploy for both WASM and Android as a feature, and the Cargo.toml carries a [package.metadata.android] section pointing assets at examples/. For iOS the README walks through building for x86_64-apple-ios, assembling a .app directory, and writing an Info.plist. It explicitly defers provisioning for a real iPhone to an article on macroquad.rs rather than covering it here. If iOS distribution is central to your plan, that gap is worth noting: the README gets you to the simulator, not to the App Store.
A performance tip the README hides in a details block
One of the more useful pieces of advice in the README is tucked into a collapsible section rather than the main build instructions. It suggests adding an opt-level override so that all dependencies compile optimized even in debug builds.
[profile.dev.package.'*']
opt-level = 3The README says this makes images load several times faster and applications much more performant while keeping compile times low. The repository's own Cargo.toml applies the same override in a slightly different form, using [profile.dev.package."*"] with double quotes. Either way, this is a trade-off you are opting into: dependency code is optimized, your own crate is not, so your edit-compile-run cycle stays short while the library code runs at full speed. For a debug build that loads PNGs, the difference is noticeable. It is also the kind of setting that is easy to forget when you copy a Cargo.toml between projects.
Where macroquad is the wrong choice
Macroquad has no scene editor, no asset pipeline and no built-in entity component system. If your project needs designers editing levels in a GUI, or thousands of entities updated through systems, you will be building that layer yourself or adding crates for it. The repository does include a small ecosystem under the same tree: particles/, tiled/, profiler/ and physics-platformer/ appear as top-level directories and as dev-dependencies in Cargo.toml. These are useful, but they are companions rather than a framework, and they are versioned alongside the engine rather than as an independent platform.
There is also the question of how the async entry point interacts with the rest of the Rust ecosystem. Because main is a future driven by macroquad's own macro, code that assumes a synchronous main, or libraries that spawn their own threads and expect to join them, may need restructuring. The README is explicit that no executor is involved, which is good for binary size, but it also means you cannot reach for tokio or async-std idioms inside the game loop and expect them to work as they do in a server.
Finally, the README does not document a rollback or migration story between 0.4 releases, and the repository has no published releases. The Cargo.toml pins miniquad to an exact version, =0.4.11, which suggests the two move together. If you depend on macroquad, expect to depend on that pairing.
Macroquad compared with Bevy
The comparison people reach for is Bevy, and the difference is architectural rather than cosmetic. Bevy is an ECS-first engine: entities, components and systems, with a plugin system and a scheduler deciding what runs when. Macroquad has none of that. You keep your own state in ordinary Rust variables and mutate it directly inside the loop.
That makes macroquad faster to start with and easier to reason about for a small game, and it makes Bevy better suited to projects where the number of interacting systems grows. Macroquad's README highlights its small dependency count, citing a clean build on a roughly six-year-old laptop as a feature. The two are not competing for the same project size.
A second comparison is with miniquad, which is not really an alternative so much as the layer underneath. Macroquad's Cargo.toml depends on miniquad, and macroquad provides its async main loop and drawing functions on top. Choosing miniquad means writing lower-level rendering code yourself and getting more control; choosing macroquad means accepting its drawing API in exchange for not touching that layer.
Licence, maintenance and upgrade cost
The repository carries both LICENSE-APACHE and LICENSE-MIT files, and Cargo.toml declares license = "MIT OR Apache-2.0". The dual MIT and Apache-2.0 arrangement is the common Rust convention: you choose which terms to comply with. Apache-2.0 includes an explicit patent grant, which some organizations prefer; MIT is shorter and simpler. This is a description of what the files say, not legal advice, and if your organization has a policy on either licence you should check it against the actual files rather than this summary.
On maintenance, the last push to the default branch was on 2026-08-18, and the repository is not archived. That is recent activity, but it is a single data point. The repository has no published GitHub releases, so there is no changelog to consult for what changed between versions. The version in the repository's Cargo.toml is 0.4.16, and the README's badge references docs.rs for 0.4.5, which suggests documentation on docs.rs may lag the source tree.
Upgrade cost is mostly the pinned miniquad dependency. Because Cargo.toml requires =0.4.11 exactly, a macroquad upgrade will pull a specific miniquad with it. If you also depend on miniquad directly, or on quad-snd for audio, keep those versions aligned with what macroquad expects, or you will end up with two copies of a low-level crate in the same binary.
Editorial conclusion
Macroquad suits Rust developers building small 2D games or prototypes who want one codebase across desktop, WASM, Android and iOS, and who are comfortable with an async main function. It is the wrong tool if you need a scene editor, an ECS, or a large third-party plugin ecosystem; Bevy covers that ground with a very different architecture. Before committing, verify that the 0.4 dependency line resolves on your toolchain, that the Linux system packages for your distribution are installed, and that the async main pattern fits how you structure game state.
Frequently asked questions
How do I use macroquad in a Rust project?
Create a binary project with cargo init --bin, add macroquad = "0.4" to Cargo.toml, and write an async main annotated with #[macroquad::main("Title")]. Inside the loop, draw with functions like clear_background and draw_rectangle, then call next_frame().await to end the frame.
Is macroquad good for making games?
It is a good fit for small 2D games and prototypes where you want one codebase across desktop, WASM, Android and iOS without a scene editor or an ECS. It is a poor fit if your project needs a visual level editor, a large plugin ecosystem, or tens of thousands of retained scene objects.
Is macroquad dead?
The repository is not archived, and the last push to the default branch was on 2026-08-18. The repository has no published GitHub releases, so there is no release history to check alongside that.
What is the difference between macroquad and miniquad?
Miniquad is the lower-level layer that macroquad depends on; macroquad's Cargo.toml pins miniquad to version 0.4.11. Macroquad adds the cross-platform main loop and drawing API on top, so choosing miniquad means writing more of the rendering code yourself.
How does macroquad compare with Bevy?
Bevy is built around an entity component system with a plugin and scheduler architecture, while macroquad keeps you in ordinary Rust state mutated inside a single async loop. Macroquad's README highlights a minimal amount of dependencies, with a build after cargo clean taking 16s on an x230 laptop.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/not-fl3-macroquad)Star history chart for your README
[](https://hysenlabs.com/projects/not-fl3-macroquad)Was this useful?