GithubHelp home page GithubHelp logo

doytsujin / amethyst-imgui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amethyst/amethyst-imgui

0.0 1.0 0.0 1.17 MB

imgui integration for Amethyst

Shell 1.31% Rust 92.68% Makefile 2.77% GLSL 3.24%

amethyst-imgui's Introduction

Latest release on crates.io Documentation on docs.rs

amethyst-imgui

Amethyst-imgui provides integration for the imgui-rs crate within the Amethyst game engine.

ImGUI is known industry wide for its utility in fast prototyping and debug interfaces.

Integration

This crate provides an amethyst RenderPlugin (available since amethyst 0.12) which properly renders ImGUI windows which are rendered using the imgui-rs crate. This integration is accomplished by calling the amethyst_imgui::with function anywhere within an Amethyst (a System or State is appropriate), which will render within the immediate-mode context of ImGui. All synchronization, frame handling and Amethyst input is handled within this crate.

A minimal example is available at examples/demo_window.rs

# For Windows/Linux:
cargo run --example demo_window --features vulkan
# For MacOS:
cargo run --example demo_window --features metal

Usage

This crate currently requires including the amethyst crate; this may introduce a full recompilation of amethyst due to differing features. If this is the case, you'll need to clone this git repository and and set the appropriate features.

This create uses the amethyst shader-compiler, which relies on shaderc to compile its shaders at build time. Finally, this crate exposes the same rendering features as amethyst, and will pass them along to amethyst.

Example Cargo.toml Usage:

amethyst-imgui = { version = "0.7", features = ["vulkan"] }

RenderPlugin usage:

fn main() -> amethyst::Result<()> {
    amethyst::start_logger(Default::default());
    let app_root = application_root_dir()?;
    let display_config_path = app_root.join("examples/display.ron");

    let game_data = GameDataBuilder::default()
        .with_barrier()
        .with(DemoSystem::default(), "imgui_use", &[])
        .with_bundle(amethyst::input::InputBundle::<amethyst::input::StringBindings>::default())?
        .with_bundle(
            RenderingBundle::<DefaultBackend>::new()
                .with_plugin(
                    RenderToWindow::from_config_path(display_config_path)
                        .with_clear([0.34, 0.36, 0.52, 1.0]),
                )
                .with_plugin(RenderImgui::<amethyst::input::StringBindings>::default()),
        )?;

    Application::build("/", Example)?.build(game_data)?.run();

    Ok(())
}

An example System using amethyst-imgui:

pub struct ImguiDemoSystem;
impl<'s> amethyst::ecs::System<'s> for ImguiDemoSystem {
    type SystemData = ();
    fn run(&mut self, _: Self::SystemData) {
        amethyst_imgui::with(|ui| {
            ui.show_demo_window(&mut true);
        });
    }
}

amethyst-imgui's People

Contributors

jaynus avatar awpteamoose avatar mvlabat avatar atbentley avatar smasher816 avatar llebout avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.