use axfive_imgui::events::Event; use axfive_imgui::{imgui, main_loop}; use std::error::Error; macro_rules! static_cstr { ($string:literal) => { unsafe { std::ffi::CStr::from_bytes_with_nul_unchecked(concat!($string, '\0').as_bytes()) } }; } fn main() -> Result<(), Box> { main_loop(&mut |events| { for event in events { match event { Event::Quit => return Ok(false), _ => (), } } let mut running = true; imgui::main_menu_bar(|| { imgui::menu(static_cstr!("File"), true, || { if imgui::menu_item( static_cstr!("Quit"), Some(static_cstr!("Ctrl-Q")), false, true, ) { running = false; } }); }); if !running { return Ok(false); } imgui::show_demo_window(&mut running); imgui::window(static_cstr!("Test Window"), &mut running, 0, || { imgui::text("This is test text"); }); Ok(running) }) }