reaper-imgui

Bindings for cfillion ReaImGui Reaper Extension.

They are unsafe and hard to use because of all c-types. But, at least, it works, and can be used raw as in rea-rs crate, as well as in reaper-rs. But for the last one it should be published with the recent version, to make it possible for selecting back-end with features. Minimal example crate can be found on GitHub repository: https://github.com/Levitanus/reaper-imgui/tree/master/hello_world_example

```norun use rears::{PluginContext, Reaper, Timer}; use rearsmacros::reaperextensionplugin; use reaperimgui::{ Context, DrawList, DrawListSplitter, Font, ImGui, Image, ImageSet, ListClipper, Resource, TextFilter, Viewport, }; use std::{error::Error, mem::MaybeUninit}; use cstrmacro::cstr;

[derive(Debug)]

struct GuiRunner { imgui: ImGui, ctx: Context, } impl Timer for GuiRunner { fn run(&mut self) -> Result<(), Box> { let (mut open, mut flags) = (MaybeUninit::new(true), MaybeUninit::zeroed()); unsafe { self.imgui.Begin( self.ctx, cstr!("my window").asptr(), open.asmutptr(), flags.asmutptr(), ) }; let open = unsafe { open.assumeinit() }; println!("ctx: {:?} open: {:?}", self.ctx, open); if open { unsafe { self.imgui.Text(self.ctx, cstr!("Hello World!").asptr()); } unsafe { self.imgui.End(self.ctx) }; } else { unsafe { self.imgui.End(self.ctx) }; self.stop(); } Ok(()) } fn idstring(&self) -> String { "imguiexample".to_string() } }

[reaperextensionplugin]

fn pluginmain(context: PluginContext) -> Result<(), Box> { println!("plugin main"); Reaper::initglobal(context); let rpr = Reaper::getmut(); let imgui = ImGui::load(context); let mut zero = MaybeUninit::zeroed(); let ctx = unsafe { imgui.CreateContext(cstr!("my context").asptr(), zero.asmutptr()) }; rpr.registertimer(Box::new(GuiRunner { imgui, ctx })); Ok(()) } ```