Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Rust bindings for Dear ImGui

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

imgui-rs/imgui-rs

Repository files navigation

Build StatusLatest release on crates.ioDocumentation on docs.rsWrapped Dear ImGui Version

Hello world

ui.window("Hello world").size([300.0,100.0],Condition::FirstUseEver).build(||{        ui.text("Hello world!");        ui.text("こんにちは世界!");        ui.text("This...is...imgui-rs!");        ui.separator();let mouse_pos = ui.io().mouse_pos;        ui.text(format!("Mouse Position: ({:.1},{:.1})",            mouse_pos[0], mouse_pos[1]));});

imgui-rs are the Rust bindings toDear ImGui, the standard immediate mode user interface library.

Main library crates

The core of imgui-rs consists of:

  • imgui: High-level safe API
  • imgui-sys: Low-level unsafe API (automatically generated)

Next, we provide an example renderer, and two example backend platform implementations:

Each of these contain anexamples folder showing their usage. Checktheir respectiveCargo.toml to find compatible versions (e.gimgui-glow-renderer/Cargo.toml the[dependencies] describes thecompatibleglow version and[dev-dependencies] describes thecompatibleglutin version)

See below as well for community lead platform and renderer crates.

Features

  • Bindings for Dear ImGui that can be used with safe Rust. Note: API coverageis not 100%, but will keep improving over time.
  • Builder structs for use cases where the original C++ library uses optionalfunction parameters
  • Easy integration withglow and community integrations withwgpu andglium
  • Easy integration withwinit andsdl2
  • Optional support for the freetype font rasterizer and the docking branch

Minimum Support Rust Version (MSRV)

The MSRV forimgui-rs and all of the backend crates is1.82. We update our MSRV periodically, and issue a minor bump for it.

Choosing a backend platform and a renderer

Almost every application that uses imgui-rs needs two additional components inaddition to the mainimgui crate: a backend platform, and a renderer.

imgui-rs is not tied to any particular renderer or platform.

The backend platform is responsible for integrating imgui-rs with the operatingsystem and its window management. Its responsibilities include the following:

  • Handling input events (e.g. keyboard, mouse) and updating imgui-rs stateaccordingly
  • Passing information about the OS window (e.g. size, DPI factor) to imgui-rs
  • Updating the OS-side mouse cursor when imgui-rs requests it

The renderer is responsible for taking generic, renderer-agnosticdraw listsgenerated by imgui-rs, and rendering them using some graphics API. Itsresponsibilities include the following:

  • Rendering using vertex/index buffers and command lists
  • Handling of DPI factors and scissor rects
  • Texture management

We provide the following renderer as an official source (ie, they will always be up to date and working):imgui-glow-renderer.

Additionally, we provide the following backends as an official source (ie, they will always be up to date and working):imgui-winit-support andimgui-sdl2-support.

The most tested platform/renderer combination isimgui-glow-renderer +imgui-winit-support +winit, but this is not the only possiblecombination.

Additionally, there are other libraries which provide other kinds of renderers, which may be out of date withimgui-rs releases, but might work well for your use case:

  1. imgui-wgpu
  2. imgui-d3d12-renderer
  3. imgui-dx11-renderer
  4. imgui-gfx-renderer: Deprecated (no longer maintained beyond imgui-rs v0.8). Renderer implementation that uses thegfx crate (not the new gfx-hal crate)
  5. imgui-glium-renderer: Deprecated implementation that uses theglium crate
  6. Many more can be found oncrates.io either using search or the"dependents" page (the "depends on" text indicates if the crate has been updated for current versions of imgui-rs)

You can also write your own support code if you have a more advanced use case, becauseimgui-rs is not tied to any specific graphics / OS API.

Compiling and running the demos

Examples forimgui are in their own crateimgui-examples.

git clone https://github.com/imgui-rs/imgui-examplescd imgui-examples# At the reposity rootcargotestcargo run --example hello_worldcargo run --example test_windowcargo run --example test_window_impl

Windows Platform Notes

Windows platform users will need to use theMSVC ABI version of the Rustcompiler along with its associateddependencies tobuild this libary and run the examples.

How to contribute

  1. Change or add something

  2. Make sure you're using the latest stable Rust

  3. Run rustfmt to guarantee code style conformance

    rustup component add rustfmtcargo fmt
  4. Open a pull request in Github

License

Licensed under either of

at your option.

UsesDear ImGui andcimgui.

Contribution

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

About

Rust bindings for Dear ImGui

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Contributors120


[8]ページ先頭

©2009-2025 Movatter.jp