Expand description
yakui-macroquad integrates yakui with macroquad.
§Usage
To use this library, you call start when you wish to begin
submitting ui draw commands and finish when you are done.
Though, there’s also the ui helper that takes a closure and will call start before your code and finish after.
But using start and finish is closer to how yakui itself does it, so that’s probably what you should do.
To then render your ui, simply call draw!
use macroquad::prelude::*;
use yakui_macroquad::*;
use yakui::*;
#[macroquad::main("yakui-macroquad-example")]
async fn main() {
loop {
clear_background(WHITE);
yakui_macroquad::start();
yakui::center(|| {
let mut text_box = yakui::widgets::Text::new(32.0, "hello, world!");
text_box.style.color = yakui::Color::BLACK;
text_box.show();
});
yakui_macroquad::finish();
yakui_macroquad::draw();
next_frame().await;
}
}Re-exports§
pub use macroquad;
Functions§
- cfg
- Allows you configure the yakui context within the scope of the closure passed, if you need to.
- draw
- Draws the yakui ui. Must be called after
finish/uiand once per frame. - finish
- Finishes the current yakui context and prepares it for rendering.
- has_
input_ focus - Returns true if the last mouse or keyboard event was sunk by yakui, and should not be handled by your game.
- has_
keyboard_ focus - Returns true if the last keyboard event was sunk by yakui, and should not be handled by your game.
- has_
mouse_ focus - Returns true if the last mouse event was sunk by yakui, and should not be handled by your game.
- start
- Binds the yakui context to the current thread.
- ui
- Allows you to submit commands to the yakui context inside the scope of the closure passed, calls
startandfinishfor you.