Graphics Lib
This is a simple wrapper around Pixels, providing basic shape drawing, bitmap text and image rendering.
Usage
Cargo
In your Cargo.toml
file add
= "0.4.0"
= "0.27.2"
= "0.13.0"
Code
This bit of boilerplate/framework must be used inside your code to use this library:
let event_loop = new;
let mut input = new;
let = setup?;
event_loop.run;
Drawing is then quite simple:
graphics.draw_text;
graphics.draw_image;
graphics.draw_rect;
Features
Both features are enabled by default
image_loading
Load files as Image
s
Code
let image = load_image?;
graphics.draw_image;
window_prefs
Save and restore window position and size
Code
First an instance of WindowPreferences
has be created:
let mut prefs = new?;
Then the file has to be created/loaded with
prefs.load()?;
To set the window size and position call
prefs.restore(&mut window);
To store the window size and position call
prefs.store(&window);
This only saves the data to memory, to save to disk call
prefs.save()?;
(after store()
)