Registry / other / piston2d-graphics

piston2d-graphics

JSON →
library0.45.0rscratesunverified

A 2D graphics library that works with multiple back-ends, providing drawing primitives and rendering abstractions.

# Cargo.toml [dependencies] piston2d-graphics = "0.45.0"
INSTALL
IMPORT
SIG · PISTON2D-GRAPHICS
P
piston2d-graphics
otherrustv0.45.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

piston2d_graphics
use piston2d_graphics::*;

Shows a minimal Piston window with a red rectangle drawn using piston2d-graphics.

use piston2d_graphics::*; fn main() { let mut window: PistonWindow = WindowSettings::new("Hello Piston!", [640, 480]) .exit_on_esc(true) .build() .unwrap(); while let Some(e) = window.next() { window.draw_2d(&e, |c, g, _| { clear([1.0; 4], g); rectangle([1.0, 0.0, 0.0, 1.0], [100.0, 100.0, 200.0, 200.0], c.transform, g); }); } }
Debug
Known issues
gotchaRequires a graphics backend like piston2d-opengl_graphics or piston2d-glium to be added as a dependency.
fix
Add a backend crate such as piston2d-opengl_graphics to your Cargo.toml.
affects: >=0.45.0
Upgrade
Version history
0.45.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
piston2d-graphics — cargo add piston2d-graphics · libregistry