A complete imgui-rs example using dependencies only from crates.io.

Overview

Dear imgui-rs,

hello.

This is a fairly basic, but complete and standalone example application for the Rust version of dear imgui (https://github.com/ocornut/imgui), imgui-rs (https://github.com/imgui-rs/imgui-rs/).

In contast to the monorepo examples provided with imgui-rs, all dependencies in this template are fetched from crates.io to help ensure a reproducible project setup and ease initial use for developers new to the crate.

For many more examples of imgui-rs API usage, see the main repo's imgui-examples crate corresponding to this repo's imgui-rs version, which should all work with this template (https://github.com/imgui-rs/imgui-rs/tree/v0.8.2/imgui-examples/examples).

Screenshot

The Blue Hydrangea theme that comes with this example.

Using it

To use this template, please click the Use this template button at the top of the GitHub project page to create a new repo.

You will need a Rust compiler (naturally) as well as a configured C++ compiler in order to build the C++ imgui backend. Assuming you have both of these configured and in your path, you should only need to run the app to see it working:

cargo run

Please let me know if you have any problems!

Structure

This borrows the boilerplate support module from imgui-rs/imgui-examples, with minor modifications to make it a bit easier to change the OS window size and background color when calling support::init().

  • Dialogs/Forms & Popups: The application itself in main.rs shows support for a "main window" (essentially the dialog interaction model common in many utilities), with a non-persistent State struct to store the application's data in memory. This window also uses a popup as a confirmation mechanism.

  • Document/View: There also is the beginning of a very basic Document/View setup with multiple "document" windows (File > New).

  • Styles: Finally, you can trigger the imgui default style editor window to modify the style as desired. To permanently apply the style, click Export in the style editor with Only modifed colors unchecked. This will put the C++ code for the theme onto your system clipboard, which you can paste and modify to match the syntax in main.rs.

  • The imgui-rs example main menu bar is included as a reference for how to create complex menus. On the File menu the New command will create a "document", and Toggle Style Editor will show the built-in imgui style editor window.

Renderer and Support Modules

This example only works with imgui-glium-renderer and imgui-winit-support. Other renderers and support modules are not currently planned to be added but contributions in the form of PRs are accepted.

You might also like...
1 library and 2 binary crates to run SSH/SCP commands on a
1 library and 2 binary crates to run SSH/SCP commands on a "mass" of hosts in parallel

massh 1 library and 2 binary crates to run SSH/SCP commands on a "mass" of hosts in parallel. The binary crates are CLI and GUI "frontends" for the li

A list of crates with snippets used by me to learn more about Rust.

my-rust-examples This is a list of crates used by me to learn Rust. How to execute You can use a dependency called cargo-play: cargo install cargo-pla

List public items (public API) of library crates. Enables diffing public API between releases.

cargo-public-items List public items (the public API) of a Rust library crate by analyzing the rustdoc JSON of the crate. Automatically builds the rus

This repo contains crates that are used to create the micro services and keep shared code in a common place.

MyEmma Helper Crates This repo contains crates that can are reused over different services. These crate are used in projects at MyEmma. But these crat

Use raw-window-handle 0.5 with crates that depend on 0.4.

OldHasRawWindowHandleWrapper Wrap any type that implements HasRawWindowHandle and HasRawDisplayHandle from raw-window-handle 0.5 in OldHasRawWindowHan

A series of crates that I made to compile images/video into asciinema & play them.

Bad Apple A series of crates that I made to compile images/video into asciinema & play them. The end goal is to make a kernel & legacy bootloader that

Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.
Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.

Crates.io library that provides high-level APIs for obtaining information on various entertainment media such as books, movies, comic books, anime, manga, and so on.

Fix broken crates instantly 🏃🏽‍♀️💨

Patch-Crate patch-crate lets rust app developer instantly make and keep fixes to rust crate dependencies. It's a vital band-aid for those of us living

Rust library to convert RGB 24-bit colors into ANSI 256 (8-bit) color codes with zero dependencies and at compile-time.
Rust library to convert RGB 24-bit colors into ANSI 256 (8-bit) color codes with zero dependencies and at compile-time.

rgb2ansi256 rgb2ansi256 is a small Rust library to convert RGB 24-bit colors into ANSI 256 (8-bit) color codes with zero dependencies and const fn. Th

Owner
null
A program that provides LLMs with the ability to complete complex tasks using plugins.

SmartGPT SmartGPT is an experimental program meant to provide LLMs (particularly GPT-3.5 and GPT-4) with the ability to complete complex tasks without

Corman 8 Apr 19, 2023
Cold Clear 2 is a modern Tetris versus bot and a complete rewrite and evolution of Cold Clear.

Cold Clear 2 Cold Clear 2 is a modern Tetris versus bot and a complete rewrite and evolution of Cold Clear. It implements the Tetris Bot Protocol for

Mark Carlson 27 Dec 28, 2022
TI-89-style calculator, maybe turing complete

I will make a fully capable graphing calculator in Rust and you can't stop me. As always, I'm not using libraries or any of that. Everything here is h

Neptunal 4 Jun 2, 2023
A Turing-complete but dead-simple spaced repetition CLI that helps you learn stuff.

Forne — Learn Stuff Forne is a Turing-complete spaced repetition engine to help you learn stuff your way. What does that mean? Well, there are a few p

Sam Brew 9 May 12, 2023
A TUI for exploring crates.io using Ratatui

crates-tui crates-tui is a simple terminal user interface explorer for crates.io based on Ratatui. crates-tui.mov It supports features like: copy carg

Ratatui 28 Mar 11, 2024
Pure-Rust rewrite of the Linux fontconfig library (no system dependencies) - using ttf-parser and allsorts

rust-fontconfig Pure-Rust rewrite of the Linux fontconfig library (no system dependencies) - using allsorts as a font parser in order to parse .woff,

Felix Schütt 28 Oct 29, 2022
A CLI tool that allow you to create a temporary new rust project using cargo with already installed dependencies

cargo-temp A CLI tool that allow you to create a new rust project in a temporary directory with already installed dependencies. Install Requires Rust

Yohan Boogaert 61 Oct 31, 2022
Answering the question nobody asked: what if you wanted to text your friends using only ARP?

arpchat so... you know arp? the protocol your computer uses to find the mac addresses of other computers on your network? yeah. that. i thought it wou

Kognise 1.3k Jan 1, 2023
Tumour-only somatic mutation calling using long reads

smrest smrest is a prototype somatic mutation caller for single molecule long reads. It uses haplotype phasing patterns for tumour samples that have a

Jared Simpson 16 Mar 1, 2024
A simplified example in Rust of training a neural network and then using it based on the Candle Framework by Hugging Face.

candle-simplified-example A simplified example in Rust of training a neural network and then using it based on the Candle Framework by Hugging Face. H

Evgeny Igumnov 8 Sep 26, 2023