Crates.io | egui-macroquad |
lib.rs | egui-macroquad |
version | 0.15.0 |
source | src |
created_at | 2021-03-23 19:54:58.316595 |
updated_at | 2023-02-25 17:56:48.28933 |
description | Bindings between egui and macroquad |
homepage | https://github.com/optozorax/egui-macroquad |
repository | https://github.com/optozorax/egui-macroquad |
max_upload_size | |
id | 372698 |
size | 52,840 |
This is the easiest way to use egui. Just two functions!
You need to call ui
when you need to get information from ui. Then, only after that function you must call draw
function when you need to draw egui contents. All this functions should be called each frame and once per frame.
Here is the small example on how to use this library:
use macroquad::prelude::*;
#[macroquad::main("egui with macroquad")]
async fn main() {
loop {
clear_background(WHITE);
// Process keys, mouse etc.
egui_macroquad::ui(|egui_ctx| {
egui::Window::new("egui ❤ macroquad")
.show(egui_ctx, |ui| {
ui.label("Test");
});
});
// Draw things before egui
egui_macroquad::draw();
// Draw things after egui
next_frame().await;
}
}
Building for native and for web works just as in macroquad
. You can read about it here. Or you could look at building example at egui-miniquad.
But for wasm you will need to include two more .js
files, which is plugins for quads, instruction is written here.