Crate macroquad[−][src]
macroquad
is a simple and easy to use game library for Rust programming language.
macroquad
attempts to avoid any rust-specific programming concepts like lifetimes/borrowing, making it very friendly for rust beginners.
Supported platforms
- PC: Windows/Linux/MacOS
- HTML5
- Android
- IOS
Features
- 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) - Immidiate mode UI library included
- Single command deploy for both WASM and Android build instructions
Example
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("HELLO", 20.0, 20.0, 20.0, DARKGRAY); next_frame().await } }
Re-exports
pub use miniquad; |
Modules
camera | 2D and 3D camera. |
color | Color types and helpers. |
experimental | The most unstable things in macroquad Some of them will eventually move to other modules, some will move into separate crates and some may just disappear. |
file | Cross platform files management functions. |
input | Cross-platform mouse, keyboard (and gamepads soon) module. |
logging | Logging macros, available with “log-impl” feature. |
material | Custom materials - shaders, uniforms. |
math | Math types and helpers. |
models | 3D shapes and models, loading 3d models from files, drawing 3D primitives. |
prelude | Mose common types that can be glob-imported |
rand | Cross platform random generator. |
shapes | 2D shapes rendering. |
telemetry | |
text | Functions to load fonts and draw text. |
texture | Loading and rendering textures. Also render textures, per-pixel image manipluations. |
time | Cross platform system time access and FPS counters. |
ui | Immediate mode UI. |
window | Window and associated to window rendering context related functions. |
Macros
color_u8 | Build a color from 4 components of 0..255 values This is a temporary solution and going to be replaced with const fn, waiting for https://github.com/rust-lang/rust/issues/57241 |
hash |