direct-gui
Simple direct rendering GUI controls
Documentation
Usage
Add this to your Cargo.toml
:
[]
= "0.1"
And this to your crate root:
extern crate direct_gui;
Run the examples
On Linux you need the xorg-dev
package as required by minifb
-- sudo apt install xorg-dev
cargo run --example button
cargo run --example label
Examples
use *;
use *;
let screen_size = ;
// Create a buffer where we will render to
let mut buffer: = vec!;
// Create a new instance of the gui
let mut gui = new;
// Load the sprite of a button
let button_img = gui.load_sprite_from_file.unwrap;
// Create a new button using the sprite loaded before at pixel (20, 10)
gui.register;
// Handle "input events" by pretending that the mouse is hovering over the button.
let cs = ControlState ;
gui.update;
// Finally render the current gui state to the buffer
gui.draw_to_buffer;
Credits
Default font by usr_share