[][src]Crate bevy_megaui

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

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

Usage

Here's a minimal usage example:

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"

Re-exports

pub use megaui;

Modules

node

The names of bevy_megaui nodes.

Structs

MegaUiContext

A resource that is used to store bevy_megaui context. Since megaui::Ui doesn't implement Send + Sync, it's accessible only from thread-local systems.

MegaUiPlugin

Adds all megaui resources and render graph nodes.

WindowParams

Params that are used for defining a window with MegaUiContext::draw_window.

Constants

MEGAUI_PIPELINE_HANDLE

A handle pointing to the megaui [PipelineDescriptor].

MEGAUI_TEXTURE_RESOURCE_BINDING_NAME

Name of the texture uniform.

MEGAUI_TRANSFORM_RESOURCE_BINDING_NAME

Name of the transform uniform.