Github Crates.io Documentation

Quicksilver allows you to create 2D applications targeting Windows, macOS, Linux, and the Web all from the same codebase, using only Rust.

What's included?

A Quick Example

// Draw some multi-colored geometry to the screen
extern crate quicksilver;

use quicksilver::{
    geom::{Circle, Line, Rectangle, Transform, Triangle, Vector},
    graphics::{Background::Col, Color},
    lifecycle::{Settings, State, Window, run},

// A unit struct that we're going to use to run the Quicksilver functions
struct DrawGeometry;

impl State for DrawGeometry {
    // Initialize the struct
    fn new() -> Result<DrawGeometry> {

    fn draw(&mut self, window: &mut Window) -> Result<()> {
        // Remove any lingering artifacts from the previous frame
        // Draw a rectangle with a top-left corner at (100, 100) and a width and height of 32 with
        // a blue background
        window.draw(&Rectangle::new((100, 100), (32, 32)), Col(Color::BLUE));
        // Draw another rectangle, rotated by 45 degrees, with a z-height of 10
        window.draw_ex(&Rectangle::new((400, 300), (32, 32)), Col(Color::BLUE), Transform::rotate(45), 10);
        // Draw a circle with its center at (400, 300) and a radius of 100, with a background of
        // green
        window.draw(&Circle::new((400, 300), 100), Col(Color::GREEN));
        // Draw a line with a thickness of 2 pixels, a red background,
        // and a z-height of 5
            &Line::new((50, 80),(600, 450)).with_thickness(2.0),
        // Draw a triangle with a red background, rotated by 45 degrees, and scaled down to half
        // its size
            &Triangle::new((500, 50), (450, 100), (650, 150)),
            Transform::rotate(45) * Transform::scale((0.5, 0.5)),
        // We completed with no errors

// The main isn't that important in Quicksilver: it just serves as an entrypoint into the event
// loop
fn main() {
    // Run with DrawGeometry as the event handler, with a window title of 'Draw Geometry' and a
    // size of (800, 600)
    run::<DrawGeometry>("Draw Geometry", Vector::new(800, 600), Settings::default());


View the examples in your browser

Thanks to the magic of WebAssembly, if your browser supports both WebAssembly and WebGL2, then you can view the examples online with no plugins required.