mirror of
https://github.com/eliasstepanik/imgui-rs.git
synced 2026-01-14 06:58:35 +00:00
Restructure examples
This commit is contained in:
parent
35a8324f78
commit
c0c49e7bbe
11
Cargo.toml
11
Cargo.toml
@ -7,6 +7,9 @@ build = "build.rs"
|
||||
[lib]
|
||||
name = "imgui"
|
||||
|
||||
[features]
|
||||
default = ["glium"]
|
||||
|
||||
[dependencies]
|
||||
bitflags = "0.3"
|
||||
libc = "0.1"
|
||||
@ -22,3 +25,11 @@ optional = true
|
||||
|
||||
[build-dependencies]
|
||||
gcc = "0.3"
|
||||
|
||||
[dev-dependencies]
|
||||
time = "0.1"
|
||||
|
||||
[dev-dependencies.glium]
|
||||
version = "0.8"
|
||||
features = ["glutin"]
|
||||
default-features = false
|
||||
|
||||
@ -1,18 +1,11 @@
|
||||
#[macro_use]
|
||||
extern crate glium;
|
||||
extern crate imgui;
|
||||
extern crate time;
|
||||
|
||||
use glium::DisplayBuild;
|
||||
use glium::Surface;
|
||||
use glium::{DisplayBuild, Surface};
|
||||
use glium::glutin;
|
||||
use glium::glutin::{ElementState, Event, MouseButton, VirtualKeyCode};
|
||||
use imgui::ImGui;
|
||||
use imgui::{ImGui, Frame};
|
||||
use imgui::glium_renderer::Renderer;
|
||||
use time::SteadyTime;
|
||||
|
||||
fn main() {
|
||||
|
||||
pub fn main_with_frame<'a, F: Fn(&Frame<'a>)>(f: F) {
|
||||
let display = glutin::WindowBuilder::new()
|
||||
.build_glium()
|
||||
.unwrap();
|
||||
@ -37,8 +30,8 @@ fn main() {
|
||||
target.clear_color(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
let (width, height) = target.get_dimensions();
|
||||
let mut frame = imgui.frame(width, height, delta_f);
|
||||
frame.show_test_window();
|
||||
let frame = imgui.frame(width, height, delta_f);
|
||||
f(&frame);
|
||||
renderer.render(&mut target, frame).unwrap();
|
||||
|
||||
target.finish().unwrap();
|
||||
12
examples/test_window.rs
Normal file
12
examples/test_window.rs
Normal file
@ -0,0 +1,12 @@
|
||||
#[macro_use]
|
||||
extern crate glium;
|
||||
extern crate imgui;
|
||||
extern crate time;
|
||||
|
||||
mod support;
|
||||
|
||||
fn main() {
|
||||
support::main_with_frame(|frame| {
|
||||
frame.show_test_window();
|
||||
});
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
[package]
|
||||
name = "test_window"
|
||||
version = "0.0.0"
|
||||
authors = ["Joonas Javanainen <joonas.javanainen@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
glium = "0.8"
|
||||
time = "0.1"
|
||||
|
||||
[dependencies.imgui-rs]
|
||||
path = "../../"
|
||||
features = ["glium"]
|
||||
Loading…
x
Reference in New Issue
Block a user