diff --git a/.travis.yml b/.travis.yml index 2f862a3..7d5e110 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,3 +28,5 @@ before_install: script: - cargo build --all --verbose - cargo test --all --verbose + - cargo build --all --verbose --manifest-path imgui-examples/Cargo.toml + - cargo build --all --verbose --manifest-path imgui-glium-examples/Cargo.toml diff --git a/Cargo.toml b/Cargo.toml index 11e1515..4bcd38c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,4 +16,13 @@ travis-ci = { repository = "Gekkio/imgui-rs" } imgui-sys = { version = "0.0.22-pre", path = "imgui-sys" } [workspace] -members = ["imgui-examples", "imgui-sys", "imgui-gfx-renderer", "imgui-glium-renderer", "imgui-glutin-support"] +members = [ + "imgui-sys", + "imgui-gfx-renderer", + "imgui-glium-renderer", + "imgui-glutin-support" +] +exclude = [ + "imgui-examples", + "imgui-glium-examples", +] diff --git a/imgui-examples/Cargo.lock b/imgui-examples/Cargo.lock new file mode 100644 index 0000000..fffc89b --- /dev/null +++ b/imgui-examples/Cargo.lock @@ -0,0 +1,720 @@ +[[package]] +name = "android_glue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "bitflags" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cc" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cgl" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gleam 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cocoa" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "core-graphics" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "derivative" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.17 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dlib" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "downcast-rs" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "draw_state" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "gfx" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "derivative 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "draw_state 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_core 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gfx_core" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "derivative 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "draw_state 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gfx_device_gl" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gfx_core 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_gl 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gfx_gl" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gfx_window_glutin" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gfx_core 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_device_gl 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gl_generator" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gleam" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glutin" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)", + "x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "imgui" +version = "0.0.22-pre" +dependencies = [ + "imgui-sys 0.0.22-pre", +] + +[[package]] +name = "imgui-examples" +version = "0.0.22-pre" +dependencies = [ + "gfx 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx_window_glutin 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", + "imgui 0.0.22-pre", + "imgui-gfx-renderer 0.0.22-pre", + "imgui-glutin-support 0.0.22-pre", +] + +[[package]] +name = "imgui-gfx-renderer" +version = "0.0.22-pre" +dependencies = [ + "gfx 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", + "imgui 0.0.22-pre", + "imgui-sys 0.0.22-pre", +] + +[[package]] +name = "imgui-glutin-support" +version = "0.0.22-pre" +dependencies = [ + "glutin 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", + "imgui 0.0.22-pre", +] + +[[package]] +name = "imgui-sys" +version = "0.0.22-pre" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "gfx 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "khronos_api" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libc" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libloading" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lock_api" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memmap" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nix" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "objc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "osmesa-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "owning_ref" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "proc-macro2" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "quote" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "scopeguard" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "shared_library" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smallvec" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smithay-client-toolkit" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-commons 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-protocols 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stable_deref_trait" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "syn" +version = "0.15.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wayland-client" +version = "0.20.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-commons 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-scanner 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-commons" +version = "0.20.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "downcast-rs 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-protocols" +version = "0.20.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-commons 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-scanner 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-scanner" +version = "0.20.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-sys" +version = "0.20.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winit" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smithay-client-toolkit 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "x11-dl" +version = "2.18.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "xml-rs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" +"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" +"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" +"checksum cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "55e7ec0b74fe5897894cbc207092c577e87c52f8a59e8ca8d97ef37551f60a49" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum cocoa 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f5cd1afb83b2de9c41e5dfedb2bcccb779d433b958404876009ae4b01746ff23" +"checksum core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "58667b9a618a37ea8c4c4cb5298703e5dfadcd3698c79f54fc43e6a2e94733ea" +"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" +"checksum core-graphics 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)" = "92801c908ea6301ae619ed842a72e01098085fc321b9c2f3f833dad555bba055" +"checksum derivative 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4659879d940179be82cccef63d1ecd4779f49de6647011a97a7bee91450b46e7" +"checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" +"checksum downcast-rs 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "18df8ce4470c189d18aa926022da57544f31e154631eb4cfe796aea97051fe6c" +"checksum draw_state 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "33cf9537e2d06891448799b96d5a8c8083e0e90522a7fdabe6ebf4f41d79d651" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum gfx 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7d7ce0c1f747245342a73453fdb098ea0764c430421fbc4d98cdc8ef8ede4834" +"checksum gfx_core 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c74932837e61f20956c3da1a47471513707dde300274812bba94373ab51830ae" +"checksum gfx_device_gl 0.15.3 (registry+https://github.com/rust-lang/crates.io-index)" = "5afb3bc6017229804c4a814972581eb16d7b8f2568fda9daf9d0ef6e78198305" +"checksum gfx_gl 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e8a920f8f6c1025a7ddf9dd25502bf059506fd3cd765dfbe8dba0b56b7eeecb" +"checksum gfx_window_glutin 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71449967000e71a8b80390620493ffeacc5be86f14a03464137ce220dd26678a" +"checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a" +"checksum gleam 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a8901d6854a992b372214fd9cce664df1a29678e362b151de0d7a4efdcd47f" +"checksum glutin 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0be84b852c1dcccde4b1329be778e5bd9c0801b8bbb8766ea327a3f813c6eafe" +"checksum khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "037ab472c33f67b5fbd3e9163a2645319e5356fcd355efa6d4eb7fff4bbcb554" +"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" +"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" +"checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" +"checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff" +"checksum nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37e713a259ff641624b6cb20e3b12b2952313ba36b6823c0f16e6cfd9e5de17" +"checksum objc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9833ab0efe5361b1e2122a0544a5d3359576911a42cb098c2e59be8650807367" +"checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" +"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" +"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee" +"checksum quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "63b5829244f52738cfee93b3a165c1911388675be000c888d2fae620dee8fa5b" +"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" +"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" +"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" +"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" +"checksum smithay-client-toolkit 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1609083d6bca3991a3c648d80ae16e1764d70881c3321bee1c915149073d605" +"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum syn 0.15.17 (registry+https://github.com/rust-lang/crates.io-index)" = "3391038ebc3e4ab24eb028cb0ef2f2dc4ba0cbf72ee895ed6a6fad730640b5bc" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum wayland-client 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e7516a23419a55bd2e6d466c75a6a52c85718e5013660603289c2b8bee794b12" +"checksum wayland-commons 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)" = "d8609d59b95bf198bae4f3b064d55a712f2d529eec6aac98cc1f6e9cc911d47a" +"checksum wayland-protocols 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)" = "bd4d31a96be6ecdbaddbf35200f5af2daee01be592afecd8feaf443d417e9230" +"checksum wayland-scanner 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e674d85ae9c67cbbc590374d8f2e20a7a02fff87ce3a31fc52213afece8d05ad" +"checksum wayland-sys 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)" = "87c82ee658aa657fdfd7061f22e442030d921cfefc5bad68bcf41973e67922f7" +"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum winit 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ba44cf306b981badc781894ab5d6fda54764a0512cbbf8db4685d329014143fa" +"checksum x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)" = "940586acb859ea05c53971ac231685799a7ec1dee66ac0bccc0e6ad96e06b4e3" +"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2" diff --git a/imgui-examples/Cargo.toml b/imgui-examples/Cargo.toml index 3e8000f..99d7b4a 100644 --- a/imgui-examples/Cargo.toml +++ b/imgui-examples/Cargo.toml @@ -11,8 +11,7 @@ publish = false [dev-dependencies] gfx = "0.17" gfx_window_glutin = "0.26" -glium = { version = "0.22", default-features = true } glutin = "0.18" imgui = { version = "0.0.22-pre", path = "../" } imgui-gfx-renderer = { version = "0.0.22-pre", path = "../imgui-gfx-renderer" } -imgui-glium-renderer = { version = "0.0.22-pre", path = "../imgui-glium-renderer" } +imgui-glutin-support = { version = "0.0.22-pre", path = "../imgui-glutin-support" } diff --git a/imgui-examples/examples/hello_gfx.rs b/imgui-examples/examples/hello_gfx.rs index 40423c3..91e41a2 100644 --- a/imgui-examples/examples/hello_gfx.rs +++ b/imgui-examples/examples/hello_gfx.rs @@ -4,6 +4,7 @@ extern crate glutin; #[macro_use] extern crate imgui; extern crate imgui_gfx_renderer; +extern crate imgui_glutin_support; use imgui::*; diff --git a/imgui-examples/examples/support/mod.rs b/imgui-examples/examples/support/mod.rs deleted file mode 100644 index 5ad2eb0..0000000 --- a/imgui-examples/examples/support/mod.rs +++ /dev/null @@ -1,235 +0,0 @@ -use imgui::{FontGlyphRange, FrameSize, ImFontConfig, ImGui, ImGuiMouseCursor, Ui}; -use std::time::Instant; - -#[derive(Copy, Clone, PartialEq, Debug, Default)] -struct MouseState { - pos: (i32, i32), - pressed: (bool, bool, bool), - wheel: f32, -} - -pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ui: F) { - use glium::glutin; - use glium::{Display, Surface}; - use imgui_glium_renderer::Renderer; - - let mut events_loop = glutin::EventsLoop::new(); - let context = glutin::ContextBuilder::new().with_vsync(true); - let builder = glutin::WindowBuilder::new() - .with_title(title) - .with_dimensions(glutin::dpi::LogicalSize::new(1024f64, 768f64)); - let display = Display::new(builder, context, &events_loop).unwrap(); - let window = display.gl_window(); - - let mut imgui = ImGui::init(); - imgui.set_ini_filename(None); - - // In the examples we only use integer DPI factors, because the UI can get very blurry - // otherwise. This might or might not be what you want in a real application. - let hidpi_factor = window.get_hidpi_factor().round(); - - let font_size = (13.0 * hidpi_factor) as f32; - - imgui.fonts().add_default_font_with_config( - ImFontConfig::new() - .oversample_h(1) - .pixel_snap_h(true) - .size_pixels(font_size), - ); - - imgui.fonts().add_font_with_config( - include_bytes!("../mplus-1p-regular.ttf"), - ImFontConfig::new() - .merge_mode(true) - .oversample_h(1) - .pixel_snap_h(true) - .size_pixels(font_size) - .rasterizer_multiply(1.75), - &FontGlyphRange::japanese(), - ); - - imgui.set_font_global_scale((1.0 / hidpi_factor) as f32); - - let mut renderer = Renderer::init(&mut imgui, &display).expect("Failed to initialize renderer"); - - configure_keys(&mut imgui); - - let mut last_frame = Instant::now(); - let mut mouse_state = MouseState::default(); - let mut quit = false; - - loop { - events_loop.poll_events(|event| { - use glium::glutin::ElementState::Pressed; - use glium::glutin::WindowEvent::*; - use glium::glutin::{Event, MouseButton, MouseScrollDelta, TouchPhase}; - - if let Event::WindowEvent { event, .. } = event { - match event { - CloseRequested => quit = true, - KeyboardInput { input, .. } => { - use glium::glutin::VirtualKeyCode as Key; - - let pressed = input.state == Pressed; - match input.virtual_keycode { - Some(Key::Tab) => imgui.set_key(0, pressed), - Some(Key::Left) => imgui.set_key(1, pressed), - Some(Key::Right) => imgui.set_key(2, pressed), - Some(Key::Up) => imgui.set_key(3, pressed), - Some(Key::Down) => imgui.set_key(4, pressed), - Some(Key::PageUp) => imgui.set_key(5, pressed), - Some(Key::PageDown) => imgui.set_key(6, pressed), - Some(Key::Home) => imgui.set_key(7, pressed), - Some(Key::End) => imgui.set_key(8, pressed), - Some(Key::Delete) => imgui.set_key(9, pressed), - Some(Key::Back) => imgui.set_key(10, pressed), - Some(Key::Return) => imgui.set_key(11, pressed), - Some(Key::Escape) => imgui.set_key(12, pressed), - Some(Key::A) => imgui.set_key(13, pressed), - Some(Key::C) => imgui.set_key(14, pressed), - Some(Key::V) => imgui.set_key(15, pressed), - Some(Key::X) => imgui.set_key(16, pressed), - Some(Key::Y) => imgui.set_key(17, pressed), - Some(Key::Z) => imgui.set_key(18, pressed), - Some(Key::LControl) | Some(Key::RControl) => { - imgui.set_key_ctrl(pressed) - } - Some(Key::LShift) | Some(Key::RShift) => imgui.set_key_shift(pressed), - Some(Key::LAlt) | Some(Key::RAlt) => imgui.set_key_alt(pressed), - Some(Key::LWin) | Some(Key::RWin) => imgui.set_key_super(pressed), - _ => {} - } - } - CursorMoved { position: pos, .. } => { - // Rescale position from glutin logical coordinates to our logical - // coordinates - mouse_state.pos = pos - .to_physical(window.get_hidpi_factor()) - .to_logical(hidpi_factor) - .into(); - } - MouseInput { state, button, .. } => match button { - MouseButton::Left => mouse_state.pressed.0 = state == Pressed, - MouseButton::Right => mouse_state.pressed.1 = state == Pressed, - MouseButton::Middle => mouse_state.pressed.2 = state == Pressed, - _ => {} - }, - MouseWheel { - delta: MouseScrollDelta::LineDelta(_, y), - phase: TouchPhase::Moved, - .. - } => mouse_state.wheel = y, - MouseWheel { - delta: MouseScrollDelta::PixelDelta(pos), - phase: TouchPhase::Moved, - .. - } => { - // Rescale pixel delta from glutin logical coordinates to our logical - // coordinates - mouse_state.wheel = pos - .to_physical(window.get_hidpi_factor()) - .to_logical(hidpi_factor) - .y as f32; - } - ReceivedCharacter(c) => imgui.add_input_character(c), - _ => (), - } - } - }); - - let now = Instant::now(); - let delta = now - last_frame; - let delta_s = delta.as_secs() as f32 + delta.subsec_nanos() as f32 / 1_000_000_000.0; - last_frame = now; - - update_mouse(&mut imgui, &mut mouse_state); - - let mouse_cursor = imgui.mouse_cursor(); - if imgui.mouse_draw_cursor() || mouse_cursor == ImGuiMouseCursor::None { - // Hide OS cursor - window.hide_cursor(true); - } else { - // Set OS cursor - window.hide_cursor(false); - window.set_cursor(match mouse_cursor { - ImGuiMouseCursor::None => unreachable!("mouse_cursor was None!"), - ImGuiMouseCursor::Arrow => glutin::MouseCursor::Arrow, - ImGuiMouseCursor::TextInput => glutin::MouseCursor::Text, - ImGuiMouseCursor::ResizeAll => glutin::MouseCursor::Move, - ImGuiMouseCursor::ResizeNS => glutin::MouseCursor::NsResize, - ImGuiMouseCursor::ResizeEW => glutin::MouseCursor::EwResize, - ImGuiMouseCursor::ResizeNESW => glutin::MouseCursor::NeswResize, - ImGuiMouseCursor::ResizeNWSE => glutin::MouseCursor::NwseResize, - ImGuiMouseCursor::Hand => glutin::MouseCursor::Hand, - }); - } - - // Rescale window size from glutin logical size to our logical size - let physical_size = window - .get_inner_size() - .unwrap() - .to_physical(window.get_hidpi_factor()); - let logical_size = physical_size.to_logical(hidpi_factor); - - let frame_size = FrameSize { - logical_size: logical_size.into(), - hidpi_factor, - }; - - let ui = imgui.frame(frame_size, delta_s); - if !run_ui(&ui) { - break; - } - - let mut target = display.draw(); - target.clear_color( - clear_color[0], - clear_color[1], - clear_color[2], - clear_color[3], - ); - renderer.render(&mut target, ui).expect("Rendering failed"); - target.finish().unwrap(); - - if quit { - break; - } - } -} - -fn configure_keys(imgui: &mut ImGui) { - use imgui::ImGuiKey; - - imgui.set_imgui_key(ImGuiKey::Tab, 0); - imgui.set_imgui_key(ImGuiKey::LeftArrow, 1); - imgui.set_imgui_key(ImGuiKey::RightArrow, 2); - imgui.set_imgui_key(ImGuiKey::UpArrow, 3); - imgui.set_imgui_key(ImGuiKey::DownArrow, 4); - imgui.set_imgui_key(ImGuiKey::PageUp, 5); - imgui.set_imgui_key(ImGuiKey::PageDown, 6); - imgui.set_imgui_key(ImGuiKey::Home, 7); - imgui.set_imgui_key(ImGuiKey::End, 8); - imgui.set_imgui_key(ImGuiKey::Delete, 9); - imgui.set_imgui_key(ImGuiKey::Backspace, 10); - imgui.set_imgui_key(ImGuiKey::Enter, 11); - imgui.set_imgui_key(ImGuiKey::Escape, 12); - imgui.set_imgui_key(ImGuiKey::A, 13); - imgui.set_imgui_key(ImGuiKey::C, 14); - imgui.set_imgui_key(ImGuiKey::V, 15); - imgui.set_imgui_key(ImGuiKey::X, 16); - imgui.set_imgui_key(ImGuiKey::Y, 17); - imgui.set_imgui_key(ImGuiKey::Z, 18); -} - -fn update_mouse(imgui: &mut ImGui, mouse_state: &mut MouseState) { - imgui.set_mouse_pos(mouse_state.pos.0 as f32, mouse_state.pos.1 as f32); - imgui.set_mouse_down([ - mouse_state.pressed.0, - mouse_state.pressed.1, - mouse_state.pressed.2, - false, - false, - ]); - imgui.set_mouse_wheel(mouse_state.wheel); - mouse_state.wheel = 0.0; -} diff --git a/imgui-examples/examples/support_gfx/mod.rs b/imgui-examples/examples/support_gfx/mod.rs index 788d4a2..98af283 100644 --- a/imgui-examples/examples/support_gfx/mod.rs +++ b/imgui-examples/examples/support_gfx/mod.rs @@ -1,14 +1,8 @@ -use imgui::{FontGlyphRange, FrameSize, ImFontConfig, ImGui, ImGuiMouseCursor, ImVec4, Ui}; +use imgui::{FontGlyphRange, ImFontConfig, ImGui, ImVec4, Ui}; use imgui_gfx_renderer::{Renderer, Shaders}; +use imgui_glutin_support; use std::time::Instant; -#[derive(Copy, Clone, PartialEq, Debug, Default)] -struct MouseState { - pos: (i32, i32), - pressed: (bool, bool, bool), - wheel: f32, -} - pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ui: F) { use gfx::{self, Device}; use gfx_window_glutin; @@ -93,17 +87,24 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ let mut renderer = Renderer::init(&mut imgui, &mut factory, shaders, main_color.clone()) .expect("Failed to initialize renderer"); - configure_keys(&mut imgui); + imgui_glutin_support::configure_keys(&mut imgui); let mut last_frame = Instant::now(); - let mut mouse_state = MouseState::default(); let mut quit = false; loop { events_loop.poll_events(|event| { - use glutin::ElementState::Pressed; - use glutin::WindowEvent::*; - use glutin::{Event, MouseButton, MouseScrollDelta, TouchPhase}; + use glutin::{ + Event, + WindowEvent::{CloseRequested, Resized}, + }; + + imgui_glutin_support::handle_event( + &mut imgui, + &event, + window.get_hidpi_factor(), + hidpi_factor, + ); if let Event::WindowEvent { event, .. } = event { match event { @@ -112,71 +113,6 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ renderer.update_render_target(main_color.clone()); } CloseRequested => quit = true, - KeyboardInput { input, .. } => { - use glutin::VirtualKeyCode as Key; - - let pressed = input.state == Pressed; - match input.virtual_keycode { - Some(Key::Tab) => imgui.set_key(0, pressed), - Some(Key::Left) => imgui.set_key(1, pressed), - Some(Key::Right) => imgui.set_key(2, pressed), - Some(Key::Up) => imgui.set_key(3, pressed), - Some(Key::Down) => imgui.set_key(4, pressed), - Some(Key::PageUp) => imgui.set_key(5, pressed), - Some(Key::PageDown) => imgui.set_key(6, pressed), - Some(Key::Home) => imgui.set_key(7, pressed), - Some(Key::End) => imgui.set_key(8, pressed), - Some(Key::Delete) => imgui.set_key(9, pressed), - Some(Key::Back) => imgui.set_key(10, pressed), - Some(Key::Return) => imgui.set_key(11, pressed), - Some(Key::Escape) => imgui.set_key(12, pressed), - Some(Key::A) => imgui.set_key(13, pressed), - Some(Key::C) => imgui.set_key(14, pressed), - Some(Key::V) => imgui.set_key(15, pressed), - Some(Key::X) => imgui.set_key(16, pressed), - Some(Key::Y) => imgui.set_key(17, pressed), - Some(Key::Z) => imgui.set_key(18, pressed), - Some(Key::LControl) | Some(Key::RControl) => { - imgui.set_key_ctrl(pressed) - } - Some(Key::LShift) | Some(Key::RShift) => imgui.set_key_shift(pressed), - Some(Key::LAlt) | Some(Key::RAlt) => imgui.set_key_alt(pressed), - Some(Key::LWin) | Some(Key::RWin) => imgui.set_key_super(pressed), - _ => {} - } - } - CursorMoved { position: pos, .. } => { - // Rescale position from glutin logical coordinates to our logical - // coordinates - mouse_state.pos = pos - .to_physical(window.get_hidpi_factor()) - .to_logical(hidpi_factor) - .into(); - } - MouseInput { state, button, .. } => match button { - MouseButton::Left => mouse_state.pressed.0 = state == Pressed, - MouseButton::Right => mouse_state.pressed.1 = state == Pressed, - MouseButton::Middle => mouse_state.pressed.2 = state == Pressed, - _ => {} - }, - MouseWheel { - delta: MouseScrollDelta::LineDelta(_, y), - phase: TouchPhase::Moved, - .. - } => mouse_state.wheel = y, - MouseWheel { - delta: MouseScrollDelta::PixelDelta(pos), - phase: TouchPhase::Moved, - .. - } => { - // Rescale pixel delta from glutin logical coordinates to our logical - // coordinates - mouse_state.wheel = pos - .to_physical(window.get_hidpi_factor()) - .to_logical(hidpi_factor) - .y as f32; - } - ReceivedCharacter(c) => imgui.add_input_character(c), _ => (), } } @@ -190,39 +126,9 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ let delta_s = delta.as_secs() as f32 + delta.subsec_nanos() as f32 / 1_000_000_000.0; last_frame = now; - update_mouse(&mut imgui, &mut mouse_state); + imgui_glutin_support::update_mouse_cursor(&imgui, &window); - let mouse_cursor = imgui.mouse_cursor(); - if imgui.mouse_draw_cursor() || mouse_cursor == ImGuiMouseCursor::None { - // Hide OS cursor - window.hide_cursor(true); - } else { - // Set OS cursor - window.hide_cursor(false); - window.set_cursor(match mouse_cursor { - ImGuiMouseCursor::None => unreachable!("mouse_cursor was None!"), - ImGuiMouseCursor::Arrow => glutin::MouseCursor::Arrow, - ImGuiMouseCursor::TextInput => glutin::MouseCursor::Text, - ImGuiMouseCursor::ResizeAll => glutin::MouseCursor::Move, - ImGuiMouseCursor::ResizeNS => glutin::MouseCursor::NsResize, - ImGuiMouseCursor::ResizeEW => glutin::MouseCursor::EwResize, - ImGuiMouseCursor::ResizeNESW => glutin::MouseCursor::NeswResize, - ImGuiMouseCursor::ResizeNWSE => glutin::MouseCursor::NwseResize, - ImGuiMouseCursor::Hand => glutin::MouseCursor::Hand, - }); - } - - // Rescale window size from glutin logical size to our logical size - let physical_size = window - .get_inner_size() - .unwrap() - .to_physical(window.get_hidpi_factor()); - let logical_size = physical_size.to_logical(hidpi_factor); - - let frame_size = FrameSize { - logical_size: logical_size.into(), - hidpi_factor, - }; + let frame_size = imgui_glutin_support::get_frame_size(&window, hidpi_factor).unwrap(); let ui = imgui.frame(frame_size, delta_s); if !run_ui(&ui) { @@ -238,40 +144,3 @@ pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ device.cleanup(); } } - -fn configure_keys(imgui: &mut ImGui) { - use imgui::ImGuiKey; - - imgui.set_imgui_key(ImGuiKey::Tab, 0); - imgui.set_imgui_key(ImGuiKey::LeftArrow, 1); - imgui.set_imgui_key(ImGuiKey::RightArrow, 2); - imgui.set_imgui_key(ImGuiKey::UpArrow, 3); - imgui.set_imgui_key(ImGuiKey::DownArrow, 4); - imgui.set_imgui_key(ImGuiKey::PageUp, 5); - imgui.set_imgui_key(ImGuiKey::PageDown, 6); - imgui.set_imgui_key(ImGuiKey::Home, 7); - imgui.set_imgui_key(ImGuiKey::End, 8); - imgui.set_imgui_key(ImGuiKey::Delete, 9); - imgui.set_imgui_key(ImGuiKey::Backspace, 10); - imgui.set_imgui_key(ImGuiKey::Enter, 11); - imgui.set_imgui_key(ImGuiKey::Escape, 12); - imgui.set_imgui_key(ImGuiKey::A, 13); - imgui.set_imgui_key(ImGuiKey::C, 14); - imgui.set_imgui_key(ImGuiKey::V, 15); - imgui.set_imgui_key(ImGuiKey::X, 16); - imgui.set_imgui_key(ImGuiKey::Y, 17); - imgui.set_imgui_key(ImGuiKey::Z, 18); -} - -fn update_mouse(imgui: &mut ImGui, mouse_state: &mut MouseState) { - imgui.set_mouse_pos(mouse_state.pos.0 as f32, mouse_state.pos.1 as f32); - imgui.set_mouse_down([ - mouse_state.pressed.0, - mouse_state.pressed.1, - mouse_state.pressed.2, - false, - false, - ]); - imgui.set_mouse_wheel(mouse_state.wheel); - mouse_state.wheel = 0.0; -} diff --git a/imgui-glium-examples/Cargo.lock b/imgui-glium-examples/Cargo.lock new file mode 100644 index 0000000..653e8aa --- /dev/null +++ b/imgui-glium-examples/Cargo.lock @@ -0,0 +1,693 @@ +[[package]] +name = "android_glue" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "backtrace" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "backtrace-sys" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bitflags" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "byteorder" +version = "1.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cc" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cfg-if" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "cgl" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gleam 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "cocoa" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "core-graphics" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "dlib" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "downcast-rs" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fnv" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "gl_generator" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "gleam" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glium" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "glutin" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winit 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)", + "x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "imgui" +version = "0.0.22-pre" +dependencies = [ + "imgui-sys 0.0.22-pre", +] + +[[package]] +name = "imgui-glium-examples" +version = "0.0.22-pre" +dependencies = [ + "glium 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", + "imgui 0.0.22-pre", + "imgui-glium-renderer 0.0.22-pre", + "imgui-glutin-support 0.0.22-pre", +] + +[[package]] +name = "imgui-glium-renderer" +version = "0.0.22-pre" +dependencies = [ + "glium 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", + "imgui 0.0.22-pre", + "imgui-sys 0.0.22-pre", +] + +[[package]] +name = "imgui-glutin-support" +version = "0.0.22-pre" +dependencies = [ + "glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "imgui 0.0.22-pre", +] + +[[package]] +name = "imgui-sys" +version = "0.0.22-pre" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "glium 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "khronos_api" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "lazy_static" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libc" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "libloading" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "lock_api" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "log" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "memmap" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "nix" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "objc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "osmesa-sys" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "owning_ref" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parking_lot_core" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "pkg-config" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "redox_syscall" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "remove_dir_all" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "scopeguard" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "shared_library" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smallvec" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "smithay-client-toolkit" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", + "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-commons 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-protocols 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stable_deref_trait" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "tempfile" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unreachable" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "void" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "wayland-client" +version = "0.20.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-commons 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-scanner 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-commons" +version = "0.20.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "downcast-rs 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-protocols" +version = "0.20.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-commons 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-scanner 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-sys 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-scanner" +version = "0.20.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "wayland-sys" +version = "0.20.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "winit" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cocoa 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "objc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "smithay-client-toolkit 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "wayland-client 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "x11-dl" +version = "2.18.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "xml-rs" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[metadata] +"checksum android_glue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "000444226fcff248f2bc4c7625be32c63caccfecc2723a2b9f78a7487a49c407" +"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" +"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" +"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" +"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" +"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" +"checksum cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "55e7ec0b74fe5897894cbc207092c577e87c52f8a59e8ca8d97ef37551f60a49" +"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum cocoa 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b44bd25bd275e9d74a5dff8ca55f2fb66c9ad5e12170d58697701df21a56e0e" +"checksum core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "58667b9a618a37ea8c4c4cb5298703e5dfadcd3698c79f54fc43e6a2e94733ea" +"checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" +"checksum core-graphics 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e54c4ab33705fa1fc8af375bb7929d68e1c1546c1ecef408966d8c3e49a1d84a" +"checksum dlib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "77e51249a9d823a4cb79e3eca6dcd756153e8ed0157b6c04775d04bf1b13b76a" +"checksum downcast-rs 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "18df8ce4470c189d18aa926022da57544f31e154631eb4cfe796aea97051fe6c" +"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" +"checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +"checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" +"checksum gl_generator 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a795170cbd85b5a7baa58d6d7525cae6a03e486859860c220f7ebbbdd379d0a" +"checksum gleam 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6a8901d6854a992b372214fd9cce664df1a29678e362b151de0d7a4efdcd47f" +"checksum glium 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ec8f9506ee0379c931299f280a6e06767b0dc6ac0f1890cf1cb6c30d600fca5" +"checksum glutin 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a70c5fe78efbd5a3b243a804ea1032053c584510f8822819f94cfb29b2100317" +"checksum khronos_api 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "037ab472c33f67b5fbd3e9163a2645319e5356fcd355efa6d4eb7fff4bbcb554" +"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7" +"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" +"checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" +"checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a" +"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" +"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff" +"checksum nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37e713a259ff641624b6cb20e3b12b2952313ba36b6823c0f16e6cfd9e5de17" +"checksum objc 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9833ab0efe5361b1e2122a0544a5d3359576911a42cb098c2e59be8650807367" +"checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b" +"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" +"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" +"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" +"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" +"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" +"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372" +"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" +"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" +"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" +"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" +"checksum shared_library 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5a9e7e0f2bfae24d8a5b5a66c5b257a83c7412304311512a0c054cd5e619da11" +"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d" +"checksum smithay-client-toolkit 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2051bffc6cbf271176e8ba1527f801b6444567daee15951ff5152aaaf7777b2f" +"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" +"checksum tempfile 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "55c1195ef8513f3273d55ff59fe5da6940287a0d7a98331254397f464833675b" +"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" +"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" +"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d" +"checksum wayland-client 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e7516a23419a55bd2e6d466c75a6a52c85718e5013660603289c2b8bee794b12" +"checksum wayland-commons 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)" = "d8609d59b95bf198bae4f3b064d55a712f2d529eec6aac98cc1f6e9cc911d47a" +"checksum wayland-protocols 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)" = "bd4d31a96be6ecdbaddbf35200f5af2daee01be592afecd8feaf443d417e9230" +"checksum wayland-scanner 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)" = "e674d85ae9c67cbbc590374d8f2e20a7a02fff87ce3a31fc52213afece8d05ad" +"checksum wayland-sys 0.20.12 (registry+https://github.com/rust-lang/crates.io-index)" = "87c82ee658aa657fdfd7061f22e442030d921cfefc5bad68bcf41973e67922f7" +"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum winit 0.16.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ec43db5991cc509f5b0c68cb0a0d3614f697c888999990a186a2e895c7f723c0" +"checksum x11-dl 2.18.3 (registry+https://github.com/rust-lang/crates.io-index)" = "940586acb859ea05c53971ac231685799a7ec1dee66ac0bccc0e6ad96e06b4e3" +"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2" diff --git a/imgui-glium-examples/Cargo.toml b/imgui-glium-examples/Cargo.toml new file mode 100644 index 0000000..9342f21 --- /dev/null +++ b/imgui-glium-examples/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "imgui-glium-examples" +version = "0.0.22-pre" +authors = ["Joonas Javanainen ", "imgui-rs contributors"] +description = "imgui crate examples using Glium backend" +homepage = "https://github.com/Gekkio/imgui-rs" +repository = "https://github.com/Gekkio/imgui-rs" +license = "MIT/Apache-2.0" +publish = false + +[dev-dependencies] +glium = { version = "0.22", default-features = true } +imgui = { version = "0.0.22-pre", path = "../" } +imgui-glium-renderer = { version = "0.0.22-pre", path = "../imgui-glium-renderer" } +imgui-glutin-support = { version = "0.0.22-pre", path = "../imgui-glutin-support" } diff --git a/imgui-glium-examples/examples/LICENSE.mplus b/imgui-glium-examples/examples/LICENSE.mplus new file mode 100644 index 0000000..e8fa893 --- /dev/null +++ b/imgui-glium-examples/examples/LICENSE.mplus @@ -0,0 +1,16 @@ +M+ FONTS Copyright (C) 2002-2017 M+ FONTS PROJECT + +- + +LICENSE_E + + + + +These fonts are free software. +Unlimited permission is granted to use, copy, and distribute them, with +or without modification, either commercially or noncommercially. +THESE FONTS ARE PROVIDED "AS IS" WITHOUT WARRANTY. + + +http://mplus-fonts.osdn.jp diff --git a/imgui-examples/examples/color_button.rs b/imgui-glium-examples/examples/color_button.rs similarity index 99% rename from imgui-examples/examples/color_button.rs rename to imgui-glium-examples/examples/color_button.rs index 41f2215..15af104 100644 --- a/imgui-examples/examples/color_button.rs +++ b/imgui-glium-examples/examples/color_button.rs @@ -2,6 +2,7 @@ extern crate glium; #[macro_use] extern crate imgui; extern crate imgui_glium_renderer; +extern crate imgui_glutin_support; use imgui::*; diff --git a/imgui-examples/examples/hello_world.rs b/imgui-glium-examples/examples/hello_world.rs similarity index 95% rename from imgui-examples/examples/hello_world.rs rename to imgui-glium-examples/examples/hello_world.rs index fd98eaf..6884cb9 100644 --- a/imgui-examples/examples/hello_world.rs +++ b/imgui-glium-examples/examples/hello_world.rs @@ -2,6 +2,7 @@ extern crate glium; #[macro_use] extern crate imgui; extern crate imgui_glium_renderer; +extern crate imgui_glutin_support; use imgui::*; diff --git a/imgui-glium-examples/examples/mplus-1p-regular.ttf b/imgui-glium-examples/examples/mplus-1p-regular.ttf new file mode 100644 index 0000000..4775e3a Binary files /dev/null and b/imgui-glium-examples/examples/mplus-1p-regular.ttf differ diff --git a/imgui-glium-examples/examples/support/mod.rs b/imgui-glium-examples/examples/support/mod.rs new file mode 100644 index 0000000..d6ecf16 --- /dev/null +++ b/imgui-glium-examples/examples/support/mod.rs @@ -0,0 +1,101 @@ +use imgui::{FontGlyphRange, ImFontConfig, ImGui, Ui}; +use imgui_glutin_support; +use std::time::Instant; + +pub fn run bool>(title: String, clear_color: [f32; 4], mut run_ui: F) { + use glium::glutin; + use glium::{Display, Surface}; + use imgui_glium_renderer::Renderer; + + let mut events_loop = glutin::EventsLoop::new(); + let context = glutin::ContextBuilder::new().with_vsync(true); + let builder = glutin::WindowBuilder::new() + .with_title(title) + .with_dimensions(glutin::dpi::LogicalSize::new(1024f64, 768f64)); + let display = Display::new(builder, context, &events_loop).unwrap(); + let window = display.gl_window(); + + let mut imgui = ImGui::init(); + imgui.set_ini_filename(None); + + // In the examples we only use integer DPI factors, because the UI can get very blurry + // otherwise. This might or might not be what you want in a real application. + let hidpi_factor = window.get_hidpi_factor().round(); + + let font_size = (13.0 * hidpi_factor) as f32; + + imgui.fonts().add_default_font_with_config( + ImFontConfig::new() + .oversample_h(1) + .pixel_snap_h(true) + .size_pixels(font_size), + ); + + imgui.fonts().add_font_with_config( + include_bytes!("../mplus-1p-regular.ttf"), + ImFontConfig::new() + .merge_mode(true) + .oversample_h(1) + .pixel_snap_h(true) + .size_pixels(font_size) + .rasterizer_multiply(1.75), + &FontGlyphRange::japanese(), + ); + + imgui.set_font_global_scale((1.0 / hidpi_factor) as f32); + + let mut renderer = Renderer::init(&mut imgui, &display).expect("Failed to initialize renderer"); + + imgui_glutin_support::configure_keys(&mut imgui); + + let mut last_frame = Instant::now(); + let mut quit = false; + + loop { + events_loop.poll_events(|event| { + use glium::glutin::{Event, WindowEvent::CloseRequested}; + + imgui_glutin_support::handle_event( + &mut imgui, + &event, + window.get_hidpi_factor(), + hidpi_factor, + ); + + if let Event::WindowEvent { event, .. } = event { + match event { + CloseRequested => quit = true, + _ => (), + } + } + }); + + let now = Instant::now(); + let delta = now - last_frame; + let delta_s = delta.as_secs() as f32 + delta.subsec_nanos() as f32 / 1_000_000_000.0; + last_frame = now; + + imgui_glutin_support::update_mouse_cursor(&imgui, &window); + + let frame_size = imgui_glutin_support::get_frame_size(&window, hidpi_factor).unwrap(); + + let ui = imgui.frame(frame_size, delta_s); + if !run_ui(&ui) { + break; + } + + let mut target = display.draw(); + target.clear_color( + clear_color[0], + clear_color[1], + clear_color[2], + clear_color[3], + ); + renderer.render(&mut target, ui).expect("Rendering failed"); + target.finish().unwrap(); + + if quit { + break; + } + } +} diff --git a/imgui-examples/examples/test_drawing_channels_split.rs b/imgui-glium-examples/examples/test_drawing_channels_split.rs similarity index 97% rename from imgui-examples/examples/test_drawing_channels_split.rs rename to imgui-glium-examples/examples/test_drawing_channels_split.rs index fc3c491..53adfa3 100644 --- a/imgui-examples/examples/test_drawing_channels_split.rs +++ b/imgui-glium-examples/examples/test_drawing_channels_split.rs @@ -1,6 +1,7 @@ extern crate glium; extern crate imgui; extern crate imgui_glium_renderer; +extern crate imgui_glutin_support; mod support; diff --git a/imgui-examples/examples/test_window.rs b/imgui-glium-examples/examples/test_window.rs similarity index 89% rename from imgui-examples/examples/test_window.rs rename to imgui-glium-examples/examples/test_window.rs index d111416..f76e1ee 100644 --- a/imgui-examples/examples/test_window.rs +++ b/imgui-glium-examples/examples/test_window.rs @@ -1,6 +1,7 @@ extern crate glium; extern crate imgui; extern crate imgui_glium_renderer; +extern crate imgui_glutin_support; mod support; diff --git a/imgui-examples/examples/test_window_impl.rs b/imgui-glium-examples/examples/test_window_impl.rs similarity index 99% rename from imgui-examples/examples/test_window_impl.rs rename to imgui-glium-examples/examples/test_window_impl.rs index 2778d5b..cab241b 100644 --- a/imgui-examples/examples/test_window_impl.rs +++ b/imgui-glium-examples/examples/test_window_impl.rs @@ -2,6 +2,7 @@ extern crate glium; #[macro_use] extern crate imgui; extern crate imgui_glium_renderer; +extern crate imgui_glutin_support; use imgui::*; diff --git a/imgui-glutin-support/src/lib.rs b/imgui-glutin-support/src/lib.rs index bd3efc9..7cac4fe 100644 --- a/imgui-glutin-support/src/lib.rs +++ b/imgui-glutin-support/src/lib.rs @@ -27,10 +27,17 @@ //! # fn main() { //! # let mut events_loop = EventsLoop::new(); //! # let mut imgui = ImGui::init(); +//! # let window_hidpi_factor = 1.0; +//! # let app_hidpi_factor = 1.0; //! events_loop.poll_events(|event| { //! // do application-specific stuff with event //! -//! imgui_glutin_support::handle_event(&mut imgui, &event); +//! imgui_glutin_support::handle_event( +//! &mut imgui, +//! &event, +//! window_hidpi_factor, +//! app_hidpi_factor +//! ); //! }); //! # } //! ``` @@ -51,11 +58,18 @@ //! # fn main() { //! # let mut events_loop = EventsLoop::new(); //! # let mut imgui = ImGui::init(); +//! # let window_hidpi_factor = 1.0; +//! # let app_hidpi_factor = 1.0; //! events_loop.poll_events(|event| { //! // do application-specific stuff with event //! //! // default handling for events -//! imgui_glutin_support::handle_event(&mut imgui, &event); +//! imgui_glutin_support::handle_event( +//! &mut imgui, +//! &event, +//! window_hidpi_factor, +//! app_hidpi_factor +//! ); //! //! // Scroll 10 times the pixels per line by handling LineDelta events again and //! // overriding the mouse wheel value @@ -132,10 +146,20 @@ pub fn handle_modifiers(imgui: &mut ImGui, modifiers: ModifiersState) { } /// Update imgui mouse wheel position -pub fn handle_mouse_scroll_delta(imgui: &mut ImGui, delta: MouseScrollDelta) { +pub fn handle_mouse_scroll_delta( + imgui: &mut ImGui, + delta: MouseScrollDelta, + window_hidpi_factor: f64, + app_hidpi_factor: f64, +) { match delta { MouseScrollDelta::LineDelta(_, y) => imgui.set_mouse_wheel(y), - MouseScrollDelta::PixelDelta(pos) => imgui.set_mouse_wheel(pos.y as f32), + MouseScrollDelta::PixelDelta(pos) => { + let pos = pos + .to_physical(window_hidpi_factor) + .to_logical(app_hidpi_factor); + imgui.set_mouse_wheel(pos.y as f32) + } } } @@ -154,15 +178,27 @@ pub fn handle_mouse_button_state(imgui: &mut ImGui, button: MouseButton, state: } /// Update imgui state from glutin event -pub fn handle_event(imgui: &mut ImGui, event: &Event) { +pub fn handle_event( + imgui: &mut ImGui, + event: &Event, + window_hidpi_factor: f64, + app_hidpi_factor: f64, +) { match event { - &Event::WindowEvent { ref event, .. } => handle_window_event(imgui, event), + &Event::WindowEvent { ref event, .. } => { + handle_window_event(imgui, event, window_hidpi_factor, app_hidpi_factor) + } _ => (), } } /// Update imgui state from glutin window event -pub fn handle_window_event(imgui: &mut ImGui, event: &WindowEvent) { +pub fn handle_window_event( + imgui: &mut ImGui, + event: &WindowEvent, + window_hidpi_factor: f64, + app_hidpi_factor: f64, +) { use WindowEvent::*; match event { &KeyboardInput { input, .. } => handle_keyboard_input(imgui, input), @@ -172,6 +208,9 @@ pub fn handle_window_event(imgui: &mut ImGui, event: &WindowEvent) { modifiers, .. } => { + let position = position + .to_physical(window_hidpi_factor) + .to_logical(app_hidpi_factor); imgui.set_mouse_pos(position.x as f32, position.y as f32); handle_modifiers(imgui, modifiers); } @@ -181,7 +220,7 @@ pub fn handle_window_event(imgui: &mut ImGui, event: &WindowEvent) { phase: TouchPhase::Moved, .. } => { - handle_mouse_scroll_delta(imgui, delta); + handle_mouse_scroll_delta(imgui, delta, window_hidpi_factor, app_hidpi_factor); handle_modifiers(imgui, modifiers); } &MouseInput { @@ -223,9 +262,12 @@ pub fn update_mouse_cursor(imgui: &ImGui, window: &Window) { /// Get the current frame size for imgui frame rendering. /// /// Returns `None` if the window no longer exists -pub fn get_frame_size(window: &mut Window) -> Option { +pub fn get_frame_size(window: &Window, app_hidpi_factor: f64) -> Option { window.get_inner_size().map(|logical_size| FrameSize { - logical_size: logical_size.into(), - hidpi_factor: window.get_hidpi_factor(), + logical_size: logical_size + .to_physical(window.get_hidpi_factor()) + .to_logical(app_hidpi_factor) + .into(), + hidpi_factor: app_hidpi_factor, }) }