canrust

Crates.iocanrust
lib.rscanrust
version1.3.3
sourcesrc
created_at2020-07-30 19:51:02.616919
updated_at2020-10-07 11:58:48.419342
descriptionA Rust library for drawing shapes onto a canvas
homepagehttps://gitea.redalder.org/ThyW/canrust
repositoryhttps://gitea.redalder.org/ThyW/canrust.git
max_upload_size
id271436
size79,701
zir (ThyW)

documentation

https://docs.rs/canrust

README

canrust

A an attempt to port Tk's Canvas, written in Rust and SFML, aiming to provide simple and Python-like syntax.

Example:

use canrust::canvas::{Canvas, Color}; 

fn main() {
      // Create a canvas:
      // size, name, background color
      let mut canvas = Canvas::new((800, 600), "Canvas", Color::WHITE);
      
      // create shapes:
      // laser eyes go brrrrr
      canvas.create_circle((1., 1.), 20., Color::BLACK, None, None);
      canvas.create_rectangle((20., 20.), (30., 80.), Color::BLACK, None, None);
      canvas.create_line((18., 20.), (18., 80), 2., Color::RED, None, None);
      canvas.create_line((32., 20.), (32. 80.), 2., Color::RED, None, None);
      
      // call the mainloop, objects will keep rendering as long as the program is running
      canvas.mainloop()
}

Dependencies

  • SFML 2.6
  • CSFML 2.6

Installation

Add this line to your Cargo.toml

[dependencies]
canrust = "1.3.1"
Commit count: 0

cargo fmt