#raylib #imgui #graphics #gamedev

raylib_imgui_rs

A Raylib integration with DearImGui in Rust!

2 unstable releases

0.2.0 Dec 2, 2024
0.1.0 Nov 15, 2024

#163 in Graphics APIs

Download history 87/week @ 2024-11-11 24/week @ 2024-11-18 154/week @ 2024-12-02 9/week @ 2024-12-09

194 downloads per month

Custom license

24KB
429 lines

raylib_imgui_rs

Crates.io Version

raylib logo animated A Raylib integration with DearImGui in Rust!

Based on rlImgui

Setup:

In Cargo.toml:

[dependencies]
raylib_imgui_rs = "<Latest version here>"

In main.rs:

use imgui::{Context, FontSource};
use raylib::prelude::*;
use raylib_imgui_rs::Renderer;

fn main() {
    // Init raylib
    let (mut rl, thread) = raylib::init()
        .size(640, 480)
        .title("Hello, World")
        .build();

    let mut imgui = Context::create();
    imgui.fonts().add_font(&[FontSource::DefaultFontData { config: None }]);

    let mut renderer = Renderer::create(&mut imgui, &mut rl, &thread);

    while !rl.window_should_close() {
        renderer.update(&mut imgui, &mut rl);
        
        {
            let ui = imgui.new_frame();
            // Draw Imgui stuff here
        }
        
        {
            let mut d = rl.begin_drawing(&thread);

            d.clear_background(Color::WHITE);
            // Draw raylib stuff here

            renderer.render(&mut imgui, &mut d);
        }
    }
}

Dependencies

~20–26MB
~433K SLoC