Code Monkey home page Code Monkey logo

imgui-rs's Introduction

imgui-rs: Rust bindings for ImGui

Ultra hyper turbo cyber mega extra über experimental!!!

Build Status Latest release on crates.io

Hello world

ui.window(im_str!("Hello world"))
    .size((300.0, 100.0), ImGuiSetCond_FirstUseEver)
    .build(|| {
        ui.text(im_str!("Hello world!"));
        ui.text(im_str!("This...is...imgui-rs!"));
        ui.separator();
        let mouse_pos = ui.imgui().mouse_pos();
        ui.text(im_str!("Mouse Position: ({:.1},{:.1})", mouse_pos.0, mouse_pos.1));
    })

Currently implemented things

  • Low-level API (imgui-sys)
  • Renderer for easy integration with Glium projects (optional)
  • Parts of high-level API
  • Not horrible way of defining and passing null-terminated UTF-8 to ImGui
  • Parts of imgui_demo.cpp reimplemented in Rust as an API usage example (examples/test_window_impl.rs)

Important but unimplemented things

  • Documentation (rustdoc)
  • Support passing a custom Program to Glium renderer (e.g. from a shader cache, or custom shader)

Core design questions and current choices

  • Closures VS begin/end pairs (current choice: closures)
  • Mutable references VS return values (current choice: mutable references)
  • Passing around Ui<'ui> VS passing around &'ui Ui (current choice: Ui<'ui>)
  • Splitting the API to smaller pieces VS all draw calls in Ui (current choice: all draw calls in Ui)
  • Builder pattern for optional arguments VS something else (current choice: builder)
  • Mutation functions in builders VS self-consuming functions in builders (current choice: self-consuming)

Compiling and running the demos

git clone https://github.com/Gekkio/imgui-rs
cd imgui-rs
git submodule update --init --recursive
cargo test

cargo run --example hello_world
cargo run --example test_window
cargo run --example test_window_impl

License

Licensed under either of

at your option.

Uses ImGui and cimgui.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

imgui-rs's People

Contributors

bitshifter avatar byron avatar emberian avatar gekkio avatar matklad avatar not-fl3 avatar ocornut avatar twinklebear 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.