Crate yakui_macroquad

source ·
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§

Functions§

  • Allows you configure the yakui context within the scope of the closure passed, if you need to.
  • Draws the yakui ui. Must be called after finish/ui and once per frame.
  • Finishes the current yakui context and prepares it for rendering.
  • Returns true if the last mouse or keyboard event was sunk by yakui, and should not be handled by your game.
  • Returns true if the last keyboard event was sunk by yakui, and should not be handled by your game.
  • Returns true if the last mouse event was sunk by yakui, and should not be handled by your game.
  • Binds the yakui context to the current thread.
  • Allows you to submit commands to the yakui context inside the scope of the closure passed, calls start and finish for you.