Joonas Javanainen 109e232422
Abolish ImVec2/ImVec4 from safe APIs
[f32; 2] and [f32; 4] are now the canonical types
2019-06-28 00:05:10 +03:00

35 lines
910 B
Rust

use imgui::*;
mod support_gfx;
const CLEAR_COLOR: [f32; 4] = [1.0, 1.0, 1.0, 1.0];
fn main() {
support_gfx::run("hello_gfx.rs".to_owned(), CLEAR_COLOR, hello_world);
}
fn hello_world<'a>(ui: &Ui<'a>) -> bool {
#[cfg(feature = "opengl")]
let window_title = im_str!("Hello world (OpenGL)");
#[cfg(feature = "directx")]
let window_title = im_str!("Hello world (DirectX)");
ui.window(window_title)
.size([300.0, 100.0], Condition::FirstUseEver)
.build(|| {
ui.text(im_str!("Hello world!"));
ui.text(im_str!("こんにちは世界!"));
ui.text(im_str!("This...is...imgui-rs!"));
ui.separator();
let mouse_pos = ui.io().mouse_pos;
ui.text(im_str!(
"Mouse Position: ({:.1},{:.1})",
mouse_pos[0],
mouse_pos[1]
));
});
true
}