Skip to content
This repository has been archived by the owner on Aug 3, 2022. It is now read-only.
/ bevy_megaui Public archive

A plugin for megaui integration into Bevy. This plugin is deprecated as is megaui.

License

Notifications You must be signed in to change notification settings

mvlabat/bevy_megaui

Repository files navigation

bevy_megaui

Crates.io Documentation license Crates.io Rust

This plugin is deprecated, as is megaui itself. If you want an immediate mode GUI plugin for your Bevy project, see bevy_egui.

This crate provides a megaui integration for the Bevy game engine.

bevy_megaui depends solely on megaui and bevy with only render feature required.

bevy_megaui

Trying out

An example WASM project is live at mvlabat.github.io/bevy_megaui_web_showcase [source].

Note that in order to use bevy_megauiin WASM you need bevy_webgl2 of at least 0.4.1 version.

Usage

Here's a minimal usage example:

# Cargo.toml
[dependencies]
bevy = "0.4"
bevy_megaui = "0.1"
use bevy::prelude::*;
use bevy_megaui::{
    megaui::{hash, Vector2},
    MegaUiContext, MegaUiPlugin,
};

fn main() {
    App::build()
        .add_plugins(DefaultPlugins)
        .add_plugin(MegaUiPlugin)
        .add_system(ui_example.system())
        .run();
}

fn ui_example(_world: &mut World, resources: &mut Resources) {
    let mut ui = resources.get_thread_local_mut::<MegaUiContext>().unwrap();

    ui.draw_window(
        hash!(),
        Vector2::new(5.0, 5.0),
        Vector2::new(100.0, 50.0),
        None,
        |ui| {
            ui.label(None, "Hello world!");
        },
    );
}

For a more advanced example, see examples/ui.rs.

cargo run --example ui --features="bevy/x11 bevy/png bevy/bevy_wgpu"

See also

About

A plugin for megaui integration into Bevy. This plugin is deprecated as is megaui.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published