5 releases (breaking)

0.5.0 Jun 29, 2021
0.4.0 May 11, 2021
0.3.0 Apr 18, 2021
0.2.0 Apr 15, 2021
0.1.0 Mar 23, 2021

#125 in GUI

Download history 47/week @ 2021-04-14 51/week @ 2021-04-21 247/week @ 2021-04-28 40/week @ 2021-05-05 90/week @ 2021-05-12 44/week @ 2021-05-19 40/week @ 2021-05-26 220/week @ 2021-06-02 137/week @ 2021-06-09 27/week @ 2021-06-16 41/week @ 2021-06-23 223/week @ 2021-06-30 35/week @ 2021-07-07 40/week @ 2021-07-14 145/week @ 2021-07-21 181/week @ 2021-07-28

327 downloads per month
Used in 2 crates

MIT/Apache

19KB
90 lines

egui bindings for macroquad

Latest version Documentation MIT Apache

This is the easiest way to use egui. Just two functions!

Web demo.

Usage

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

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.

Dependencies

~6.5–9MB
~176K SLoC