diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..14f7520 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1118 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ab_glyph" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcdbc68024b653943864d436fe8a24b028095bc1cf91a8926f8241e4aaffe59" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330223a1aecc308757b9926e9391c9b47f8ef2dbd8aea9df88312aea18c5e8d6" + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "ahash" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" +dependencies = [ + "cfg-if", + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "ash" +version = "0.37.2+1.3.238" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28bf19c1f0a470be5fbf7522a308a05df06610252c5bcf5143e1b23f629a9a03" +dependencies = [ + "libloading", +] + +[[package]] +name = "atomic_refcell" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "bumpalo" +version = "3.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" + +[[package]] +name = "bytemuck" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fe233b960f12f8007e3db2d136e3cb1c291bfd7396e384ee76025fc1a3932b4" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "cc" +version = "1.0.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "copyless" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2df960f5d869b2dd8532793fde43eb5427cceb126c929747a26823ab0eeb536" + +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "core-graphics-types" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" +dependencies = [ + "bitflags", + "core-foundation", + "foreign-types", + "libc", +] + +[[package]] +name = "cty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" + +[[package]] +name = "d3d12" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "827914e1f53b1e0e025ecd3d967a7836b7bcb54520f90e21ef8df7b4d88a2759" +dependencies = [ + "bitflags", + "libloading", + "winapi", +] + +[[package]] +name = "ecolor" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f99fe3cac305af9d6d92971af60d0f7ea4d783201ef1673571567b6699964d9" + +[[package]] +name = "egui" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc9fcd393c3daaaf5909008a1d948319d538b79c51871e4df0993260260a94e4" +dependencies = [ + "ahash 0.8.2", + "epaint 0.19.0", + "nohash-hasher", +] + +[[package]] +name = "egui" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6412a21e0bde7c0918f7fb44bbbb86b5e1f88e63c026a4e747cc7af02f76dfbe" +dependencies = [ + "ahash 0.8.2", + "epaint 0.21.0", + "nohash-hasher", +] + +[[package]] +name = "egui-sdl2-event" +version = "0.3.0" +dependencies = [ + "egui 0.21.0", + "sdl2", +] + +[[package]] +name = "egui-wgpu" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f12a8d8f92a429e2e9399003bc01d48f54aefa6fec126cbd3462e313c0ee0e91" +dependencies = [ + "bytemuck", + "egui 0.19.0", + "tracing", + "type-map", + "wgpu", +] + +[[package]] +name = "emath" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9542a40106fdba943a055f418d1746a050e1a903a049b030c2b097d4686a33cf" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "emath" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8ecd80612937e0267909d5351770fe150004e24dab93954f69ca62eecd3f77e" + +[[package]] +name = "epaint" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ba04741be7f6602b1a1b28f1082cce45948a7032961c52814f8946b28493300" +dependencies = [ + "ab_glyph", + "ahash 0.8.2", + "atomic_refcell", + "bytemuck", + "emath 0.19.0", + "nohash-hasher", + "parking_lot", +] + +[[package]] +name = "epaint" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e78b5c58a1f7f621f9d546add2adce20636422c9b251e29f749e8a2f713c95" +dependencies = [ + "ab_glyph", + "ahash 0.8.2", + "atomic_refcell", + "ecolor", + "emath 0.21.0", + "nohash-hasher", + "parking_lot", +] + +[[package]] +name = "example" +version = "0.1.0" +dependencies = [ + "egui 0.19.0", + "egui-sdl2-event", + "egui-wgpu", + "pollster", + "sdl2", + "wgpu", +] + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "getrandom" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "glow" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919" +dependencies = [ + "js-sys", + "slotmap", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gpu-alloc" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fc59e5f710e310e76e6707f86c561dd646f69a8876da9131703b2f717de818d" +dependencies = [ + "bitflags", + "gpu-alloc-types", +] + +[[package]] +name = "gpu-alloc-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54804d0d6bc9d7f26db4eaec1ad10def69b599315f487d32c334a80d1efe67a5" +dependencies = [ + "bitflags", +] + +[[package]] +name = "gpu-descriptor" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" +dependencies = [ + "bitflags", + "gpu-descriptor-types", + "hashbrown", +] + +[[package]] +name = "gpu-descriptor-types" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "363e3677e55ad168fef68cf9de3a4a310b53124c5e784c53a1d70e92d23f2126" +dependencies = [ + "bitflags", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.6", +] + +[[package]] +name = "hexf-parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" + +[[package]] +name = "indexmap" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "inplace_it" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e567468c50f3d4bc7397702e09b380139f9b9288b4e909b070571007f8b5bf78" + +[[package]] +name = "js-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "khronos-egl" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" +dependencies = [ + "libc", + "libloading", + "pkg-config", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.139" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "metal" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de11355d1f6781482d027a3b4d4de7825dcedb197bf573e0596d00008402d060" +dependencies = [ + "bitflags", + "block", + "core-graphics-types", + "foreign-types", + "log", + "objc", +] + +[[package]] +name = "naga" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f50357e1167a3ab92d6b3c7f4bf5f7fd13fde3f4b28bf0d5ea07b5100fdb6c0" +dependencies = [ + "bit-set", + "bitflags", + "codespan-reporting", + "hexf-parse", + "indexmap", + "log", + "num-traits", + "rustc-hash", + "spirv", + "termcolor", + "thiserror", + "unicode-xid", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", + "objc_exception", +] + +[[package]] +name = "objc_exception" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +dependencies = [ + "cc", +] + +[[package]] +name = "once_cell" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" + +[[package]] +name = "owned_ttf_parser" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18904d3c65493a9f0d7542293d1a7f69bfdc309a6b9ef4f46dc3e58b0577edc5" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pkg-config" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" + +[[package]] +name = "pollster" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5da3b0203fd7ee5720aa0b5e790b591aa5d3f41c3ed2c34a3a393382198af2f7" + +[[package]] +name = "proc-macro2" +version = "1.0.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "profiling" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74605f360ce573babfe43964cbe520294dcb081afbf8c108fc6e23036b4da2df" + +[[package]] +name = "quote" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "range-alloc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6" + +[[package]] +name = "raw-window-handle" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" +dependencies = [ + "cty", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "renderdoc-sys" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "sdl2" +version = "0.35.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7959277b623f1fb9e04aea73686c3ca52f01b2145f8ea16f4ff30d8b7623b1a" +dependencies = [ + "bitflags", + "lazy_static", + "libc", + "raw-window-handle", + "sdl2-sys", +] + +[[package]] +name = "sdl2-sys" +version = "0.35.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3586be2cf6c0a8099a79a12b4084357aa9b3e0b0d7980e3b67aaf7a9d55f9f0" +dependencies = [ + "cfg-if", + "libc", + "pkg-config", + "version-compare", +] + +[[package]] +name = "slotmap" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +dependencies = [ + "version_check", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "spirv" +version = "0.2.0+1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" +dependencies = [ + "bitflags", + "num-traits", +] + +[[package]] +name = "syn" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "thiserror" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing" +version = "0.1.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "ttf-parser" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "375812fa44dab6df41c195cd2f7fecb488f6c09fbaafb62807488cefab642bff" + +[[package]] +name = "type-map" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "deb68604048ff8fa93347f02441e4487594adc20bb8a084f9e564d2b827a0a9f" +dependencies = [ + "rustc-hash", +] + +[[package]] +name = "unicode-ident" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" + +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + +[[package]] +name = "version-compare" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" + +[[package]] +name = "web-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wgpu" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "277e967bf8b7820a76852645a6bce8bbd31c32fda2042e82d8e3ea75fda8892d" +dependencies = [ + "arrayvec", + "js-sys", + "log", + "naga", + "parking_lot", + "raw-window-handle", + "smallvec", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "wgpu-core", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-core" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b92788dec9d0c1bed849a1b83f01b2ee12819bf04a79c90f68e4173f7b5ba2" +dependencies = [ + "arrayvec", + "bit-vec", + "bitflags", + "cfg_aliases", + "codespan-reporting", + "copyless", + "fxhash", + "log", + "naga", + "parking_lot", + "profiling", + "raw-window-handle", + "smallvec", + "thiserror", + "web-sys", + "wgpu-hal", + "wgpu-types", +] + +[[package]] +name = "wgpu-hal" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20cbdfc3d0637dba3d5536b93adef3d26023a0b96f0e1ee5ee9560a401d9f646" +dependencies = [ + "android_system_properties", + "arrayvec", + "ash", + "bit-set", + "bitflags", + "block", + "core-graphics-types", + "d3d12", + "foreign-types", + "fxhash", + "glow", + "gpu-alloc", + "gpu-descriptor", + "inplace_it", + "js-sys", + "khronos-egl", + "libloading", + "log", + "metal", + "naga", + "objc", + "parking_lot", + "profiling", + "range-alloc", + "raw-window-handle", + "renderdoc-sys", + "thiserror", + "wasm-bindgen", + "web-sys", + "wgpu-types", + "winapi", +] + +[[package]] +name = "wgpu-types" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f762cbc08e1a51389859cf9c199c7aef544789cf3510889aab12c607f701604" +dependencies = [ + "bitflags", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" diff --git a/Cargo.toml b/Cargo.toml index fb8c798..b620034 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,17 +1,6 @@ -[package] -name = "egui-sdl2-event" -authors = ["Valtteri Vallius"] -version = "0.2.2" -edition = "2021" -keywords = ["sdl2", "egui"] -categories = ["gui", "input"] -description = "Provides event handling for egui in SDL2 window applications." -license = "MIT" -readme = "README.md" -repository = "https://github.com/kaphula/egui-sdl2-event" -homepage = "https://github.com/kaphula/egui-sdl2-event" - - -[dependencies] -sdl2 = "0.35.2" -egui = { version = "0.19.0" } +[workspace] +resolver = "2" +members = [ + "egui-sdl2-event", + "example" +] \ No newline at end of file diff --git a/egui-sdl2-event/.gitignore b/egui-sdl2-event/.gitignore new file mode 100644 index 0000000..bccb290 --- /dev/null +++ b/egui-sdl2-event/.gitignore @@ -0,0 +1,3 @@ +**/target +target/ +.idea/ \ No newline at end of file diff --git a/egui-sdl2-event/Cargo.lock b/egui-sdl2-event/Cargo.lock new file mode 100644 index 0000000..b09bb0b --- /dev/null +++ b/egui-sdl2-event/Cargo.lock @@ -0,0 +1,285 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ab_glyph" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcdbc68024b653943864d436fe8a24b028095bc1cf91a8926f8241e4aaffe59" +dependencies = [ + "ab_glyph_rasterizer", + "owned_ttf_parser", +] + +[[package]] +name = "ab_glyph_rasterizer" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330223a1aecc308757b9926e9391c9b47f8ef2dbd8aea9df88312aea18c5e8d6" + +[[package]] +name = "ahash" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + +[[package]] +name = "atomic_refcell" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b5e5f48b927f04e952dedc932f31995a65a0bf65ec971c74436e51bf6e970d" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "ecolor" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b601108bca3af7650440ace4ca55b2daf52c36f2635be3587d77b16efd8d0691" + +[[package]] +name = "egui" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65a5e883a316e53866977450eecfbcac9c48109c2ab3394af29feb83fcde4ea9" +dependencies = [ + "ahash", + "epaint", + "nohash-hasher", +] + +[[package]] +name = "egui-sdl2-event" +version = "0.2.2" +dependencies = [ + "egui", + "sdl2", +] + +[[package]] +name = "emath" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5277249c8c3430e7127e4f2c40a77485e7baf11ae132ce9b3253a8ed710df0a0" + +[[package]] +name = "epaint" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de14b65fe5e423e0058f77a8beb2c863b056d0566d6c4ce0d097aa5814cb705a" +dependencies = [ + "ab_glyph", + "ahash", + "atomic_refcell", + "ecolor", + "emath", + "nohash-hasher", + "parking_lot", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.138" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "nohash-hasher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" + +[[package]] +name = "once_cell" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" + +[[package]] +name = "owned_ttf_parser" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18904d3c65493a9f0d7542293d1a7f69bfdc309a6b9ef4f46dc3e58b0577edc5" +dependencies = [ + "ttf-parser", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "sdl2" +version = "0.35.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7959277b623f1fb9e04aea73686c3ca52f01b2145f8ea16f4ff30d8b7623b1a" +dependencies = [ + "bitflags", + "lazy_static", + "libc", + "sdl2-sys", +] + +[[package]] +name = "sdl2-sys" +version = "0.35.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3586be2cf6c0a8099a79a12b4084357aa9b3e0b0d7980e3b67aaf7a9d55f9f0" +dependencies = [ + "cfg-if", + "libc", + "version-compare", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "ttf-parser" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "375812fa44dab6df41c195cd2f7fecb488f6c09fbaafb62807488cefab642bff" + +[[package]] +name = "version-compare" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" diff --git a/egui-sdl2-event/Cargo.toml b/egui-sdl2-event/Cargo.toml new file mode 100644 index 0000000..4d929e5 --- /dev/null +++ b/egui-sdl2-event/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "egui-sdl2-event" +authors = ["Valtteri Vallius"] +version = "0.3.0" +edition = "2021" +keywords = ["sdl2", "egui"] +categories = ["gui", "input"] +description = "Provides event handling for egui in SDL2 window applications." +license = "MIT" +readme = "README.md" +repository = "https://github.com/kaphula/egui-sdl2-event" +homepage = "https://github.com/kaphula/egui-sdl2-event" + + +[dependencies] +sdl2 = "0.35.2" +egui = { version = "0.21.0" } diff --git a/LICENSE b/egui-sdl2-event/LICENSE similarity index 100% rename from LICENSE rename to egui-sdl2-event/LICENSE diff --git a/README.md b/egui-sdl2-event/README.md similarity index 80% rename from README.md rename to egui-sdl2-event/README.md index c735e61..84d3a0a 100644 --- a/README.md +++ b/egui-sdl2-event/README.md @@ -7,10 +7,17 @@ the [egui-wgpu](https://github.com/emilk/egui/tree/master/crates/egui-wgpu) back Most of the code is just adaptively copied from [egui_sdl2_gl](https://github.com/ArjunNair/egui_sdl2_gl) -Simple [example](https://github.com/kaphula/egui-sdl2-event-example) program. [crates.io link](https://crates.io/crates/egui-sdl2-event) +## Example + +Clone the [development repository](https://github.com/kaphula/egui-sdl2-event) for simple example program. + +To run the example program, use this command at the root of the repository: + +`cargo run --bin example` + ## Related You might be interested in checking out [egui_sdl2_platform](https://crates.io/crates/egui_sdl2_platform) as it seems to diff --git a/src/lib.rs b/egui-sdl2-event/src/lib.rs similarity index 70% rename from src/lib.rs rename to egui-sdl2-event/src/lib.rs index 6d63191..6336fb9 100644 --- a/src/lib.rs +++ b/egui-sdl2-event/src/lib.rs @@ -1,9 +1,12 @@ +use std::time::Instant; + use egui::{Key, Modifiers, PointerButton, Pos2, RawInput, Rect}; use sdl2::event::WindowEvent; use sdl2::keyboard::Keycode; use sdl2::keyboard::Mod; use sdl2::mouse::{Cursor, MouseButton, SystemCursor}; use sdl2::video::Window; +use sdl2::VideoSubsystem; pub struct FusedCursor { pub cursor: sdl2::mouse::Cursor, @@ -92,11 +95,83 @@ pub fn translate_virtual_key_code(key: sdl2::keyboard::Keycode) -> Option DpiData { + match &self { + DpiMode::Auto => get_auto_dpi(window, video_subsystem, 1.0), + DpiMode::AutoScaled(scale) => { + assert!( + scale > &0.0, + "AutoScaled scale value cannot be zero or negative!" + ); + get_auto_dpi(window, video_subsystem, *scale) + } + DpiMode::Custom(c) => DpiData { + dpi: *c, + scale: 1.0, + apply_to_mouse_position: should_scale_input(), + }, + } + } +} + +struct DpiData { + dpi: f32, + scale: f32, + apply_to_mouse_position: bool, +} + +impl DpiData { + fn scaled_dpi(&self) -> f32 { + self.dpi * self.scale + } +} + +fn should_scale_input() -> bool { + cfg!(target_os = "linux") +} + +fn get_auto_dpi(window: &Window, video_subsystem: &VideoSubsystem, scale: f32) -> DpiData { + if should_scale_input() { + // Unfortunately it won't work on linux because the allow_highdpi seems to be ignored, + // so we have to do this workaround + let dpi = video_subsystem + .display_dpi(window.display_index().unwrap_or(0)) + .map(|(_, dpi, _)| dpi / 96.0) + .unwrap_or(1.0); + + DpiData { + dpi: dpi, + scale: scale, + apply_to_mouse_position: true, + } + } else { + // This seems to be the recommended way to get the dpi + // https://wiki.libsdl.org/SDL2/SDL_GetDisplayDPI + DpiData { + dpi: (window.drawable_size().0 as f32 / window.size().0 as f32), + scale: scale, + apply_to_mouse_position: false, + } + } } impl EguiSDL2State { @@ -111,7 +186,6 @@ impl EguiSDL2State { } use sdl2::event::Event::*; - let pixels_per_point = self.dpi_scaling; if event.get_window_id() != Some(window.id()) { return; } @@ -119,13 +193,13 @@ impl EguiSDL2State { // handle when window Resized and SizeChanged. Window { win_event, .. } => match win_event { WindowEvent::Resized(x, y) | sdl2::event::WindowEvent::SizeChanged(x, y) => { - self.update_screen_rect(*x as u32, *y as u32); + self.update_screen_rect(window); + self.dpi_data = self.dpi_mode.get_dpi(window, window.subsystem()); } _ => (), }, MouseButtonDown { mouse_btn, .. } => { if let Some(pressed) = sdl_button_to_egui(mouse_btn) { - println!("press event!"); self.raw_input.events.push(egui::Event::PointerButton { pos: self.mouse_pointer_position, button: pressed, @@ -146,15 +220,20 @@ impl EguiSDL2State { } MouseMotion { x, y, .. } => { - self.mouse_pointer_position = - egui::pos2(*x as f32 / pixels_per_point, *y as f32 / pixels_per_point); + let factor = if self.dpi_data.apply_to_mouse_position { + self.dpi_data.scale + } else { + 1.0 + }; + + self.mouse_pointer_position = egui::pos2(*x as f32 / factor, *y as f32 / factor); self.raw_input .events .push(egui::Event::PointerMoved(self.mouse_pointer_position)); } KeyUp { - keycode, keymod, .. + keycode, keymod, repeat, .. } => { let key_code = match keycode { Some(key_code) => key_code, @@ -181,12 +260,13 @@ impl EguiSDL2State { self.raw_input.events.push(egui::Event::Key { key, pressed: false, + repeat: *repeat, modifiers: self.modifiers, }); } KeyDown { - keycode, keymod, .. + keycode, keymod, repeat, .. } => { let key_code = match keycode { Some(key_code) => key_code, @@ -214,6 +294,7 @@ impl EguiSDL2State { self.raw_input.events.push(egui::Event::Key { key, pressed: true, + repeat: *repeat, modifiers: self.modifiers, }); @@ -262,31 +343,52 @@ impl EguiSDL2State { } } - pub fn update_screen_rect(&mut self, width: u32, height: u32) { - let inv_scale = 1.0 / self.dpi_scaling; - let rect = egui::vec2(width as f32 * inv_scale, height as f32 * inv_scale); + pub fn update_screen_rect(&mut self, window: &Window) { + let size = window.size(); + let rect = egui::vec2(size.0 as f32, size.1 as f32); self.raw_input.screen_rect = Some(Rect::from_min_size(Pos2::new(0f32, 0f32), rect)); } - pub fn update_time(&mut self, running_time: Option, delta: f32) { - self.raw_input.time = running_time; - self.raw_input.predicted_dt = delta; + pub fn take_egui_input(&mut self, window: &Window) -> RawInput { + self.raw_input.time = Some(self.start_time.elapsed().as_secs_f64()); + + let pixels_per_point = self.dpi_data.scaled_dpi(); + + let drawable_size = window.drawable_size(); + let screen_size_in_points = + egui::vec2(drawable_size.0 as f32, drawable_size.1 as f32) / pixels_per_point; + + self.raw_input.pixels_per_point = Some(pixels_per_point); + self.raw_input.screen_rect = + if screen_size_in_points.x > 0.0 && screen_size_in_points.y > 0.0 { + Some(egui::Rect::from_min_size( + egui::Pos2::ZERO, + screen_size_in_points, + )) + } else { + None + }; + + self.raw_input.take() } - pub fn new(width: u32, height: u32, dpi_scaling: f32) -> Self { - let inv_scale = 1.0 / dpi_scaling; - let rect = egui::vec2(width as f32 * inv_scale, height as f32 * inv_scale); - let screen_rect = Rect::from_min_size(Pos2::new(0f32, 0f32), rect); + /// Creates new EguiSDL2State. + /// + /// Panics if `DpiMode::AutoScaled` value is zero or less than zero. + pub fn new(window: &Window, video_subsystem: &VideoSubsystem, dpi_mode: DpiMode) -> Self { + let dpi_data = dpi_mode.get_dpi(window, video_subsystem); let raw_input = RawInput { - screen_rect: Some(screen_rect), - pixels_per_point: Some(dpi_scaling), + pixels_per_point: Some(dpi_data.dpi), ..RawInput::default() }; let modifiers = Modifiers::default(); + EguiSDL2State { + start_time: Instant::now(), raw_input, modifiers, - dpi_scaling, + dpi_mode, + dpi_data, mouse_pointer_position: egui::Pos2::new(0.0, 0.0), fused_cursor: FusedCursor::new(), } @@ -333,4 +435,19 @@ impl EguiSDL2State { fused.cursor.set(); } } + + /// Gets the current dpi value including scaling. + pub fn dpi(&self) -> f32 { + self.dpi_data.scaled_dpi() + } + + /// Gets the current dpi value not including scaling. + pub fn dpi_without_scaling(&self) -> f32 { + self.dpi_data.dpi + } + + /// Gets the dpi scaling factor. + pub fn dpi_scale_factor(&self) -> f32 { + self.dpi_data.scale + } } diff --git a/example/Cargo.toml b/example/Cargo.toml new file mode 100644 index 0000000..57851d7 --- /dev/null +++ b/example/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "example" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +sdl2 = {version= "0.35.2", features = ["raw-window-handle", "static-link", "use-pkgconfig"] } +egui-sdl2-event = { path = "../egui-sdl2-event"} +egui-wgpu = "0.19.0" +egui = "0.19.0" +wgpu = "0.13.0" +pollster = "0.2.5" + + + diff --git a/example/src/frame_timer.rs b/example/src/frame_timer.rs new file mode 100644 index 0000000..c358e70 --- /dev/null +++ b/example/src/frame_timer.rs @@ -0,0 +1,41 @@ +use sdl2::sys::Uint32; +pub struct FrameTimer { + last_time: u32, + frame_time: u32, + delta: f32, + start: u32, + stop: u32, +} + +pub const MS_TO_SECONDS: f32 = 1.0 / 1000.0; +impl FrameTimer { + pub fn new() -> FrameTimer { + FrameTimer { + last_time: 0, + frame_time: 0, + delta: 0.0, + start: 0, + stop: 0, + } + } + + fn time_now(&self) -> Uint32 { + #[allow(unsafe_code)] + unsafe { + sdl2::sys::SDL_GetTicks() + } + } + + pub fn time_start(&mut self) { + self.frame_time = self.stop - self.start; + self.delta = self.frame_time as f32 * MS_TO_SECONDS; + self.start = self.time_now(); + } + pub fn time_stop(&mut self) { + self.stop = self.time_now(); + } + + pub fn delta(&self) -> f32 { + self.delta + } +} diff --git a/example/src/main.rs b/example/src/main.rs new file mode 100644 index 0000000..7ea648d --- /dev/null +++ b/example/src/main.rs @@ -0,0 +1,258 @@ +mod frame_timer; + +use crate::frame_timer::FrameTimer; +use core::default::Default; +use egui::mutex::RwLock; +use egui::Rgba; +use egui_sdl2_event::EguiSDL2State; +use egui_wgpu::renderer; +use egui_wgpu::renderer::RenderPass; +use sdl2::event::{Event, WindowEvent}; +use sdl2::keyboard::Keycode; +use sdl2::video::Window; +use sdl2::{Sdl, VideoSubsystem}; +use std::sync::Arc; +use wgpu::{Device, Queue, Surface, SurfaceConfiguration}; + +const INITIAL_WIDTH: u32 = 800; +const INITIAL_HEIGHT: u32 = 600; + +struct WGPUSDL2 { + sdl_window: Window, + surface: Surface, + device: Device, + queue: Queue, + sdl_context: Sdl, + sdl_video_subsystem: VideoSubsystem, + surface_config: SurfaceConfiguration, +} + +fn init_sdl(width: u32, height: u32) -> WGPUSDL2 { + let sdl_context = sdl2::init().expect("Cannot initialize SDL2!"); + let video_subsystem = sdl_context.video().expect("Cannot get SDL2 context!"); + let window = video_subsystem + .window("egui-sdl2-event-example", width, height) + .position_centered() + .resizable() + .build() + .map_err(|e| e.to_string()) + .expect("Cannot create SDL2 window!"); + + let instance = wgpu::Instance::new(wgpu::Backends::PRIMARY); + #[allow(unsafe_code)] + let surface = unsafe { instance.create_surface(&window) }; + let adapter_opt = pollster::block_on(instance.request_adapter(&wgpu::RequestAdapterOptions { + power_preference: wgpu::PowerPreference::HighPerformance, + force_fallback_adapter: false, + compatible_surface: Some(&surface), + })); + let adapter = match adapter_opt { + Some(a) => a, + None => panic!("Failed to find wgpu adapter!"), + }; + + let (device, queue) = match pollster::block_on(adapter.request_device( + &wgpu::DeviceDescriptor { + limits: wgpu::Limits::default(), + label: Some("device"), + features: wgpu::Features::empty(), + }, + None, + )) { + Ok(a) => a, + Err(e) => panic!("{}", e.to_string()), + }; + + // let format = surface.get_preferred_format(&adapter).unwrap(); + let format = surface.get_supported_formats(&adapter)[0]; + let config = wgpu::SurfaceConfiguration { + usage: wgpu::TextureUsages::RENDER_ATTACHMENT, + format, + width, + height, + present_mode: wgpu::PresentMode::Mailbox, + }; + surface.configure(&device, &config); + + WGPUSDL2 { + sdl_context, + sdl_video_subsystem: video_subsystem, + sdl_window: window, + surface, + surface_config: config, + device, + queue, + } +} + +fn paint_and_update_textures( + device: &Device, + queue: &Queue, + surface: &Surface, + surface_config: &SurfaceConfiguration, + egui_rpass: Arc>, + pixels_per_point: f32, + clear_color: egui::Rgba, + clipped_primitives: &[egui::ClippedPrimitive], + textures_delta: &egui::TexturesDelta, +) { + let output_frame = match surface.get_current_texture() { + Ok(frame) => frame, + Err(wgpu::SurfaceError::Outdated) => { + return; + } + Err(_) => { + return; + } + }; + let output_view = output_frame + .texture + .create_view(&wgpu::TextureViewDescriptor::default()); + + let mut encoder = device.create_command_encoder(&wgpu::CommandEncoderDescriptor { + label: Some("encoder"), + }); + + // Upload all resources for the GPU. + let screen_descriptor = renderer::ScreenDescriptor { + size_in_pixels: [surface_config.width, surface_config.height], + pixels_per_point, + }; + + { + let mut rpass = egui_rpass.write(); + for (id, image_delta) in &textures_delta.set { + rpass.update_texture(device, queue, *id, image_delta); + } + + rpass.update_buffers(device, queue, clipped_primitives, &screen_descriptor); + } + + // Record all render passes. + egui_rpass.read().execute( + &mut encoder, + &output_view, + clipped_primitives, + &screen_descriptor, + Some(wgpu::Color { + r: clear_color.r() as f64, + g: clear_color.g() as f64, + b: clear_color.b() as f64, + a: clear_color.a() as f64, + }), + ); + + { + let mut rpass = egui_rpass.write(); + for id in &textures_delta.free { + rpass.free_texture(id); + } + } + + // Submit the commands. + queue.submit(std::iter::once(encoder.finish())); + + // Redraw egui + output_frame.present(); +} + +fn main() { + let mut sys = init_sdl(INITIAL_WIDTH, INITIAL_HEIGHT); + let mut event_pump = sys + .sdl_context + .event_pump() + .expect("Cannot create SDL2 event pump"); + + let egui_ctx = egui::Context::default(); + let egui_rpass = Arc::new(RwLock::new(RenderPass::new( + &sys.device, + sys.surface_config.format, + 1, + ))); + + let mut frame_timer = FrameTimer::new(); + + let mut egui_sdl2_state = EguiSDL2State::new( + &sys.sdl_window, + &sys.sdl_video_subsystem, + egui_sdl2_event::DpiMode::Auto, + ); + + let mut running_time: f64 = 0.0; + let mut checkbox1_checked = false; + 'running: loop { + frame_timer.time_start(); + let delta = frame_timer.delta(); + running_time += delta as f64; + + for event in event_pump.poll_iter() { + match &event { + Event::Quit { .. } + | Event::KeyDown { + keycode: Some(Keycode::Escape), + .. + } => { + break 'running; + } + Event::Window { + window_id, + win_event: + WindowEvent::SizeChanged(width, height) | WindowEvent::Resized(width, height), + .. + } => { + if *window_id == sys.sdl_window.id() { + let config = &mut sys.surface_config; + config.width = *width as u32; + config.height = *height as u32; + sys.surface.configure(&sys.device, config); + } + } + _ => {} + } + egui_sdl2_state.sdl2_input_to_egui(&sys.sdl_window, &event) + } + + let raw_input = egui_sdl2_state.take_egui_input(&sys.sdl_window); + let full_output = egui_ctx.run(raw_input, |ctx| { + egui::Window::new("Settings") + .resizable(true) + .vscroll(true) + .show(ctx, |ui| { + ui.label("This"); + ui.label("is"); + ui.label("a"); + ui.label("long"); + ui.label("list"); + ui.label("of"); + ui.label("labels"); + ui.label("to"); + ui.label("demonstrate"); + ui.label("scrolling!"); + + if ui.button("Press me").clicked() { + println!("you pressed me!") + } + ui.checkbox(&mut checkbox1_checked, "checkbox1"); + ui.end_row(); + }); + }); + + egui_sdl2_state.process_output(&sys.sdl_window, &full_output.platform_output); + let tris = egui_ctx.tessellate(full_output.shapes); + if full_output.repaint_after.is_zero() { + paint_and_update_textures( + &sys.device, + &sys.queue, + &sys.surface, + &sys.surface_config, + egui_rpass.clone(), + egui_sdl2_state.dpi(), + Rgba::from_rgb(0.0, 0.0, 0.0), + &tris, + &full_output.textures_delta, + ) + } + + frame_timer.time_stop() + } +}