diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 9edbec02..c84daf69 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -12,11 +12,11 @@ jobs: steps: - uses: actions/stale@v5 with: - days-before-issue-stale: 60 - days-before-issue-close: 14 + days-before-issue-stale: 365 + days-before-issue-close: 30 stale-issue-label: "stale" - stale-issue-message: "This issue is stale because it has been open for 60 days with no activity." - close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale. Do not hesitate to open a new issue if you need it." + stale-issue-message: "This issue is stale because it has been open for 1 year with no activity." + close-issue-message: "This issue was closed because it has been inactive for 30 days since being marked as stale. Do not hesitate to open a new issue if you need it." days-before-pr-stale: -1 days-before-pr-close: -1 - repo-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d130233..323e2be6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,49 @@ # Changelog All notable changes to this project will be documented in this file. +## v0.10.0 +- Added `WindowConfig::set_position` to set x/y position before creating the window. +- Changed `Renderer.begin` uses `Option` instead of `Option<&ClearOption>`. +- Changed sizes and positions for Window and Textures from `i32` to `u32`. +- Added `AppTimer::elapsed` to return time since init as `Duration`. +- Changed `AppTimer::time_since_init` to `AppTimer::elapsed_f32`. +- Changed `WindowConfig` setter method to use the prefix `set_`. +- Removed deprecated `Mouse::local_position`. +- Removed deprecated `mat3_screen_to_local`, `mat3_local_to_screen`, `mat3_local_to_local`. +- Updated dependencies to latest versions. +- Enabled compilation with `--no-default-features` excluding shader compilation macros. +- Deserializing `AtlasFrame` uses a default `pivot` if is empty. +- Added `WindowConfig::set_window_icon_data`. +- Added `WindowConfig::set_taskbar_icon_data`. +- Added example `window_icon_from_raw.rs`. +- Changed `glsl_layout` dependency for `crevice`. +- Updated EGUI to `0.22`. +- Fixed `egui` panic when custom font are set. +- Fixed slow scroll speed. +- Fixed `egui needs_repaint` not working right in some situations. +- Fixed the order of the matrix multiplication for `Draw` methods. +- Improved error messages when `WebGL` and `WebGL2` contexts cannot be adquired. +- Fixed `Buffer` to allow reuse `Uniform Buffers` between pipelines. +- Changed some noisy logs from `debug` to `trace`. +- Added `Clone` to `Random`. +- Reset values of `Mouse::wheel_delta` when the user stops scrolling. +- Added `Mouse::is_scrolling`. +- App's state can use now lifetimes, ie: `State<'n>`. +- Added `Clone` to `AssetsList`. +- The `image` crate on `notan_graphics` is only used when `texture_to_file` is enabled. +- Added `WindowBackend::set_cursor_position`, `Event::MouseMotion` and `Mouse::is_moving`. +- Added new example `window_initial_position.rs`. +- Added mipmap and texture wrapping settings to `RenderTextureBuilder`. +- Added new example `texture_params`. +- Added new example `renderer_stencil`. +- Fixed mouse wheel scroll being ignored when moving the mouse at same time +- Added alt mouse wheel scrolling code to example +- Fixed `set_multisamples`. It is no longer being ignored for winit backend +- Fixed blurry text on egui when using on desktop +- Fixed mono channel audio playing in half of time set for the audio length. +- Added `is_focused()` for winit backend +- Added `window_focus` example + ## v0.9.5 - 19/03/2023 - Increased mouse wheel scroll speed on native platforms. diff --git a/Cargo.lock b/Cargo.lock index c8ba8879..7add8a31 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ab_glyph" -version = "0.2.19" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5568a4aa5ba8adf5175c5c460b030e27d8893412976cc37bef0e4fbc16cfbba" +checksum = "5110f1c78cf582855d895ecd0746b653db010cec6d9f5575293f27934d980a39" dependencies = [ "ab_glyph_rasterizer", "owned_ttf_parser", @@ -26,25 +26,40 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf6ccdb167abbf410dcb915cabd428929d7f6a04980b54a11f26a39f1c7f7107" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" dependencies = [ "cfg-if", "once_cell", "version_check", ] +[[package]] +name = "aho-corasick" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + [[package]] name = "alsa" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5915f52fe2cf65e83924d037b6c5290b7cee097c6b5c8700746e6168a343fd6b" +checksum = "e2562ad8dcf0f789f65c6fdaad8a8a9708ed6b488e649da28c01656ad66b8b47" dependencies = [ "alsa-sys", - "bitflags", + "bitflags 1.3.2", "libc", - "nix 0.23.2", + "nix 0.24.3", ] [[package]] @@ -57,6 +72,30 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "android-activity" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64529721f27c2314ced0890ce45e469574a73e5e6fdd6e9da1860eb29285f5e0" +dependencies = [ + "android-properties", + "bitflags 1.3.2", + "cc", + "jni-sys", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum 0.6.1", +] + +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + [[package]] name = "approx" version = "0.5.1" @@ -68,16 +107,15 @@ dependencies = [ [[package]] name = "arboard" -version = "3.2.0" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6041616acea41d67c4a984709ddab1587fd0b10efe5cc563fee954d2f011854" +checksum = "ac57f2b058a76363e357c056e4f74f1945bf734d37b8b3ef49066c4787dde0fc" dependencies = [ "clipboard-win", "log", "objc", "objc-foundation", "objc_id", - "once_cell", "parking_lot", "thiserror", "winapi", @@ -86,38 +124,21 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.5.2" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "atomic_refcell" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "857253367827bd9d0fd973f0ef15506a96e79e41b0ad7aa691203a4e3214f6c8" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] +checksum = "112ef6b3f6cb3cb6fc5b6b494ef7a848492cff1ab0ef4de10b0f7d572861c905" [[package]] name = "autocfg" @@ -125,19 +146,13 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" -[[package]] -name = "base-x" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" - [[package]] name = "bindgen" -version = "0.61.0" +version = "0.64.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a022e58a142a46fea340d68012b9201c094e93ec3d033a944a24f8fd4a4f09a" +checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cexpr", "clang-sys", "lazy_static", @@ -148,7 +163,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn", + "syn 1.0.109", ] [[package]] @@ -157,6 +172,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" + [[package]] name = "block" version = "0.1.6" @@ -173,11 +194,30 @@ dependencies = [ "byte-tools", ] +[[package]] +name = "block-sys" +version = "0.1.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" +dependencies = [ + "objc-sys", +] + +[[package]] +name = "block2" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" +dependencies = [ + "block-sys", + "objc2-encode", +] + [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byte-tools" @@ -187,22 +227,22 @@ checksum = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" [[package]] name = "bytemuck" -version = "1.13.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" +checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aca418a974d83d40a0c1f0c5cba6ff4bc28d8df099109ca459a2118d40b6322" +checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.31", ] [[package]] @@ -213,16 +253,17 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.3.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "calloop" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a59225be45a478d772ce015d9743e49e92798ece9e34eda9a6aa2a6a7f40192" +checksum = "52e0d00eb1ea24371a97d2da6201c6747a633dc6dc1988ef503403b4c59504a8" dependencies = [ + "bitflags 1.3.2", "log", "nix 0.25.1", "slotmap", @@ -232,11 +273,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.78" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "jobserver", + "libc", ] [[package]] @@ -277,13 +319,13 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.4.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" +checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" dependencies = [ "glob", "libc", - "libloading", + "libloading 0.7.4", ] [[package]] @@ -299,44 +341,13 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.49" +version = "0.1.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" +checksum = "a31c789563b815f77f4250caee12365734369f942439b7defd71e18a48197130" dependencies = [ "cc", ] -[[package]] -name = "cocoa" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" -dependencies = [ - "bitflags", - "block", - "cocoa-foundation", - "core-foundation", - "core-graphics", - "foreign-types 0.3.2", - "libc", - "objc", -] - -[[package]] -name = "cocoa-foundation" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" -dependencies = [ - "bitflags", - "block", - "core-foundation", - "core-graphics-types", - "foreign-types 0.3.2", - "libc", - "objc", -] - [[package]] name = "color_quant" version = "1.1.0" @@ -345,11 +356,11 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "colored" -version = "1.9.3" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" +checksum = "5a5f741c91823341bebf717d4c71bda820630ce065443b58bd1b7451af008355" dependencies = [ - "atty", + "is-terminal", "lazy_static", "winapi", ] @@ -376,9 +387,9 @@ dependencies = [ [[package]] name = "console_log" -version = "0.2.0" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" +checksum = "be8aed40e4edbf4d3b4431ab260b63fdc40f5780a4766824329ea0f1eefe3c0f" dependencies = [ "log", "web-sys", @@ -390,15 +401,21 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.4", "libc", ] [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" + +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "core-graphics" @@ -406,79 +423,67 @@ version = "0.22.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-graphics-types", - "foreign-types 0.3.2", + "foreign-types", "libc", ] [[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 0.3.2", - "libc", -] - -[[package]] -name = "core-text" -version = "19.2.0" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d74ada66e07c1cefa18f8abfba765b486f250de2e4a999e5727fc0dd4b4a25" +checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" dependencies = [ + "bitflags 1.3.2", "core-foundation", - "core-graphics", - "foreign-types 0.3.2", "libc", ] [[package]] name = "coreaudio-rs" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11894b20ebfe1ff903cbdc52259693389eea03b94918a2def2c30c3bf227ad88" +checksum = "cb17e2d1795b1996419648915df94bc7103c28f7b48062d7acf4652fc371b2ff" dependencies = [ - "bitflags", + "bitflags 1.3.2", + "core-foundation-sys 0.6.2", "coreaudio-sys", ] [[package]] name = "coreaudio-sys" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a9444b94b8024feecc29e01a9706c69c1e26bfee480221c90764200cfd778fb" +checksum = "f034b2258e6c4ade2f73bf87b21047567fb913ee9550837c2316d139b0262b24" dependencies = [ "bindgen", ] [[package]] name = "cpal" -version = "0.14.2" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f342c1b63e185e9953584ff2199726bf53850d96610a310e3aca09e9405a2d0b" +checksum = "6d959d90e938c5493000514b446987c07aed46c668faaa7d34d6c7a67b1a578c" dependencies = [ "alsa", - "core-foundation-sys", + "core-foundation-sys 0.8.4", "coreaudio-rs", + "dasp_sample", "jni 0.19.0", "js-sys", "libc", - "mach", - "ndk 0.7.0", + "mach2", + "ndk", "ndk-context", "oboe", "once_cell", "parking_lot", - "stdweb", - "thiserror", "wasm-bindgen", + "wasm-bindgen-futures", "web-sys", - "windows 0.37.0", + "windows", ] [[package]] @@ -490,11 +495,34 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crevice_notan" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb0b2bca5ce777a79dd787fafb8113f2be4f020e4c2468363b473041f2d9b90" +dependencies = [ + "bytemuck", + "crevice_notan-derive", + "glam", + "mint", +] + +[[package]] +name = "crevice_notan-derive" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c99d1aa96f6017828f2d26743f8d4fa3a80927a2a169b9c5c5871cfb3b51f30" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "crossbeam-channel" -version = "0.5.6" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if", "crossbeam-utils", @@ -502,9 +530,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -513,89 +541,37 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.13" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.7.1", + "memoffset 0.9.0", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] [[package]] -name = "crossfont" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21fd3add36ea31aba1520aa5288714dd63be506106753226d0eb387a93bc9c45" -dependencies = [ - "cocoa", - "core-foundation", - "core-foundation-sys", - "core-graphics", - "core-text", - "dwrote", - "foreign-types 0.5.0", - "freetype-rs", - "libc", - "log", - "objc", - "once_cell", - "pkg-config", - "servo-fontconfig", - "winapi", -] - -[[package]] -name = "cty" -version = "0.2.2" +name = "dasp_sample" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" [[package]] -name = "darling" -version = "0.13.4" +name = "deranged" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn", -] +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" [[package]] name = "digest" @@ -606,32 +582,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "dispatch" version = "0.2.0" @@ -640,11 +590,11 @@ checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" [[package]] name = "dlib" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794" +checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412" dependencies = [ - "libloading", + "libloading 0.8.0", ] [[package]] @@ -653,34 +603,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" -[[package]] -name = "dwrote" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439a1c2ba5611ad3ed731280541d36d2e9c4ac5e7fb818a27b604bdc5a6aa65b" -dependencies = [ - "lazy_static", - "libc", - "serde", - "serde_derive", - "winapi", - "wio", -] - [[package]] name = "ecolor" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b601108bca3af7650440ace4ca55b2daf52c36f2635be3587d77b16efd8d0691" +checksum = "2e479a7fa3f23d4e794f8b2f8b3568dd4e47886ad1b12c9c095e141cb591eb63" dependencies = [ "bytemuck", ] [[package]] name = "egui" -version = "0.20.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65a5e883a316e53866977450eecfbcac9c48109c2ab3394af29feb83fcde4ea9" +checksum = "a3aef8ec3ae1b772f340170c65bf27d5b8c28f543a0116c844d2ac08d01123e7" dependencies = [ "ahash", "epaint", @@ -689,22 +625,22 @@ dependencies = [ [[package]] name = "egui_demo_lib" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b191e5870e6cff885cf56d4e6c3a10ce0c66d9d855a92c1eaca96b0f1111c0aa" +checksum = "807f2eaee012c4f10d541db010845340fcdebf0b97b82b88a13e5ca1d6c84385" dependencies = [ "egui", "egui_extras", "enum-map", - "tracing", + "log", "unicode_names2", ] [[package]] name = "egui_extras" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1975cd88ff7430f93b29e6b9868b648a8ff6a43b08b9ff8474ee0a648bd8f9a6" +checksum = "9278f4337b526f0d57e5375e5a7340a311fa6ee8f9fcc75721ac50af13face02" dependencies = [ "egui", "serde", @@ -712,33 +648,33 @@ dependencies = [ [[package]] name = "either" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "emath" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5277249c8c3430e7127e4f2c40a77485e7baf11ae132ce9b3253a8ed710df0a0" +checksum = "3857d743a6e0741cdd60b622a74c7a36ea75f5f8f11b793b41d905d2c9721a4b" dependencies = [ "bytemuck", ] [[package]] name = "encoding_rs" -version = "0.8.31" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if", ] [[package]] name = "enum-map" -version = "2.4.2" +version = "2.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c25992259941eb7e57b936157961b217a4fc8597829ddef0596d6c3cd86e1a" +checksum = "4e10d4d903e79b6181943defcdc36f61f8f608e5892eca719fb0677799d3f8fe" dependencies = [ "enum-map-derive", "serde", @@ -746,20 +682,20 @@ dependencies = [ [[package]] name = "enum-map-derive" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a4da76b3b6116d758c7ba93f7ec6a35d2e2cf24feda76c6e38a375f4d5c59f2" +checksum = "ccb14d927583dd5c2eac0f2cf264fc4762aefe1ae14c47a8a20fc1939d3a5fc0" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.31", ] [[package]] name = "epaint" -version = "0.20.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de14b65fe5e423e0058f77a8beb2c863b056d0566d6c4ce0d097aa5814cb705a" +checksum = "09333964d4d57f40a85338ba3ca5ed4716070ab184dcfed966b35491c5c64f3b" dependencies = [ "ab_glyph", "ahash", @@ -771,6 +707,33 @@ dependencies = [ "parking_lot", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "error-code" version = "2.3.1" @@ -783,23 +746,13 @@ dependencies = [ [[package]] name = "euclid" -version = "0.22.7" +version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b52c2ef4a78da0ba68fbe1fd920627411096d2ac478f7f4c9f3a54ba6705bade" +checksum = "87f253bc5c813ca05792837a0ff4b3a580336b224512d48f7eda1d7dd9210787" dependencies = [ "num-traits", ] -[[package]] -name = "expat-sys" -version = "2.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa" -dependencies = [ - "cmake", - "pkg-config", -] - [[package]] name = "fake-simd" version = "0.1.2" @@ -808,18 +761,24 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fastrand" -version = "1.8.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" + +[[package]] +name = "fdeflate" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d329bdeac514ee06249dabc27877490f17f5d371ec693360768b838e19f3ae10" dependencies = [ - "instant", + "simd-adler32", ] [[package]] name = "fern" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd7b0849075e79ee9a1836df22c717d1eba30451796fdc631b04565dd11e2a" +checksum = "d9f0c14694cbd524c8720dd69b0e3179344f04ebb5f90f2e4a440c6ea3b2f1ee" dependencies = [ "colored", "log", @@ -827,9 +786,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide", @@ -844,40 +803,13 @@ dependencies = [ "num-traits", ] -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - [[package]] name = "foreign-types" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" dependencies = [ - "foreign-types-shared 0.1.1", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared 0.3.1", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8469d0d40519bc608ec6863f1cc88f3f1deee15913f2f3b3e573d81ed38cccc" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "foreign-types-shared", ] [[package]] @@ -886,48 +818,20 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] -[[package]] -name = "freetype-rs" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74eadec9d0a5c28c54bb9882e54787275152a4e36ce206b45d7451384e5bf5fb" -dependencies = [ - "bitflags", - "freetype-sys", - "libc", -] - -[[package]] -name = "freetype-sys" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a37d4011c0cc628dfa766fcc195454f4b068d7afdc2adfd28861191d866e731a" -dependencies = [ - "cmake", - "libc", - "pkg-config", -] - [[package]] name = "futures" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" dependencies = [ "futures-channel", "futures-core", @@ -940,9 +844,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", "futures-sink", @@ -950,15 +854,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ "futures-core", "futures-task", @@ -967,38 +871,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.31", ] [[package]] name = "futures-sink" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-channel", "futures-core", @@ -1033,9 +937,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "js-sys", @@ -1057,11 +961,12 @@ dependencies = [ [[package]] name = "glam" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f597d56c1bd55a811a1be189459e8fad2bbc272616375602443bdfb37fa774" +checksum = "42218cb640844e3872cc3c153dc975229e080a6c4733b34709ef445610550226" dependencies = [ "bytemuck", + "mint", "serde", ] @@ -1073,9 +978,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "glow" -version = "0.11.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919" +checksum = "ca0fe580e4b60a8ab24a868bc08e2f03cbcb20d3d676601fa909386713333728" dependencies = [ "js-sys", "slotmap", @@ -1083,27 +988,6 @@ dependencies = [ "web-sys", ] -[[package]] -name = "glsl-layout" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a4206fa405b25ca1b607f4db6cfdeeebec5513458d65abe21fc246ee89ac295" -dependencies = [ - "glam", - "glsl-layout-derive", -] - -[[package]] -name = "glsl-layout-derive" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b870f33b0cec52fd0347c09722c2f9a85e9a4e9aa5c0453e75dedc12bde7ddb8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "glsl-to-spirv" version = "0.1.7" @@ -1117,54 +1001,54 @@ dependencies = [ [[package]] name = "glutin" -version = "0.30.3" +version = "0.30.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524d807cd49a0c56a53ef9a6738cd15e7c8c4e9d37a3b7fdb3c250c1cd5bf7a3" +checksum = "8fc93b03242719b8ad39fb26ed2b01737144ce7bd4bfc7adadcef806596760fe" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg_aliases", "cgl", - "cocoa", "core-foundation", + "dispatch", "glutin_egl_sys", "glutin_glx_sys", "glutin_wgl_sys", - "libloading", - "objc", + "libloading 0.7.4", + "objc2", "once_cell", - "raw-window-handle 0.5.0", + "raw-window-handle", "wayland-sys 0.30.1", - "windows-sys 0.36.1", + "windows-sys 0.45.0", "x11-dl", ] [[package]] name = "glutin-winit" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e44949d3a525ad1deae282fc9e7dbf05ddcce98219079c5aea7d9aa6927920c6" +checksum = "629a873fc04062830bfe8f97c03773bcd7b371e23bcc465d0a61448cd1588fa4" dependencies = [ "cfg_aliases", "glutin", - "raw-window-handle 0.5.0", + "raw-window-handle", "winit", ] [[package]] name = "glutin_egl_sys" -version = "0.3.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3adbb8fec0e18e340f990c78f79f5f0e142d0d83f46b10909aaa7d251c00afdf" +checksum = "af784eb26c5a68ec85391268e074f0aa618c096eadb5d6330b0911cf34fe57c5" dependencies = [ "gl_generator", - "windows-sys 0.36.1", + "windows-sys 0.45.0", ] [[package]] name = "glutin_glx_sys" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "947c4850c58211c9627969c2b4e2674764b81ae5b47bab2c9a477d7942f96e0f" +checksum = "1b53cb5fe568964aa066a3ba91eac5ecbac869fb0842cd0dc9e412434f1a1494" dependencies = [ "gl_generator", "x11-dl", @@ -1172,22 +1056,21 @@ dependencies = [ [[package]] name = "glutin_wgl_sys" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20c33975a6c9d49d72c8f032a60079bf8df536954fbf9e4cee90396ace815c57" +checksum = "ef89398e90033fc6bc65e9bd42fd29bbbfd483bda5b56dc5562f455550618165" dependencies = [ "gl_generator", ] [[package]] name = "glyph_brush" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac02497410cdb5062cc056a33f2e1e19ff69fbf26a4be9a02bf29d6e17ea105b" +checksum = "4edefd123f28a0b1d41ec4a489c2b43020b369180800977801611084f342978d" dependencies = [ "glyph_brush_draw_cache", "glyph_brush_layout", - "log", "ordered-float", "rustc-hash", "twox-hash", @@ -1226,43 +1109,35 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.13.2" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" dependencies = [ "ahash", + "allocator-api2", "serde", ] [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] -name = "hermit-abi" -version = "0.2.6" +name = "home" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "libc", + "windows-sys 0.48.0", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1270,9 +1145,9 @@ dependencies = [ [[package]] name = "image" -version = "0.24.5" +version = "0.24.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69b7ea949b537b0fd0af141fff8c77690f2ce96f4f41f042ccb6c69c6c965945" +checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" dependencies = [ "bytemuck", "byteorder", @@ -1285,14 +1160,24 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + [[package]] name = "instant" version = "0.1.12" @@ -1305,11 +1190,22 @@ dependencies = [ "web-sys", ] +[[package]] +name = "is-terminal" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +dependencies = [ + "hermit-abi", + "rustix", + "windows-sys 0.48.0", +] + [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jni" @@ -1339,6 +1235,22 @@ dependencies = [ "walkdir", ] +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", + "windows-sys 0.45.0", +] + [[package]] name = "jni-sys" version = "0.3.0" @@ -1347,9 +1259,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" dependencies = [ "libc", ] @@ -1362,9 +1274,9 @@ checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1389,9 +1301,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.139" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libloading" @@ -1403,11 +1315,21 @@ dependencies = [ "winapi", ] +[[package]] +name = "libloading" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + [[package]] name = "libm" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "linked-hash-map" @@ -1415,11 +1337,17 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linux-raw-sys" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a9bad9f94746442c783ca431b22403b519cd7fbeed0533fdd6328b2f2212128" + [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -1427,12 +1355,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "lyon" @@ -1446,9 +1371,9 @@ dependencies = [ [[package]] name = "lyon_algorithms" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb7a1845c15729d73d25d42cb650b647f73c3494453a5c3cd3aae0df3ac5c6c" +checksum = "00a0349cd8f0270781bb93a824b63df6178e3b4a27794e7be3ce3763f5a44d6e" dependencies = [ "lyon_path", "num-traits", @@ -1460,16 +1385,16 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "74df1ff0a0147282eb10699537a03baa7d31972b58984a1d44ce0624043fe8ad" dependencies = [ - "arrayvec 0.7.2", + "arrayvec", "euclid", "num-traits", ] [[package]] name = "lyon_path" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8358c012e5651e4619cfd0b5b75c0f77866181a01b0909aab4bae14adf660" +checksum = "ca507745ba7ccbc76e5c44e7b63b1a29d2b0d6126f375806a5bbaf657c7d6c45" dependencies = [ "lyon_geom", "num-traits", @@ -1477,9 +1402,9 @@ dependencies = [ [[package]] name = "lyon_tessellation" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e48a1d4a9cef1075ebe0afbf16521db6c7942e6563c136fb15676dafc5135d7" +checksum = "7d2124218d5428149f9e09520b9acc024334a607e671f032d06567b61008977c" dependencies = [ "float_next_after", "lyon_path", @@ -1487,10 +1412,10 @@ dependencies = [ ] [[package]] -name = "mach" -version = "0.3.2" +name = "mach2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" dependencies = [ "libc", ] @@ -1506,15 +1431,15 @@ dependencies = [ [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" [[package]] name = "memmap2" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" dependencies = [ "libc", ] @@ -1530,18 +1455,18 @@ dependencies = [ [[package]] name = "memoffset" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" @@ -1561,11 +1486,12 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", + "simd-adler32", ] [[package]] @@ -1576,27 +1502,14 @@ checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff" [[package]] name = "mio" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", "log", "wasi", - "windows-sys 0.42.0", -] - -[[package]] -name = "ndk" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" -dependencies = [ - "bitflags", - "jni-sys", - "ndk-sys 0.3.0", - "num_enum", - "thiserror", + "windows-sys 0.48.0", ] [[package]] @@ -1605,11 +1518,11 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "jni-sys", - "ndk-sys 0.4.1+23.1.7779620", - "num_enum", - "raw-window-handle 0.5.0", + "ndk-sys", + "num_enum 0.5.11", + "raw-window-handle", "thiserror", ] @@ -1619,44 +1532,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" -[[package]] -name = "ndk-glue" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" -dependencies = [ - "libc", - "log", - "ndk 0.7.0", - "ndk-context", - "ndk-macro", - "ndk-sys 0.4.1+23.1.7779620", - "once_cell", - "parking_lot", -] - -[[package]] -name = "ndk-macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" -dependencies = [ - "darling", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "ndk-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" -dependencies = [ - "jni-sys", -] - [[package]] name = "ndk-sys" version = "0.4.1+23.1.7779620" @@ -1666,26 +1541,13 @@ dependencies = [ "jni-sys", ] -[[package]] -name = "nix" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" -dependencies = [ - "bitflags", - "cc", - "cfg-if", - "libc", - "memoffset 0.6.5", -] - [[package]] name = "nix" version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.6.5", @@ -1698,7 +1560,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f346ff70e7dbfd675fe90590b92d59ef2de15a8779ae305ebcbfd3f0caf59be4" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", "cfg-if", "libc", "memoffset 0.6.5", @@ -1722,7 +1584,7 @@ dependencies = [ [[package]] name = "notan" -version = "0.9.5" +version = "0.10.0" dependencies = [ "bytemuck", "egui_demo_lib", @@ -1746,14 +1608,14 @@ dependencies = [ [[package]] name = "notan_app" -version = "0.9.5" +version = "0.10.0" dependencies = [ "bytemuck", "downcast-rs", "futures", "futures-util", - "hashbrown 0.13.2", - "indexmap", + "hashbrown 0.14.0", + "indexmap 1.9.3", "js-sys", "log", "notan_audio", @@ -1772,14 +1634,14 @@ dependencies = [ [[package]] name = "notan_audio" -version = "0.9.5" +version = "0.10.0" dependencies = [ "parking_lot", ] [[package]] name = "notan_backend" -version = "0.9.5" +version = "0.10.0" dependencies = [ "notan_web", "notan_winit", @@ -1787,7 +1649,7 @@ dependencies = [ [[package]] name = "notan_core" -version = "0.9.5" +version = "0.10.0" dependencies = [ "serde", "web-sys", @@ -1795,7 +1657,7 @@ dependencies = [ [[package]] name = "notan_draw" -version = "0.9.5" +version = "0.10.0" dependencies = [ "log", "lyon", @@ -1811,7 +1673,7 @@ dependencies = [ [[package]] name = "notan_egui" -version = "0.9.5" +version = "0.10.0" dependencies = [ "bytemuck", "egui", @@ -1823,7 +1685,7 @@ dependencies = [ [[package]] name = "notan_extra" -version = "0.9.5" +version = "0.10.0" dependencies = [ "notan_app", "spin_sleep", @@ -1831,11 +1693,11 @@ dependencies = [ [[package]] name = "notan_glow" -version = "0.9.5" +version = "0.10.0" dependencies = [ "bytemuck", "glow", - "hashbrown 0.13.2", + "hashbrown 0.14.0", "image", "js-sys", "log", @@ -1846,22 +1708,23 @@ dependencies = [ [[package]] name = "notan_glyph" -version = "0.9.5" +version = "0.10.0" dependencies = [ "bytemuck", "glyph_brush", "log", "notan_app", "notan_graphics", + "notan_macro", "notan_math", ] [[package]] name = "notan_graphics" -version = "0.9.5" +version = "0.10.0" dependencies = [ "bytemuck", - "glsl-layout", + "crevice_notan", "image", "notan_macro", "notan_math", @@ -1871,9 +1734,9 @@ dependencies = [ [[package]] name = "notan_input" -version = "0.9.5" +version = "0.10.0" dependencies = [ - "hashbrown 0.13.2", + "hashbrown 0.14.0", "log", "notan_core", "notan_math", @@ -1882,7 +1745,7 @@ dependencies = [ [[package]] name = "notan_log" -version = "0.9.5" +version = "0.10.0" dependencies = [ "console_log", "fern", @@ -1895,7 +1758,7 @@ dependencies = [ [[package]] name = "notan_macro" -version = "0.9.5" +version = "0.10.0" dependencies = [ "cfg_aliases", "glsl-to-spirv", @@ -1904,12 +1767,12 @@ dependencies = [ "quote", "shaderc", "spirv_cross", - "syn", + "syn 2.0.31", ] [[package]] name = "notan_math" -version = "0.9.5" +version = "0.10.0" dependencies = [ "glam", "serde", @@ -1917,10 +1780,10 @@ dependencies = [ [[package]] name = "notan_oddio" -version = "0.9.5" +version = "0.10.0" dependencies = [ "cpal", - "hashbrown 0.13.2", + "hashbrown 0.14.0", "log", "notan_audio", "oddio", @@ -1929,7 +1792,7 @@ dependencies = [ [[package]] name = "notan_random" -version = "0.9.5" +version = "0.10.0" dependencies = [ "getrandom", "rand", @@ -1938,9 +1801,9 @@ dependencies = [ [[package]] name = "notan_text" -version = "0.9.5" +version = "0.10.0" dependencies = [ - "hashbrown 0.13.2", + "hashbrown 0.14.0", "lazy_static", "log", "notan_app", @@ -1952,7 +1815,7 @@ dependencies = [ [[package]] name = "notan_utils" -version = "0.9.5" +version = "0.10.0" dependencies = [ "instant", "js-sys", @@ -1964,7 +1827,7 @@ dependencies = [ [[package]] name = "notan_web" -version = "0.9.5" +version = "0.10.0" dependencies = [ "console_error_panic_hook", "futures-util", @@ -1983,7 +1846,7 @@ dependencies = [ [[package]] name = "notan_winit" -version = "0.9.5" +version = "0.10.0" dependencies = [ "arboard", "glutin", @@ -1997,16 +1860,16 @@ dependencies = [ "notan_glow", "notan_input", "notan_oddio", - "raw-window-handle 0.5.0", + "raw-window-handle", "webbrowser", "winit", ] [[package]] name = "num" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" dependencies = [ "num-bigint", "num-complex", @@ -2018,9 +1881,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" dependencies = [ "autocfg", "num-integer", @@ -2029,9 +1892,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" dependencies = [ "num-traits", ] @@ -2044,7 +1907,7 @@ checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2081,44 +1944,65 @@ dependencies = [ ] [[package]] -name = "num-traits" -version = "0.2.15" +name = "num-traits" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" dependencies = [ - "autocfg", - "libm", + "num_enum_derive 0.5.11", ] [[package]] -name = "num_cpus" -version = "1.15.0" +name = "num_enum" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" dependencies = [ - "hermit-abi 0.2.6", - "libc", + "num_enum_derive 0.6.1", ] [[package]] -name = "num_enum" -version = "0.5.7" +name = "num_enum_derive" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9" +checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" dependencies = [ - "num_enum_derive", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", ] [[package]] name = "num_enum_derive" -version = "0.5.7" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 2.0.31", ] [[package]] @@ -2150,6 +2034,32 @@ dependencies = [ "objc_id", ] +[[package]] +name = "objc-sys" +version = "0.2.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" + +[[package]] +name = "objc2" +version = "0.3.0-beta.3.patch-leaks.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" +dependencies = [ + "block2", + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2-encode" +version = "2.0.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" +dependencies = [ + "objc-sys", +] + [[package]] name = "objc_id" version = "0.1.1" @@ -2161,12 +2071,12 @@ dependencies = [ [[package]] name = "oboe" -version = "0.4.6" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f63c358b4fa0fbcfefd7c8be5cfc39c08ce2389f5325687e7762a48d30a5c1" +checksum = "8868cc237ee02e2d9618539a23a8d228b9bb3fc2e7a5b11eed3831de77c395d0" dependencies = [ - "jni 0.19.0", - "ndk 0.6.0", + "jni 0.20.0", + "ndk", "ndk-context", "num-derive", "num-traits", @@ -2175,9 +2085,9 @@ dependencies = [ [[package]] name = "oboe-sys" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3370abb7372ed744232c12954d920d1a40f1c4686de9e79e800021ef492294bd" +checksum = "7f44155e7fb718d3cfddcf70690b2b51ac4412f347cd9e4fbe511abe9cd7b5f2" dependencies = [ "cc", ] @@ -2193,24 +2103,33 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" + +[[package]] +name = "orbclient" +version = "0.3.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8378ac0dfbd4e7895f2d2c1f1345cab3836910baf3a300b000d04250f0c8428f" +dependencies = [ + "redox_syscall", +] [[package]] name = "ordered-float" -version = "3.4.0" +version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d84eb1409416d254e4a9c8fa56cc24701755025b458f0fcd8e59e1f5f40c23bf" +checksum = "2a54938017eacd63036332b4ae5c8a49fc8c0c1d6d629893057e4f13609edd06" dependencies = [ "num-traits", ] [[package]] name = "owned_ttf_parser" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a5f3c7ca08b6879e7965fb25e24d1f5eeb32ea73f9ad99b3854778a38c57e93" +checksum = "706de7e2214113d63a8238d1910463cfce781129a6f263d13fdb09ff64355ba4" dependencies = [ "ttf-parser", ] @@ -2227,15 +2146,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.6" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba1ef8814b5c993410bb3adfad7a5ed269563e4a2f90c41f5d85be7fb47133bf" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys 0.42.0", + "windows-targets 0.48.5", ] [[package]] @@ -2246,15 +2165,15 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -2264,9 +2183,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "platter2" @@ -2282,12 +2201,13 @@ dependencies = [ [[package]] name = "png" -version = "0.17.7" +version = "0.17.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d708eaf860a19b19ce538740d2b4bdeeb8337fa53f7738455e706623ad5c638" +checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crc32fast", + "fdeflate", "flate2", "miniz_oxide", ] @@ -2300,29 +2220,28 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro-crate" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eda0fc3b0fb7c975631757e14d9049da17374063edb6ebbcbc54d880d4fe94e9" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "thiserror", - "toml", + "toml_edit", ] [[package]] name = "proc-macro2" -version = "1.0.50" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -2368,27 +2287,15 @@ dependencies = [ [[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 = "raw-window-handle" -version = "0.5.0" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed7e3d950b66e19e0c372f3fa3fbbcf85b1746b571f74e0c2af6042a5c93420a" -dependencies = [ - "cty", -] +checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" [[package]] name = "rayon" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" dependencies = [ "either", "rayon-core", @@ -2396,9 +2303,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.10.2" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -2408,47 +2315,41 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.16" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] -name = "redox_users" -version = "0.4.3" +name = "regex" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "697061221ea1b4a94a624f67d0ae2bfe4e22b8a17b6a192afb11046542cc8c47" dependencies = [ - "getrandom", - "redox_syscall", - "thiserror", + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", ] [[package]] -name = "regex" -version = "1.7.1" +name = "regex-automata" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "c2f401f4955220693b56f8ec66ee9c78abffd8d1c4f23dc41a23839eb88f0795" dependencies = [ + "aho-corasick", + "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "roxmltree" @@ -2466,28 +2367,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] -name = "rustc_version" -version = "0.2.3" +name = "rustix" +version = "0.38.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +checksum = "d7db8590df6dfcd144d22afd1b83b36c21a18d7cbc1dc4bb5295a8712e9eb662" dependencies = [ - "semver", + "bitflags 2.4.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.48.0", ] [[package]] name = "ryu" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" - -[[package]] -name = "safe_arch" -version = "0.5.2" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ff3d6d9696af502cc3110dacce942840fb06ff4514cad92236ecc455f2ce05" -dependencies = [ - "bytemuck", -] +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -2506,104 +2402,54 @@ checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sctk-adwaita" -version = "0.4.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61270629cc6b4d77ec1907db1033d5c2e1a404c412743621981a871dc9c12339" +checksum = "cda4e97be1fd174ccc2aae81c8b694e803fa99b34e8fd0f057a9d70698e3ed09" dependencies = [ - "crossfont", + "ab_glyph", "log", + "memmap2", "smithay-client-toolkit", "tiny-skia", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" -version = "1.0.152" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.31", ] [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "2cc66a619ed80bf7a0f6b17dd063a84b88f6dea1813737cf469aef1d081142c2" dependencies = [ "itoa", "ryu", "serde", ] -[[package]] -name = "servo-fontconfig" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7e3e22fe5fd73d04ebf0daa049d3efe3eae55369ce38ab16d07ddd9ac5c217c" -dependencies = [ - "libc", - "servo-fontconfig-sys", -] - -[[package]] -name = "servo-fontconfig-sys" -version = "5.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36b879db9892dfa40f95da1c38a835d41634b825fbd8c4c418093d53c24b388" -dependencies = [ - "expat-sys", - "freetype-sys", - "pkg-config", -] - -[[package]] -name = "sha1" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" -dependencies = [ - "sha1_smol", -] - -[[package]] -name = "sha1_smol" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" - [[package]] name = "sha2" version = "0.7.1" @@ -2639,15 +2485,21 @@ dependencies = [ [[package]] name = "shlex" -version = "1.1.0" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" + +[[package]] +name = "simd-adler32" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] name = "slab" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -2663,9 +2515,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "smithay-client-toolkit" @@ -2673,7 +2525,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" dependencies = [ - "bitflags", + "bitflags 1.3.2", "calloop", "dlib", "lazy_static", @@ -2713,55 +2565,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - [[package]] name = "str-buf" version = "1.0.6" @@ -2769,16 +2572,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" [[package]] -name = "strsim" -version = "0.10.0" +name = "strict-num" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" [[package]] name = "symphonia" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3671dd6f64f4f9d5c87179525054cfc1f60de23ba1f193bd6ceab812737403f1" +checksum = "62e48dba70095f265fdb269b99619b95d04c89e619538138383e63310b14d941" dependencies = [ "lazy_static", "symphonia-bundle-flac", @@ -2795,9 +2598,9 @@ dependencies = [ [[package]] name = "symphonia-bundle-flac" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dc2deed3204967871ba60f913378f95820cb47a2fe9b2eef5a9eedb417dfdc8" +checksum = "7f23b0482a7cb18fcdf9981ab0b78df800ef0080187d294650023c462439058d" dependencies = [ "log", "symphonia-core", @@ -2807,11 +2610,11 @@ dependencies = [ [[package]] name = "symphonia-bundle-mp3" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55a0846e7a2c9a8081ff799fc83a975170417ad2a143f644a77ec2e3e82a2b73" +checksum = "0f31d7fece546f1e6973011a9eceae948133bbd18fd3d52f6073b1e38ae6368a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "lazy_static", "log", "symphonia-core", @@ -2820,9 +2623,9 @@ dependencies = [ [[package]] name = "symphonia-codec-adpcm" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a5cfb8d4405e26eb9593157dc45b05e102b8d774b38ed2a95946d6bb9e26e3e" +checksum = "870e7dc1865d818c7b6318879d060553a73a3b2a3b8443dff90910f10ac41150" dependencies = [ "log", "symphonia-core", @@ -2830,9 +2633,9 @@ dependencies = [ [[package]] name = "symphonia-codec-pcm" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb9a9f0b9991cccf3217b74644af412d5d082a4815e5e2943f26e0ecabdf3c9" +checksum = "47f1fbd220a06a641c8ce2ddad10f5ef6ee5cc0c54d9044d25d43b0d3119deaa" dependencies = [ "log", "symphonia-core", @@ -2840,9 +2643,9 @@ dependencies = [ [[package]] name = "symphonia-codec-vorbis" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfed6f7b6bfa21d7cef1acefc8eae5db80df1608a1aca91871b07cbd28d7b74" +checksum = "3953397e3506aa01350c4205817e4f95b58d476877a42f0458d07b665749e203" dependencies = [ "log", "symphonia-core", @@ -2851,12 +2654,12 @@ dependencies = [ [[package]] name = "symphonia-core" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b9567e2d8a5f866b2f94f5d366d811e0c6826babcff6d37de9e1a6690d38869" +checksum = "f7c73eb88fee79705268cc7b742c7bc93a7b76e092ab751d0833866970754142" dependencies = [ - "arrayvec 0.7.2", - "bitflags", + "arrayvec", + "bitflags 1.3.2", "bytemuck", "lazy_static", "log", @@ -2864,9 +2667,9 @@ dependencies = [ [[package]] name = "symphonia-format-mkv" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bd22f2def8c8f078495ad66111648bfc7d5222ee33774f2077cb665588f3119" +checksum = "f5c61dfc851ad25d4043d8c231d8617e8f7cd02a6cc0edad21ade21848d58895" dependencies = [ "lazy_static", "log", @@ -2877,9 +2680,9 @@ dependencies = [ [[package]] name = "symphonia-format-ogg" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "474df6e86b871dcb56913130bada1440245f483057c4a2d8a2981455494c4439" +checksum = "9bf1a00ccd11452d44048a0368828040f778ae650418dbd9d8765b7ee2574c8d" dependencies = [ "log", "symphonia-core", @@ -2889,9 +2692,9 @@ dependencies = [ [[package]] name = "symphonia-format-wav" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06679bd5646b3037300f88891dfc8a6e1cc4e1133206cc17a98e5d7c22f88296" +checksum = "da76614728fa27c003bdcdfbac51396bd8fcbf94c95fe8e62f1d2bac58ef03a4" dependencies = [ "log", "symphonia-core", @@ -2900,9 +2703,9 @@ dependencies = [ [[package]] name = "symphonia-metadata" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acd35c263223ef6161000be79b124a75de3e065eea563bf3ef169b3e94c7bb2e" +checksum = "89c3e1937e31d0e068bbe829f66b2f2bfaa28d056365279e0ef897172c3320c0" dependencies = [ "encoding_rs", "lazy_static", @@ -2912,9 +2715,9 @@ dependencies = [ [[package]] name = "symphonia-utils-xiph" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce340a6c33ac06cb42de01220308ec056e8a2a3d5cc664aaf34567392557136b" +checksum = "a450ca645b80d69aff8b35576cbfdc7f20940b29998202aab910045714c951f8" dependencies = [ "symphonia-core", "symphonia-metadata", @@ -2922,9 +2725,20 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.107" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" dependencies = [ "proc-macro2", "quote", @@ -2933,44 +2747,44 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.3.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", "fastrand", - "libc", "redox_syscall", - "remove_dir_all", - "winapi", + "rustix", + "windows-sys 0.48.0", ] [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.31", ] [[package]] name = "time" -version = "0.3.17" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" dependencies = [ + "deranged", "itoa", "libc", "num_threads", @@ -2981,42 +2795,42 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.6" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" dependencies = [ "time-core", ] [[package]] name = "tiny-skia" -version = "0.7.0" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642680569bb895b16e4b9d181c60be1ed136fa0c9c7f11d004daf053ba89bf82" +checksum = "df8493a203431061e901613751931f047d1971337153f96d0e5e363d6dbf6a67" dependencies = [ "arrayref", - "arrayvec 0.5.2", + "arrayvec", "bytemuck", "cfg-if", "png", - "safe_arch", "tiny-skia-path", ] [[package]] name = "tiny-skia-path" -version = "0.7.0" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c114d32f0c2ee43d585367cb013dfaba967ab9f62b90d9af0d696e955e70fa6c" +checksum = "adbfb5d3f3dd57a0e11d12f4f13d4ebbbc1b5c15b7ab0a156d030b21da5f677c" dependencies = [ "arrayref", "bytemuck", + "strict-num", ] [[package]] @@ -3030,44 +2844,32 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" - -[[package]] -name = "toml" -version = "0.5.11" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] -name = "tracing" -version = "0.1.37" +name = "toml_datetime" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-core", -] +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] -name = "tracing-core" -version = "0.1.30" +name = "toml_edit" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "once_cell", + "indexmap 2.0.0", + "toml_datetime", + "winnow", ] [[package]] name = "ttf-parser" -version = "0.18.1" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0609f771ad9c6155384897e1df4d948e692667cc0588548b68eb44d052b27633" +checksum = "a464a4b34948a5f67fddd2b823c62d9d92e44be75058b99939eae6c5b6960b33" [[package]] name = "twox-hash" @@ -3088,24 +2890,24 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "unicase" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" dependencies = [ "version_check", ] [[package]] name = "unicode-bidi" -version = "0.3.10" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -3124,9 +2926,9 @@ checksum = "446c96c6dd42604779487f0a981060717156648c1706aa1f464677f03c6cc059" [[package]] name = "url" -version = "2.3.1" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -3147,12 +2949,11 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", - "winapi", "winapi-util", ] @@ -3164,9 +2965,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3174,24 +2975,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.31", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -3201,9 +3002,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3211,22 +3012,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.31", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wayland-client" @@ -3234,7 +3035,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f3b068c05a039c9f755f881dc50f01732214f5685e379829759088967c46715" dependencies = [ - "bitflags", + "bitflags 1.3.2", "downcast-rs", "libc", "nix 0.24.3", @@ -3273,7 +3074,7 @@ version = "0.29.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b950621f9354b322ee817a23474e479b34be96c2e909c14f7bc0100e9a970bc6" dependencies = [ - "bitflags", + "bitflags 1.3.2", "wayland-client", "wayland-commons", "wayland-scanner", @@ -3315,9 +3116,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -3325,20 +3126,19 @@ dependencies = [ [[package]] name = "webbrowser" -version = "0.8.4" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e74f5ff7786c4c21f61ba8e30ea29c9745f06fca0a4a02d083b3c662583399e8" +checksum = "b2c79b77f525a2d670cb40619d7d9c673d09e0666f72c591ebd7861f84a87e57" dependencies = [ "core-foundation", - "dirs", - "jni 0.20.0", + "home", + "jni 0.21.1", "log", "ndk-context", "objc", - "raw-window-handle 0.5.0", + "raw-window-handle", "url", "web-sys", - "windows 0.43.0", ] [[package]] @@ -3383,170 +3183,154 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.37.0" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647" +checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" dependencies = [ - "windows_aarch64_msvc 0.37.0", - "windows_i686_gnu 0.37.0", - "windows_i686_msvc 0.37.0", - "windows_x86_64_gnu 0.37.0", - "windows_x86_64_msvc 0.37.0", + "windows-targets 0.42.2", ] [[package]] -name = "windows" -version = "0.43.0" +name = "windows-sys" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows-targets 0.42.2", ] [[package]] name = "windows-sys" -version = "0.36.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", + "windows-targets 0.48.5", ] [[package]] -name = "windows-sys" -version = "0.42.0" +name = "windows-targets" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.1" +name = "windows-targets" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] [[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" +name = "windows_aarch64_gnullvm" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] -name = "windows_aarch64_msvc" -version = "0.37.0" +name = "windows_aarch64_gnullvm" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] -name = "windows_i686_gnu" -version = "0.36.1" +name = "windows_aarch64_msvc" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.37.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[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.36.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.37.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.36.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.37.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" +name = "windows_x86_64_gnullvm" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.37.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winit" -version = "0.27.5" +version = "0.28.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb796d6fbd86b2fd896c9471e6f04d39d750076ebe5680a3958f00f5ab97657c" +checksum = "866db3f712fffba75d31bf0cdecf357c8aeafd158c5b7ab51dba2a2b2d47f196" dependencies = [ - "bitflags", - "cocoa", + "android-activity", + "bitflags 1.3.2", + "cfg_aliases", "core-foundation", "core-graphics", "dispatch", @@ -3554,31 +3338,32 @@ dependencies = [ "libc", "log", "mio", - "ndk 0.7.0", - "ndk-glue", - "objc", + "ndk", + "objc2", "once_cell", - "parking_lot", + "orbclient", "percent-encoding", - "raw-window-handle 0.4.3", - "raw-window-handle 0.5.0", + "raw-window-handle", + "redox_syscall", "sctk-adwaita", "smithay-client-toolkit", "wasm-bindgen", "wayland-client", + "wayland-commons", "wayland-protocols", + "wayland-scanner", "web-sys", - "windows-sys 0.36.1", + "windows-sys 0.45.0", "x11-dl", ] [[package]] -name = "wio" -version = "0.2.2" +name = "winnow" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d129932f4644ac2396cb456385cbf9e63b5b30c6e8dc4820bdca4eb082037a5" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" dependencies = [ - "winapi", + "memchr", ] [[package]] @@ -3631,9 +3416,9 @@ checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a" [[package]] name = "xml-rs" -version = "0.8.4" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" +checksum = "bab77e97b50aee93da431f2cee7cd0f43b4d1da3c408042f2d7d164187774f0a" [[package]] name = "xmlparser" diff --git a/Cargo.toml b/Cargo.toml index 0eb34e2e..7511196b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" categories = ["graphics", "rendering", "wasm", "gui", "multimedia"] @@ -18,27 +18,63 @@ features = ["default", "glyph", "egui", "text", "extra", "audio", "links", "drop [profile.release] lto = true -[dependencies] -notan_core = { path = "crates/notan_core", version = "0.9.5" } -notan_input = { path = "crates/notan_input", version = "0.9.5" } -notan_app = { path = "crates/notan_app", version = "0.9.5" } -notan_macro = { path = "crates/notan_macro", version = "0.9.5" } -notan_math = { path = "crates/notan_math", version = "0.9.5" } -notan_graphics = { path = "crates/notan_graphics", version = "0.9.5" } -notan_utils = { path = "crates/notan_utils", version = "0.9.5" } -notan_log = { path = "crates/notan_log", version = "0.9.5", optional = true } -notan_glyph = { path = "crates/notan_glyph", version = "0.9.5", optional = true } -notan_draw = { path = "crates/notan_draw", version = "0.9.5", optional = true } -notan_backend = { path = "crates/notan_backend", version = "0.9.5", optional = true } -notan_egui = { path = "crates/notan_egui", version = "0.9.5", optional = true } -notan_text = { path = "crates/notan_text", version = "0.9.5", optional = true } -notan_audio = { path = "crates/notan_audio", version = "0.9.5", optional = true } -notan_extra = { path = "crates/notan_extra", version = "0.9.5", optional = true } -notan_random = { path = "crates/notan_random", version = "0.9.5", optional = true } - [workspace] members = ["crates/*"] +[workspace.dependencies] +notan_core = { path = "crates/notan_core", version = "0.10.0" } +notan_input = { path = "crates/notan_input", version = "0.10.0" } +notan_app = { path = "crates/notan_app", version = "0.10.0" } +notan_macro = { path = "crates/notan_macro", version = "0.10.0" } +notan_math = { path = "crates/notan_math", version = "0.10.0" } +notan_graphics = { path = "crates/notan_graphics", version = "0.10.0" } +notan_utils = { path = "crates/notan_utils", version = "0.10.0" } +notan_log = { path = "crates/notan_log", version = "0.10.0" } +notan_glyph = { path = "crates/notan_glyph", version = "0.10.0" } +notan_draw = { path = "crates/notan_draw", version = "0.10.0" } +notan_backend = { path = "crates/notan_backend", version = "0.10.0" } +notan_egui = { path = "crates/notan_egui", version = "0.10.0" } +notan_text = { path = "crates/notan_text", version = "0.10.0" } +notan_audio = { path = "crates/notan_audio", version = "0.10.0" } +notan_extra = { path = "crates/notan_extra", version = "0.10.0" } +notan_random = { path = "crates/notan_random", version = "0.10.0" } +notan_winit = { path = "crates/notan_winit", version = "0.10.0" } +notan_web = { path = "crates/notan_web", version = "0.10.0" } +notan_glow = { path = "crates/notan_glow", version = "0.10.0" } +notan_oddio = { path = "crates/notan_oddio", version = "0.10.0" } + +log = "0.4.20" +hashbrown = "0.14.0" +parking_lot = "0.12.1" +bytemuck = "1.13.1" +serde = { version = "1.0", features = ["serde_derive"] } +image = { version = "0.24.6", default-features = false, features = ["jpeg", "png", "ico"] } + +# wasm deps +wasm-bindgen = "0.2.87" +wasm-bindgen-futures = "0.4.37" +futures-util = "0.3.28" +web-sys = "0.3.64" +js-sys = "0.3.64" + +[dependencies] +notan_core.workspace = true +notan_input.workspace = true +notan_app.workspace = true +notan_macro.workspace = true +notan_math.workspace = true +notan_graphics.workspace = true +notan_utils.workspace = true +notan_log = { workspace = true, optional = true } +notan_glyph = { workspace = true, optional = true } +notan_draw = { workspace = true, optional = true } +notan_backend = { workspace = true, optional = true } +notan_egui = { workspace = true, optional = true } +notan_text = { workspace = true, optional = true } +notan_audio = { workspace = true, optional = true } +notan_extra = { workspace = true, optional = true } +notan_random = { workspace = true, optional = true } + [features] default = ["backend", "log", "draw", "random", "glsl-to-spirv"] backend = ["notan_backend"] @@ -55,13 +91,13 @@ clipboard = ["notan_app/clipboard", "notan_backend?/clipboard"] save_file = ["notan_utils/save_file"] texture_to_file = ["notan_graphics/texture_to_file"] random = ["notan_random"] -glsl-to-spirv = ["notan_macro/glsl-to-spirv"] -shaderc = ["notan_macro/shaderc"] +glsl-to-spirv = ["notan_macro/glsl-to-spirv", "notan_glyph?/glsl-to-spirv", "notan_draw?/glsl-to-spirv", "notan_egui?/glsl-to-spirv", "notan_text?/glsl-to-spirv"] +shaderc = ["notan_macro/shaderc", "notan_glyph?/shaderc", "notan_draw?/shaderc", "notan_egui?/shaderc", "notan_text?/shaderc"] serde = ["notan_app/serde", "notan_math/serde", "notan_core/serde", "notan_input/serde"] [dev-dependencies] -egui_demo_lib = "0.20.0" -bytemuck = "1.13.0" +egui_demo_lib = "0.22.0" +bytemuck = "1.14.0" [[example]] name = "app_drop_file" diff --git a/README.md b/README.md index c0c59f9d..6d72a86f 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ fn setup(gfx: &mut Graphics) -> State { fn draw(gfx: &mut Graphics, state: &mut State) { let mut renderer = gfx.create_renderer(); - renderer.begin(Some(&state.clear_options)); + renderer.begin(Some(state.clear_options)); renderer.set_pipeline(&state.pipeline); renderer.bind_buffer(&state.vbo); renderer.draw(0, 3); diff --git a/crates/notan_app/Cargo.toml b/crates/notan_app/Cargo.toml index 624de46f..b269e54f 100644 --- a/crates/notan_app/Cargo.toml +++ b/crates/notan_app/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_app" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,31 +12,33 @@ description = "Provides the core API for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -log = "0.4.17" -hashbrown = "0.13.2" -notan_core = { path = "../notan_core", version = "0.9.5" } -notan_input = { path = "../notan_input", version = "0.9.5" } -notan_math = { path = "../notan_math", version = "0.9.5" } -notan_macro = { path = "../notan_macro", version = "0.9.5" } -notan_graphics = { path = "../notan_graphics", version = "0.9.5" } -notan_utils = { path = "../notan_utils", version = "0.9.5" } -notan_audio = { path = "../notan_audio", version = "0.9.5", optional = true } +notan_core.workspace = true +notan_input.workspace = true +notan_math.workspace = true +notan_macro.workspace = true +notan_graphics.workspace = true +notan_utils.workspace = true +notan_audio = { workspace = true, optional = true } + +log.workspace = true +hashbrown.workspace = true +parking_lot.workspace = true +bytemuck.workspace = true +serde = { workspace = true, optional = true } + downcast-rs = "1.2.0" -indexmap = "1.9.2" -futures = "0.3.25" -parking_lot = "0.12.1" -bytemuck = "1.13.0" -serde = { version = "1", optional = true, features = ["serde_derive"] } +indexmap = "1.9.3" +futures = "0.3.28" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] platter2 = "0.1.6" [target.'cfg(target_arch = "wasm32")'.dependencies] -web-sys = { version = "0.3.60", optional = true } -wasm-bindgen-futures = { version = "0.4.33", optional = true } -futures-util = { version = "0.3.25", optional = true } -js-sys = { version = "0.3.60", optional = true } platter2 = { version = "0.1.6", features = ["web-sys"] } +web-sys = { workspace = true, optional = true } +wasm-bindgen-futures = { workspace = true, optional = true } +futures-util = { workspace = true, optional = true } +js-sys = { workspace = true, optional = true } [features] audio = ["notan_audio"] diff --git a/crates/notan_app/src/assets/list.rs b/crates/notan_app/src/assets/list.rs index ee6eaafd..37b466b1 100644 --- a/crates/notan_app/src/assets/list.rs +++ b/crates/notan_app/src/assets/list.rs @@ -6,6 +6,7 @@ use std::any::{Any, TypeId}; use std::sync::Arc; +#[derive(Clone)] pub struct AssetList { count: usize, load_tracker: HashMap, diff --git a/crates/notan_app/src/backend.rs b/crates/notan_app/src/backend.rs index a3af806d..054b90aa 100644 --- a/crates/notan_app/src/backend.rs +++ b/crates/notan_app/src/backend.rs @@ -118,7 +118,7 @@ pub trait WindowBackend { fn capture_cursor(&self) -> bool; /// Returns the container size. Meaning the screen size on native - /// and the canva's parent element size on `web` + /// and the canvas's parent element size on `web` fn container_size(&self) -> (i32, i32) { self.screen_size() } @@ -130,7 +130,7 @@ pub trait WindowBackend { fn dpi(&self) -> f64; /// Window's height - fn height(&self) -> i32 { + fn height(&self) -> u32 { self.size().1 } @@ -143,10 +143,13 @@ pub trait WindowBackend { /// Returns true if the window is in fullscreen mode fn is_fullscreen(&self) -> bool; + /// Returns true if the window has focus + fn is_focused(&self) -> bool; + /// Returns true if the lazy mode is enabled fn lazy_loop(&self) -> bool; - // returns whether you can click through the window + /// Returns whether you can click through the window fn mouse_passthrough(&mut self) -> bool; /// Returns the window's position @@ -167,38 +170,41 @@ pub trait WindowBackend { /// Sets the mouse cursor icon fn set_cursor(&mut self, cursor: CursorIcon); + /// Sets the mouse cursor position + fn set_cursor_position(&mut self, x: f32, y: f32); + /// Enable or disable the fullscreen mode fn set_fullscreen(&mut self, enabled: bool); /// Enable or disable the lazy mode for the app's loop fn set_lazy_loop(&mut self, lazy: bool); - // sets whether you can click through the window + /// Sets whether you can click through the window fn set_mouse_passthrough(&mut self, pass_through: bool); /// Sets the window's position fn set_position(&mut self, x: i32, y: i32); /// Sets the window's size - fn set_size(&mut self, width: i32, height: i32); + fn set_size(&mut self, width: u32, height: u32); /// Hide or show the window fn set_visible(&mut self, visible: bool); - /// Returns the window's size - fn size(&self) -> (i32, i32); - /// Set the window's title fn set_title(&mut self, title: &str); /// Returns current windows title fn title(&self) -> &str; + /// Returns the window's size + fn size(&self) -> (u32, u32); + /// Returns if the window is visible fn visible(&self) -> bool; /// Window's width - fn width(&self) -> i32 { + fn width(&self) -> u32 { self.size().0 } diff --git a/crates/notan_app/src/config.rs b/crates/notan_app/src/config.rs index 4d09bf8a..1445cabd 100644 --- a/crates/notan_app/src/config.rs +++ b/crates/notan_app/src/config.rs @@ -12,20 +12,23 @@ pub struct WindowConfig { pub title: String, /// Window's width - pub width: i32, + pub width: u32, /// Window's height - pub height: i32, + pub height: u32, /// Start window in fullscreen mode /// `Web: no-op` pub fullscreen: bool, /// Minimum resizable window's size - pub min_size: Option<(i32, i32)>, + pub min_size: Option<(u32, u32)>, /// Maximum resizable window's size - pub max_size: Option<(i32, i32)>, + pub max_size: Option<(u32, u32)>, + + /// Window's x/y start position + pub position: Option<(i32, i32)>, /// Start the window maximized /// `Web: The canvas will fill the size of the parent of the HtmlCanvasElement` @@ -39,8 +42,8 @@ pub struct WindowConfig { /// `Web: no-op` pub vsync: bool, - /// Antialias nultisamples level - /// `Web: WebGL will use this as antialias = false if the value is 0 or true otherwise` + /// Sets multisampling + /// Setting to 0 disables multisampling pub multisampling: u8, /// Enable High DPI viewport and drawing if the device pixel ratio is higher than 1 @@ -92,6 +95,7 @@ impl Default for WindowConfig { fullscreen: false, min_size: None, max_size: None, + position: None, maximized: false, resizable: false, vsync: false, @@ -119,110 +123,117 @@ impl WindowConfig { } /// Sets the window's title - pub fn title(mut self, title: &str) -> Self { + pub fn set_title(mut self, title: &str) -> Self { self.title = title.to_string(); self } /// Inner loop will run only after an input event - pub fn lazy_loop(mut self, lazy: bool) -> Self { + pub fn set_lazy_loop(mut self, lazy: bool) -> Self { self.lazy_loop = lazy; self } /// Sets the window's width and height - pub fn size(mut self, width: i32, height: i32) -> Self { + pub fn set_size(mut self, width: u32, height: u32) -> Self { self.width = width; self.height = height; self } /// Enable fullscreen mode - pub fn fullscreen(mut self, fullscreen: bool) -> Self { + pub fn set_fullscreen(mut self, fullscreen: bool) -> Self { self.fullscreen = fullscreen; self } /// Sets the window's minimum size - pub fn min_size(mut self, width: i32, height: i32) -> Self { + pub fn set_min_size(mut self, width: u32, height: u32) -> Self { self.min_size = Some((width, height)); self } /// Sets the window's maximum size - pub fn max_size(mut self, width: i32, height: i32) -> Self { + pub fn set_max_size(mut self, width: u32, height: u32) -> Self { self.max_size = Some((width, height)); self } + /// Sets the window's x and y + pub fn set_position(mut self, x: i32, y: i32) -> Self { + self.position = Some((x, y)); + self + } + /// Starts the window maximized - pub fn maximized(mut self, maximized: bool) -> Self { + pub fn set_maximized(mut self, maximized: bool) -> Self { self.maximized = maximized; self } /// Allow the window to be resizable - pub fn resizable(mut self, resizable: bool) -> Self { + pub fn set_resizable(mut self, resizable: bool) -> Self { self.resizable = resizable; self } /// Enable vsync - pub fn vsync(mut self, vsync: bool) -> Self { + pub fn set_vsync(mut self, vsync: bool) -> Self { self.vsync = vsync; self } - /// Enabled multisampling aliasing (opengl) - pub fn multisampling(mut self, samples: u8) -> Self { + /// Sets multisampling + /// Setting to 0 disables multisampling + pub fn set_multisampling(mut self, samples: u8) -> Self { self.multisampling = samples; self } /// Enable High DPI - pub fn high_dpi(mut self, enabled: bool) -> Self { + pub fn set_high_dpi(mut self, enabled: bool) -> Self { self.high_dpi = enabled; self } /// Set the background as transparent - pub fn transparent(mut self, transparent: bool) -> Self { + pub fn set_transparent(mut self, transparent: bool) -> Self { self.transparent = transparent; self } /// Set the background as transparent - pub fn always_on_top(mut self, always_on_top: bool) -> Self { + pub fn set_always_on_top(mut self, always_on_top: bool) -> Self { self.always_on_top = always_on_top; self } /// Enable or disable decorations - pub fn decorations(mut self, decorations: bool) -> Self { + pub fn set_decorations(mut self, decorations: bool) -> Self { self.decorations = decorations; self } /// Hide or show the window - pub fn visible(mut self, visible: bool) -> Self { + pub fn set_visible(mut self, visible: bool) -> Self { self.visible = visible; self } /// Mouse events pass through window - pub fn mouse_passthrough(mut self, mouse_passthrough: bool) -> Self { + pub fn set_mouse_passthrough(mut self, mouse_passthrough: bool) -> Self { self.mouse_passthrough = mouse_passthrough; self } /// Use or create the canvas with this id. Only Web. - pub fn canvas_id(mut self, canvas_id: &str) -> Self { + pub fn set_canvas_id(mut self, canvas_id: &str) -> Self { self.canvas_id = canvas_id.to_string(); self } /// Window icon path - pub fn window_icon(mut self, window_icon_path: Option) -> Self { + pub fn set_window_icon(mut self, window_icon_path: Option) -> Self { self.window_icon_path = window_icon_path; self } @@ -234,7 +245,7 @@ impl WindowConfig { } /// Task bar icon path - pub fn taskbar_icon(mut self, taskbar_icon_path: Option) -> Self { + pub fn set_taskbar_icon(mut self, taskbar_icon_path: Option) -> Self { self.taskbar_icon_path = taskbar_icon_path; self } diff --git a/crates/notan_app/src/empty.rs b/crates/notan_app/src/empty.rs index 41a30911..ad6859b5 100644 --- a/crates/notan_app/src/empty.rs +++ b/crates/notan_app/src/empty.rs @@ -17,9 +17,10 @@ use notan_audio::AudioBackend; #[derive(Default)] pub struct EmptyWindowBackend { title: String, - size: (i32, i32), + size: (u32, u32), position: (i32, i32), is_fullscreen: bool, + is_focused: bool, is_always_on_top: bool, lazy: bool, captured: bool, @@ -53,6 +54,10 @@ impl WindowBackend for EmptyWindowBackend { self.is_fullscreen } + fn is_focused(&self) -> bool { + self.is_focused + } + fn lazy_loop(&self) -> bool { self.lazy } @@ -83,6 +88,8 @@ impl WindowBackend for EmptyWindowBackend { fn set_cursor(&mut self, _cursor: CursorIcon) {} + fn set_cursor_position(&mut self, _x: f32, _y: f32) {} + fn set_fullscreen(&mut self, enabled: bool) { self.is_fullscreen = enabled; } @@ -99,7 +106,7 @@ impl WindowBackend for EmptyWindowBackend { self.position = (x, y); } - fn set_size(&mut self, width: i32, height: i32) { + fn set_size(&mut self, width: u32, height: u32) { self.size = (width, height); } @@ -107,7 +114,7 @@ impl WindowBackend for EmptyWindowBackend { self.visible = visible; } - fn size(&self) -> (i32, i32) { + fn size(&self) -> (u32, u32) { self.size } @@ -251,7 +258,7 @@ impl DeviceBackend for EmptyDeviceBackend { log::info!("{:?}", to_clean); } - fn set_size(&mut self, _width: i32, _height: i32) {} + fn set_size(&mut self, _width: u32, _height: u32) {} fn set_dpi(&mut self, _scale_factor: f64) {} diff --git a/crates/notan_app/src/graphics.rs b/crates/notan_app/src/graphics.rs index 7852b961..50bf3201 100644 --- a/crates/notan_app/src/graphics.rs +++ b/crates/notan_app/src/graphics.rs @@ -79,7 +79,7 @@ impl Graphics { /// Creates a render texture builder #[inline] - pub fn create_render_texture(&mut self, width: i32, height: i32) -> RenderTextureBuilder { + pub fn create_render_texture(&mut self, width: u32, height: u32) -> RenderTextureBuilder { self.device.create_render_texture(width, height) } @@ -151,13 +151,13 @@ impl Graphics { /// Returns the drawable size #[inline] - pub fn size(&self) -> (i32, i32) { + pub fn size(&self) -> (u32, u32) { self.device.size() } /// Sets the drawable size #[inline] - pub fn set_size(&mut self, width: i32, height: i32) { + pub fn set_size(&mut self, width: u32, height: u32) { self.device.set_size(width, height); } diff --git a/crates/notan_app/src/timer.rs b/crates/notan_app/src/timer.rs index 9c9ca7f3..6c01f6b5 100644 --- a/crates/notan_app/src/timer.rs +++ b/crates/notan_app/src/timer.rs @@ -1,13 +1,15 @@ use notan_utils::{Duration, Instant}; use std::collections::VecDeque; +/// Helper to measure and expose application's time events #[derive(Debug, Clone)] pub struct AppTimer { init_time: Instant, last_time: Option, delta: Duration, delta_seconds: f32, - time_since_init: f32, + elapsed: Duration, + elapsed_time: f32, fps_cache: VecDeque, fps: f32, } @@ -26,7 +28,8 @@ impl Default for AppTimer { last_time: None, delta: Duration::from_secs(0), delta_seconds: 0.0, - time_since_init: 0.0, + elapsed: Duration::from_secs(0), + elapsed_time: 0.0, fps_cache, fps, } @@ -45,39 +48,51 @@ impl AppTimer { self.last_time = Some(now); - let time_since_init = now - self.init_time; - self.time_since_init = time_since_init.as_secs_f32(); + self.elapsed = now - self.init_time; + self.elapsed_time = self.elapsed.as_secs_f32(); self.fps_cache.pop_front(); self.fps_cache.push_back(self.delta_seconds); self.fps = 1.0 / (self.fps_cache.iter().sum::() / self.fps_cache.len() as f32); } + /// Average frames per second (calculated using the last 60 frames) #[inline] pub fn fps(&self) -> f32 { self.fps } + /// Delta time between frames #[inline] pub fn delta(&self) -> Duration { self.delta } + /// Delta time between frames in seconds #[inline] pub fn delta_f32(&self) -> f32 { self.delta_seconds } + /// Elapsed time since application's init #[inline] - pub fn time_since_init(&self) -> f32 { - self.time_since_init + pub fn elapsed(&self) -> Duration { + self.elapsed } + /// Elapsed time since application's init in seconds + #[inline] + pub fn elapsed_f32(&self) -> f32 { + self.elapsed_time + } + + /// Application's init time #[inline] pub fn init_time(&self) -> Instant { self.init_time } + /// Last frame time #[inline] pub fn last_time(&self) -> Option { self.last_time diff --git a/crates/notan_audio/Cargo.toml b/crates/notan_audio/Cargo.toml index b897951b..42885951 100644 --- a/crates/notan_audio/Cargo.toml +++ b/crates/notan_audio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_audio" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -10,4 +10,4 @@ license = "MIT OR Apache-2.0" description = "Provides simple audio API for Notan" [dependencies] -parking_lot = "0.12.1" +parking_lot.workspace = true diff --git a/crates/notan_backend/Cargo.toml b/crates/notan_backend/Cargo.toml index 88f723f0..ac1b5a0c 100644 --- a/crates/notan_backend/Cargo.toml +++ b/crates/notan_backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_backend" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,10 +12,10 @@ description = "Provides a default backend for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [target.'cfg(target_arch = "wasm32")'.dependencies] -notan_web = { path = "../notan_web", version = "0.9.5" } +notan_web.workspace = true [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -notan_winit = { path = "../notan_winit", version = "0.9.5" } +notan_winit.workspace = true [features] audio = ["notan_web/audio", "notan_winit/audio"] diff --git a/crates/notan_core/Cargo.toml b/crates/notan_core/Cargo.toml index 92512ef7..1633cf51 100644 --- a/crates/notan_core/Cargo.toml +++ b/crates/notan_core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_core" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -10,10 +10,10 @@ license = "MIT OR Apache-2.0" description = "Basic types and structs used in Notan" [dependencies] -serde = { version = "1", optional = true, features = ["serde_derive"] } +serde = { workspace = true, optional = true } [target.'cfg(target_arch = "wasm32")'.dependencies] -web-sys = { version = "0.3.60", optional = true } +web-sys = { workspace = true, optional = true } [features] links = [] diff --git a/crates/notan_core/src/events.rs b/crates/notan_core/src/events.rs index 154d8c81..b19a1449 100644 --- a/crates/notan_core/src/events.rs +++ b/crates/notan_core/src/events.rs @@ -17,7 +17,7 @@ pub enum Event { WindowMove { x: i32, y: i32 }, /// Represents the current window's size after it was resized - WindowResize { width: i32, height: i32 }, + WindowResize { width: u32, height: u32 }, /// Represents a change on the screen aspect ration ScreenAspectChange { ratio: f64 }, @@ -40,6 +40,9 @@ pub enum Event { /// Mouse cursor has left the window's app MouseLeft { x: i32, y: i32 }, + /// Mouse was moved with this delta + MouseMotion { delta: (f64, f64) }, + /// Keyboard's key is down KeyDown { key: KeyCode }, diff --git a/crates/notan_draw/Cargo.toml b/crates/notan_draw/Cargo.toml index d597d54c..e9f68c3a 100644 --- a/crates/notan_draw/Cargo.toml +++ b/crates/notan_draw/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_draw" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,13 +12,18 @@ description = "Provides a simple 2D API for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -log = "0.4.17" -notan_app = { path = "../notan_app", version = "0.9.5" } -notan_graphics = { path = "../notan_graphics", version = "0.9.5" } -notan_macro = { path = "../notan_macro", version = "0.9.5" } -notan_math = { path = "../notan_math", version = "0.9.5" } -notan_glyph = { path = "../notan_glyph", version = "0.9.5" } -notan_text = { path = "../notan_text", version = "0.9.5" } +log.workspace = true +notan_app.workspace = true +notan_graphics.workspace = true +notan_macro.workspace = true +notan_math.workspace = true +notan_glyph.workspace = true +notan_text.workspace = true +serde = { workspace = true, features = ["derive"] } + lyon = "1.0.1" -serde = { version = "1.0.152", features = ["derive"] } -serde_json = "1.0.91" +serde_json = "1.0.96" + +[features] +glsl-to-spirv = ["notan_macro/glsl-to-spirv", "notan_glyph/glsl-to-spirv", "notan_text/glsl-to-spirv"] +shaderc = ["notan_macro/shaderc", "notan_glyph/shaderc", "notan_text/shaderc"] diff --git a/crates/notan_draw/src/atlas.rs b/crates/notan_draw/src/atlas.rs index 32769658..21126842 100644 --- a/crates/notan_draw/src/atlas.rs +++ b/crates/notan_draw/src/atlas.rs @@ -44,6 +44,7 @@ struct AtlasFrame { sprite_source_size: AtlasRect, #[serde(alias = "sourceSize")] source_size: AtlasSize, + #[serde(default)] pivot: AtlasPoint, } @@ -63,6 +64,12 @@ struct AtlasPoint { y: f32, } +impl Default for AtlasPoint { + fn default() -> Self { + Self { x: 0.5, y: 0.5 } + } +} + #[derive(Serialize, Deserialize, Debug)] struct AtlasSize { w: i32, diff --git a/crates/notan_draw/src/draw.rs b/crates/notan_draw/src/draw.rs index 117033bb..7e0cf655 100644 --- a/crates/notan_draw/src/draw.rs +++ b/crates/notan_draw/src/draw.rs @@ -60,7 +60,7 @@ impl Clone for Draw { } impl Draw { - pub fn new(width: i32, height: i32) -> Self { + pub fn new(width: u32, height: u32) -> Self { let base_projection = Mat4::orthographic_rh_gl(0.0, width as _, height as _, 0.0, -1.0, 1.0); diff --git a/crates/notan_draw/src/manager.rs b/crates/notan_draw/src/manager.rs index 6868ed40..5b920c1a 100644 --- a/crates/notan_draw/src/manager.rs +++ b/crates/notan_draw/src/manager.rs @@ -46,7 +46,7 @@ impl DrawManager { self.renderer.commands() } - pub fn create_draw(&self, width: i32, height: i32) -> Draw { + pub fn create_draw(&self, width: u32, height: u32) -> Draw { Draw::new(width, height) } @@ -171,7 +171,7 @@ fn process_draw( manager.text_painter.clear(); let stencil = draw.needs_to_clean_stencil.then_some(0x00); - manager.renderer.begin(Some(&ClearOptions { + manager.renderer.begin(Some(ClearOptions { color: draw.clear_color, stencil, ..Default::default() diff --git a/crates/notan_draw/src/texts/painter.rs b/crates/notan_draw/src/texts/painter.rs index 775d2aed..82557ce8 100644 --- a/crates/notan_draw/src/texts/painter.rs +++ b/crates/notan_draw/src/texts/painter.rs @@ -223,7 +223,7 @@ impl GlyphPipeline for TextPainter { texture: &Texture, _clear: Option, _transform: Mat4, - _size: (i32, i32), + _size: (u32, u32), _region: Option, ) { renderer.bind_texture_slot(0, 0, texture); diff --git a/crates/notan_draw/src/transform.rs b/crates/notan_draw/src/transform.rs index 746980c3..42d7507b 100644 --- a/crates/notan_draw/src/transform.rs +++ b/crates/notan_draw/src/transform.rs @@ -22,7 +22,7 @@ pub trait DrawTransform { /// Set the matrix position fn translate(&mut self, x: f32, y: f32) -> &mut Self { let old = self.matrix().unwrap_or_else(|| Mat3::IDENTITY); - let matrix = old * Mat3::from_translation(Vec2::new(x, y)); + let matrix = Mat3::from_translation(Vec2::new(x, y)) * old; *self.matrix() = Some(matrix); self } @@ -30,7 +30,7 @@ pub trait DrawTransform { /// Set the matrix scale fn scale(&mut self, x: f32, y: f32) -> &mut Self { let old = self.matrix().unwrap_or_else(|| Mat3::IDENTITY); - let matrix = old * Mat3::from_scale(Vec2::new(x, y)); + let matrix = Mat3::from_scale(Vec2::new(x, y)) * old; *self.matrix() = Some(matrix); self } @@ -38,7 +38,7 @@ pub trait DrawTransform { /// Set the matrix rotation using radians fn rotate(&mut self, angle: f32) -> &mut Self { let old = self.matrix().unwrap_or_else(|| Mat3::IDENTITY); - let matrix = old * Mat3::from_angle(angle); + let matrix = Mat3::from_angle(angle) * old; *self.matrix() = Some(matrix); self } @@ -62,16 +62,18 @@ pub trait DrawTransform { Vec3::new(0.0, 0.0, 1.0), ); - *self.matrix() = Some(old * new); + *self.matrix() = Some(new * old); self } /// Set the matrix rotation using radians from the point given fn rotate_from(&mut self, point: (f32, f32), angle: f32) -> &mut Self { let old = self.matrix().unwrap_or_else(|| Mat3::IDENTITY); - let translate = old * Mat3::from_translation(Vec2::new(point.0, point.1)); - let rotate = translate * Mat3::from_angle(angle); - let matrix = rotate * Mat3::from_translation(Vec2::new(-point.0, -point.1)); + let translate_to_origin = Mat3::from_translation(Vec2::new(-point.0, -point.1)); + let rotate = Mat3::from_angle(angle); + let translate_back = Mat3::from_translation(Vec2::new(point.0, point.1)); + + let matrix = translate_back * rotate * translate_to_origin * old; *self.matrix() = Some(matrix); self } @@ -85,9 +87,11 @@ pub trait DrawTransform { /// Set the matrix scale from the point given fn scale_from(&mut self, point: (f32, f32), scale: (f32, f32)) -> &mut Self { let old = self.matrix().unwrap_or_else(|| Mat3::IDENTITY); - let translate = old * Mat3::from_translation(Vec2::new(point.0, point.1)); - let scale = translate * Mat3::from_scale(Vec2::new(scale.0, scale.1)); - let matrix = scale * Mat3::from_translation(Vec2::new(-point.0, -point.1)); + let translate_to_origin = Mat3::from_translation(Vec2::new(-point.0, -point.1)); + let scale = Mat3::from_scale(Vec2::new(scale.0, scale.1)); + let translate_back = Mat3::from_translation(Vec2::new(point.0, point.1)); + + let matrix = translate_back * scale * translate_to_origin * old; *self.matrix() = Some(matrix); self } diff --git a/crates/notan_egui/Cargo.toml b/crates/notan_egui/Cargo.toml index 7d8a5026..75a775bb 100644 --- a/crates/notan_egui/Cargo.toml +++ b/crates/notan_egui/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_egui" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,13 +12,17 @@ description = "Provides EGUI support for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -log = "0.4.17" -egui = { version = "0.20.1", features = ["bytemuck"] } -bytemuck = "1.13.0" -notan_core = { path = "../notan_core", version = "0.9.5" } -notan_app = { path = "../notan_app", version = "0.9.5" } -notan_macro = { path = "../notan_macro", version = "0.9.5" } +notan_core.workspace = true +notan_app.workspace = true +notan_macro.workspace = true + +log.workspace = true +bytemuck.workspace = true + +egui = { version = "0.22.0", features = ["bytemuck"] } [features] links = [] drop_files = [] +glsl-to-spirv = ["notan_macro/glsl-to-spirv"] +shaderc = ["notan_macro/shaderc"] diff --git a/crates/notan_egui/README.md b/crates/notan_egui/README.md index 187cc7ea..5d03b45e 100644 --- a/crates/notan_egui/README.md +++ b/crates/notan_egui/README.md @@ -1,9 +1,9 @@ EGUI === -This is the implementation of [egui 0.20](https://github.com/emilk/egui) for notan. +This is the implementation of [egui 0.22](https://github.com/emilk/egui) for notan. -It should support all the features that __egui__ uses. Only `clipboard` remains unsupported for now. +It should support all the features that __egui__ uses. You can check some examples at `/examples` or check the demos online: * [egui_basic](https://nazariglez.github.io/notan-web/examples/egui_basic.html) diff --git a/crates/notan_egui/src/extension.rs b/crates/notan_egui/src/extension.rs index bbd20b2c..54af681f 100644 --- a/crates/notan_egui/src/extension.rs +++ b/crates/notan_egui/src/extension.rs @@ -25,12 +25,15 @@ const EGUI_VERTEX: ShaderSource = notan_macro::vertex_shader! { layout(location = 0) out vec4 v_rgba_in_gamma; layout(location = 1) out vec2 v_tc; + layout(location = 2) out float v_srgb_enabled; layout(set = 0, binding = 0) uniform Locals { vec2 u_screen_size; + float srgb_enabled; }; void main() { + v_srgb_enabled = srgb_enabled; gl_Position = vec4( 2.0 * a_pos.x / u_screen_size.x - 1.0, 1.0 - 2.0 * a_pos.y / u_screen_size.y, @@ -48,18 +51,16 @@ const EGUI_VERTEX: ShaderSource = notan_macro::vertex_shader! { const EGUI_FRAGMENT: ShaderSource = notan_macro::fragment_shader! { r#" #version 450 - - #ifdef GL_ES - precision mediump float; - #endif + precision mediump float; layout(location = 0) in vec4 v_rgba_in_gamma; layout(location = 1) in vec2 v_tc; - - layout(binding = 0) uniform sampler2D u_sampler; + layout(location = 2) in float v_srgb_enabled; layout(location = 0) out vec4 color; + layout(binding = 0) uniform sampler2D u_sampler; + // 0-1 sRGB gamma from 0-1 linear vec3 srgb_gamma_from_linear(vec3 rgb) { bvec3 cutoff = lessThan(rgb, vec3(0.0031308)); @@ -74,11 +75,10 @@ const EGUI_FRAGMENT: ShaderSource = notan_macro::fragment_shader! { } void main() { - #if SRGB_TEXTURES - vec4 texture_in_gamma = srgba_gamma_from_linear(texture(u_sampler, v_tc)); - #else vec4 texture_in_gamma = texture(u_sampler, v_tc); - #endif + if (v_srgb_enabled == 1.0) { + texture_in_gamma = srgba_gamma_from_linear(texture_in_gamma); + } // Multiply vertex color with texture color (in linear space). color = v_rgba_in_gamma * texture_in_gamma; } @@ -123,6 +123,7 @@ impl EguiExtension { BlendFactor::InverseDestinationAlpha, BlendFactor::One, )) + .with_srgb_space(cfg!(target_arch = "wasm32")) .with_cull_mode(CullMode::None) .with_texture_location(0, "u_sampler") .build()?; @@ -132,15 +133,19 @@ impl EguiExtension { let ebo = gfx.create_index_buffer().build()?; let ubo = gfx .create_uniform_buffer(0, "Locals") - .with_data(&[0.0; 2]) + .with_data(&[0.0; 3]) .build()?; + let mut textures = HashMap::new(); + let fonts_texture = create_empty_texture(gfx, 0, 0)?; + textures.insert(egui::TextureId::default(), fonts_texture); + Ok(Self { pipeline, vbo, ebo, ubo, - textures: HashMap::new(), + textures, }) } @@ -166,8 +171,8 @@ impl EguiExtension { if let Some([x, y]) = delta.pos { let texture = self .textures - .get_mut(&id) - .ok_or_else(|| format!("Failed to find EGUI texture {id:?}"))?; + .entry(id) + .or_insert_with(|| create_empty_texture(device, width as _, height as _).unwrap()); match &delta.image { egui::ImageData::Color(image) => { @@ -281,9 +286,6 @@ impl EguiExtension { (rt.base_width() as _, rt.base_height() as _) }); - let uniforms: [f32; 3] = [width as _, height as _, 0.0]; - device.set_buffer_data(&self.ubo, &uniforms); - for egui::ClippedPrimitive { clip_rect, primitive, @@ -328,14 +330,25 @@ impl EguiExtension { primitive: &egui::Mesh, target: Option<&RenderTexture>, ) -> Result<(), String> { - let vertices: &[f32] = bytemuck::cast_slice(&primitive.vertices); - device.set_buffer_data(&self.vbo, vertices); - device.set_buffer_data(&self.ebo, &primitive.indices); - let (width_in_pixels, height_in_pixels) = target.map_or(device.size(), |rt| { (rt.base_width() as _, rt.base_height() as _) }); + let texture = self + .textures + .get(&primitive.texture_id) + .ok_or_else(|| format!("Invalid EGUI texture id {:?}", &primitive.texture_id))?; + + let is_srgb_texture = matches!(texture.format(), TextureFormat::SRgba8); + let srgb_enabled = cfg!(target_arch = "wasm32") && is_srgb_texture; + let srgb_as_float = if srgb_enabled { 1.0 } else { 0.0 }; + let uniforms: [f32; 3] = [width_in_pixels as _, height_in_pixels as _, srgb_as_float]; + device.set_buffer_data(&self.ubo, &uniforms); + + let vertices: &[f32] = bytemuck::cast_slice(&primitive.vertices); + device.set_buffer_data(&self.vbo, vertices); + device.set_buffer_data(&self.ebo, &primitive.indices); + let clip_min_x = clip_rect.min.x; let clip_min_y = clip_rect.min.y; let clip_max_x = clip_rect.max.x; @@ -355,11 +368,6 @@ impl EguiExtension { let width = clip_max_x - clip_min_x; let height = clip_max_y - clip_min_y; - let texture = self - .textures - .get(&primitive.texture_id) - .ok_or_else(|| format!("Invalid EGUI texture id {:?}", &primitive.texture_id))?; - // render pass let mut renderer = device.create_renderer(); renderer.set_scissors(clip_min_x, clip_min_y, width, height); @@ -402,14 +410,48 @@ impl EguiRegisterTexture for Graphics { fn create_texture( device: &mut Device, data: &[u8], - width: i32, - height: i32, + width: u32, + height: u32, ) -> Result { + let texture_format = if cfg!(target_arch = "wasm32") { + TextureFormat::SRgba8 + } else { + TextureFormat::Rgba32 + }; + + let texture_filter = if cfg!(target_arch = "wasm32") { + TextureFilter::Linear + } else { + TextureFilter::Nearest + }; + device .create_texture() .from_bytes(data, width, height) - .with_format(TextureFormat::Rgba32) - .with_filter(TextureFilter::Linear, TextureFilter::Linear) + .with_format(texture_format) + .with_filter(texture_filter, texture_filter) + .build() +} + +#[inline] +fn create_empty_texture(device: &mut Device, width: u32, height: u32) -> Result { + let texture_format = if cfg!(target_arch = "wasm32") { + TextureFormat::SRgba8 + } else { + TextureFormat::Rgba32 + }; + + let texture_filter = if cfg!(target_arch = "wasm32") { + TextureFilter::Linear + } else { + TextureFilter::Nearest + }; + + device + .create_texture() + .from_empty_buffer(width, height) + .with_format(texture_format) + .with_filter(texture_filter, texture_filter) .build() } @@ -418,10 +460,10 @@ fn update_texture( device: &mut Device, texture: &mut Texture, data: &[u8], - x: i32, - y: i32, - width: i32, - height: i32, + x: u32, + y: u32, + width: u32, + height: u32, ) -> Result<(), String> { device .update_texture(texture) diff --git a/crates/notan_egui/src/plugin.rs b/crates/notan_egui/src/plugin.rs index e26d5af9..777552ff 100644 --- a/crates/notan_egui/src/plugin.rs +++ b/crates/notan_egui/src/plugin.rs @@ -49,7 +49,8 @@ impl EguiPlugin { shapes, } = self.ctx.run(new_input, run_ui); - let needs_repaint = repaint_after.is_zero(); + let needs_update_textures = !textures_delta.is_empty(); + let needs_repaint = repaint_after.is_zero() || needs_update_textures; // On post frame needs repaint is set to false // set it again if true after a egui output. @@ -103,7 +104,7 @@ impl GfxRenderer for Output { if let Some(shapes) = self.shapes.borrow_mut().take() { if self.clear_color.is_some() { let mut clear_renderer = device.create_renderer(); - clear_renderer.begin(Some(&ClearOptions { + clear_renderer.begin(Some(ClearOptions { color: self.clear_color, ..Default::default() })); @@ -202,6 +203,7 @@ impl Plugin for EguiPlugin { self.add_event(egui::Event::Key { key, pressed: true, + repeat: false, modifiers, }) } @@ -212,6 +214,7 @@ impl Plugin for EguiPlugin { self.add_event(egui::Event::Key { key, pressed: false, + repeat: false, modifiers, }) } @@ -282,6 +285,7 @@ impl Plugin for EguiPlugin { }); is_touch_end = true; } + _ => {} } self.latest_evt_was_touch = is_touch_end; @@ -291,7 +295,7 @@ impl Plugin for EguiPlugin { fn update(&mut self, app: &mut App, _assets: &mut Assets) -> Result { self.raw_input.pixels_per_point = Some(app.window().dpi() as _); - self.raw_input.time = Some(app.timer.time_since_init() as _); + self.raw_input.time = Some(app.timer.elapsed_f32() as _); self.raw_input.predicted_dt = app.timer.delta_f32(); let (w, h) = app.window().size(); diff --git a/crates/notan_extra/Cargo.toml b/crates/notan_extra/Cargo.toml index 00ae0af5..37ae86bd 100644 --- a/crates/notan_extra/Cargo.toml +++ b/crates/notan_extra/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_extra" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,7 +12,7 @@ description = "Provides extra features or plugins for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -notan_app = { path = "../notan_app", version = "0.9.5" } +notan_app.workspace = true [target.'cfg(not(target_arch = "wasm32"))'.dependencies] spin_sleep = "1.1.1" diff --git a/crates/notan_glow/Cargo.toml b/crates/notan_glow/Cargo.toml index a28037af..10f435af 100644 --- a/crates/notan_glow/Cargo.toml +++ b/crates/notan_glow/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_glow" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,14 +12,16 @@ description = "Provides support for OpenGL, OpenGL ES and WebGL for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -log = "0.4.17" -bytemuck = "1.13.0" -glow = "0.11.2" -notan_graphics = { path= "../notan_graphics", version = "0.9.5" } -hashbrown = "0.13.2" -image = { version = "0.24.5", default-features = false, features = ["jpeg", "png"] } +notan_graphics.workspace = true + +log.workspace = true +bytemuck.workspace = true +hashbrown.workspace = true +image.workspace = true + +glow = "0.12.1" [target.'cfg(target_arch = "wasm32")'.dependencies] -wasm-bindgen = "0.2.83" -js-sys = "0.3.60" -web-sys = { version = "0.3.60", features = ["Window", "WebGlContextAttributes","HtmlCanvasElement","HtmlImageElement"] } +wasm-bindgen.workspace = true +js-sys.workspace = true +web-sys = { workspace = true, features = ["Window", "WebGlContextAttributes","HtmlCanvasElement","HtmlImageElement"] } diff --git a/crates/notan_glow/src/buffer.rs b/crates/notan_glow/src/buffer.rs index 542a76e3..9a3c293e 100644 --- a/crates/notan_glow/src/buffer.rs +++ b/crates/notan_glow/src/buffer.rs @@ -29,13 +29,12 @@ pub(crate) struct InnerBuffer { #[cfg(target_arch = "wasm32")] global_ubo: Option>, //Hack, wasm doesn't use the offset for std140 - pub block_binded: bool, - gpu_buff_size: usize, draw_usage: u32, draw_target: u32, pub(crate) kind: Kind, last_pipeline: Option, + block_dirty: bool, #[cfg(debug_assertions)] pub(crate) initialized: bool, @@ -73,13 +72,12 @@ impl InnerBuffer { #[cfg(target_arch = "wasm32")] global_ubo, - block_binded: false, - gpu_buff_size: 0, draw_usage, draw_target, kind, last_pipeline: None, + block_dirty: true, #[cfg(debug_assertions)] initialized: false, @@ -88,10 +86,10 @@ impl InnerBuffer { #[inline] pub fn bind(&mut self, gl: &Context, pipeline_id: Option, reset_attrs: bool) { - let pipeline_changed = - pipeline_id.is_some() && (pipeline_id != self.last_pipeline || reset_attrs); - if pipeline_changed { + let pip_changed = pipeline_changed(pipeline_id, self.last_pipeline) || reset_attrs; + if pip_changed { self.last_pipeline = pipeline_id; + self.block_dirty = true; }; unsafe { @@ -99,7 +97,7 @@ impl InnerBuffer { match &self.kind { Kind::Vertex(attrs) => { - if pipeline_changed { + if pip_changed { attrs.enable(gl); } } @@ -143,9 +141,14 @@ impl InnerBuffer { } } - pub fn bind_ubo_block(&mut self, gl: &Context, pipeline: &InnerPipeline) { - self.block_binded = true; + pub fn bind_ubo_block(&mut self, gl: &Context, pipeline_id: u64, pipeline: &InnerPipeline) { + let pip_changed = + pipeline_changed(Some(pipeline_id), self.last_pipeline) || self.block_dirty; + if !pip_changed { + return; + } + self.block_dirty = false; if let Kind::Uniform(slot, name) = &self.kind { unsafe { if let Some(index) = gl.get_uniform_block_index(pipeline.program, name) { @@ -162,3 +165,7 @@ impl InnerBuffer { } } } + +fn pipeline_changed(pipeline_id: Option, last_pipeline: Option) -> bool { + pipeline_id.is_some() && pipeline_id != last_pipeline +} diff --git a/crates/notan_glow/src/html_image.rs b/crates/notan_glow/src/html_image.rs index 4ccae2d6..d95a0eee 100644 --- a/crates/notan_glow/src/html_image.rs +++ b/crates/notan_glow/src/html_image.rs @@ -78,8 +78,8 @@ pub(crate) unsafe fn update_texture_from_html_image( gl.tex_sub_image_2d_with_html_image( glow::TEXTURE_2D, 0, - opts.x_offset, - opts.y_offset, + opts.x_offset as _, + opts.y_offset as _, texture_format(&opts.format), // 3d texture needs another value? texture_type(&opts.format), image, diff --git a/crates/notan_glow/src/lib.rs b/crates/notan_glow/src/lib.rs index c0a5271e..46ae4114 100644 --- a/crates/notan_glow/src/lib.rs +++ b/crates/notan_glow/src/lib.rs @@ -33,7 +33,7 @@ pub struct GlowBackend { texture_count: u64, pipeline_count: u64, render_target_count: u64, - size: (i32, i32), + size: (u32, u32), dpi: f32, pipelines: HashMap, buffers: HashMap, @@ -45,8 +45,7 @@ pub struct GlowBackend { limits: Limits, stats: GpuStats, current_uniforms: Vec, - drawing_srgba: bool, - drawing_to_render_texture: bool, + target_render_texture: Option, render_texture_mipmaps: bool, } @@ -86,7 +85,14 @@ impl GlowBackend { } fn from(gl: Context, api: &str) -> Result { - log::info!("Using {} graphics api", api); + unsafe { + let version = gl.get_parameter_string(glow::VERSION); + let renderer = gl.get_parameter_string(glow::RENDERER); + let vendor = gl.get_parameter_string(glow::VENDOR); + log::info!( + "OpenGL Info: \nVersion: {version}\nRenderer: {renderer}\nVendor: {vendor}\n---" + ); + } let limits = unsafe { Limits { @@ -115,8 +121,7 @@ impl GlowBackend { limits, stats, current_uniforms: vec![], - drawing_srgba: false, - drawing_to_render_texture: false, + target_render_texture: None, render_texture_mipmaps: false, }) } @@ -129,30 +134,6 @@ impl GlowBackend { self.stats.misc += 1; } - #[inline] - fn enable_srgba(&mut self) { - if self.drawing_srgba { - return; - } - - self.drawing_srgba = true; - unsafe { - self.gl.enable(glow::FRAMEBUFFER_SRGB); - } - } - - #[inline] - fn disable_srgba(&mut self) { - if !self.drawing_srgba { - return; - } - - self.drawing_srgba = false; - unsafe { - self.gl.disable(glow::FRAMEBUFFER_SRGB); - } - } - fn begin( &mut self, target: Option, @@ -168,7 +149,7 @@ impl GlowBackend { let (width, height, dpi) = match render_target { Some(rt) => { rt.bind(&self.gl); - self.drawing_to_render_texture = true; + self.target_render_texture = Some(rt.texture_id); self.render_texture_mipmaps = rt.use_mipmaps; (rt.size.0, rt.size.1, 1.0) } @@ -176,7 +157,6 @@ impl GlowBackend { unsafe { self.gl.bind_framebuffer(glow::FRAMEBUFFER, None); } - self.drawing_to_render_texture = false; self.render_texture_mipmaps = false; (self.size.0, self.size.1, self.dpi) } @@ -189,7 +169,7 @@ impl GlowBackend { #[inline] fn viewport(&mut self, mut x: f32, mut y: f32, width: f32, height: f32, dpi: f32) { - if !self.drawing_to_render_texture { + if self.target_render_texture.is_none() { y = (self.size.1 as f32 - (height + y)) * dpi; x *= dpi; } @@ -205,7 +185,7 @@ impl GlowBackend { #[inline] fn scissors(&mut self, x: f32, y: f32, width: f32, height: f32, dpi: f32) { - let canvas_height = ((self.size.1 - (height + y) as i32) as f32 * dpi) as i32; + let canvas_height = ((self.size.1 - (height + y) as u32) as f32 * dpi) as _; let x = x * dpi; let width = width * dpi; let height = height * dpi; @@ -222,10 +202,17 @@ impl GlowBackend { fn end(&mut self) { unsafe { // generate mipmap for the framebuffer texture if needed - if self.drawing_to_render_texture && self.render_texture_mipmaps { - self.gl.generate_mipmap(glow::TEXTURE_2D); + if self.render_texture_mipmaps { + if let Some(render_texture) = self + .target_render_texture + .and_then(|id| self.textures.get(&id)) + { + self.gl + .bind_texture(glow::TEXTURE_2D, Some(render_texture.texture)); + self.gl.generate_mipmap(glow::TEXTURE_2D); + self.gl.bind_texture(glow::TEXTURE_2D, None); + } } - self.disable_srgba(); self.gl.disable(glow::SCISSOR_TEST); self.gl.bind_buffer(glow::ARRAY_BUFFER, None); self.gl.bind_buffer(glow::ELEMENT_ARRAY_BUFFER, None); @@ -235,7 +222,7 @@ impl GlowBackend { } self.using_indices = None; - self.drawing_to_render_texture = false; + self.target_render_texture = None; self.render_texture_mipmaps = false; } @@ -271,12 +258,11 @@ impl GlowBackend { false } Kind::Uniform(_slot, _name) => { - if !buffer.block_binded { - buffer.bind_ubo_block( - &self.gl, - self.pipelines.get(&self.current_pipeline).as_ref().unwrap(), - ); - } + buffer.bind_ubo_block( + &self.gl, + self.current_pipeline, + self.pipelines.get(&self.current_pipeline).as_ref().unwrap(), + ); false } Kind::Vertex(attrs) => match self.pipelines.get_mut(&self.current_pipeline) { @@ -291,7 +277,7 @@ impl GlowBackend { fn bind_texture(&mut self, id: u64, slot: u32, location: u32) { if let Some(pip) = self.pipelines.get(&self.current_pipeline) { - let is_srgba = if let Some(texture) = self.textures.get(&id) { + if let Some(texture) = self.textures.get(&id) { #[cfg(debug_assertions)] if !pip.texture_locations.contains_key(&location) { log::warn!("Uniform location {} for texture {} should be declared when the pipeline is created.", location, id); @@ -302,15 +288,6 @@ impl GlowBackend { .get(&location) .unwrap_or_else(|| self.get_texture_uniform_loc(&location)); texture.bind(&self.gl, slot, loc); - texture.is_srgba - } else { - false - }; - - if is_srgba { - self.enable_srgba(); - } else { - self.disable_srgba(); } } } @@ -518,7 +495,7 @@ impl DeviceBackend for GlowBackend { } fn clean(&mut self, to_clean: &[ResourceId]) { - log::debug!("gpu resources to_clean {:?}", to_clean); + log::trace!("gpu resources to_clean {:?}", to_clean); to_clean.iter().for_each(|res| match &res { ResourceId::Pipeline(id) => self.clean_pipeline(*id), ResourceId::Buffer(id) => self.clean_buffer(*id), @@ -527,7 +504,7 @@ impl DeviceBackend for GlowBackend { }); } - fn set_size(&mut self, width: i32, height: i32) { + fn set_size(&mut self, width: u32, height: u32) { self.size = (width, height); } @@ -559,7 +536,7 @@ impl DeviceBackend for GlowBackend { "Error creating render target: texture id '{texture_id}' not found.", ))?; - let inner_rt = InnerRenderTexture::new(&self.gl, texture, info)?; + let inner_rt = InnerRenderTexture::new(&self.gl, texture, texture_id, info)?; self.render_target_count += 1; self.render_targets .insert(self.render_target_count, inner_rt); @@ -592,10 +569,10 @@ impl DeviceBackend for GlowBackend { self.gl.tex_sub_image_2d( glow::TEXTURE_2D, 0, - opts.x_offset, - opts.y_offset, - opts.width, - opts.height, + opts.x_offset as _, + opts.y_offset as _, + opts.width as _, + opts.height as _, texture_format(&opts.format), texture_type(&opts.format), PixelUnpackData::Slice(bytes), @@ -646,10 +623,10 @@ impl DeviceBackend for GlowBackend { if can_read { self.gl.read_pixels( - opts.x_offset, - opts.y_offset, - opts.width, - opts.height, + opts.x_offset as _, + opts.y_offset as _, + opts.width as _, + opts.height as _, texture_format(&opts.format), texture_type(&opts.format), glow::PixelPackData::Slice(bytes), diff --git a/crates/notan_glow/src/pipeline.rs b/crates/notan_glow/src/pipeline.rs index 940a23bf..edacd74b 100644 --- a/crates/notan_glow/src/pipeline.rs +++ b/crates/notan_glow/src/pipeline.rs @@ -86,6 +86,8 @@ impl InnerPipeline { set_color_mask(gl, options); set_culling(gl, options); set_blend_mode(gl, options); + #[cfg(not(target_arch = "wasm32"))] + set_srgb_space(gl, options); } } } @@ -243,6 +245,18 @@ unsafe fn set_blend_mode(gl: &Context, options: &PipelineOptions) { } } +#[inline(always)] +#[cfg(not(target_arch = "wasm32"))] +fn set_srgb_space(gl: &Context, opts: &PipelineOptions) { + unsafe { + if opts.srgb_space { + gl.enable(glow::FRAMEBUFFER_SRGB); + } else { + gl.disable(glow::FRAMEBUFFER_SRGB); + } + } +} + #[inline(always)] fn clean_pipeline(gl: &Context, pip: InnerPipeline) { let InnerPipeline { diff --git a/crates/notan_glow/src/render_target.rs b/crates/notan_glow/src/render_target.rs index 61e5d34b..d1c8e384 100644 --- a/crates/notan_glow/src/render_target.rs +++ b/crates/notan_glow/src/render_target.rs @@ -6,12 +6,18 @@ use notan_graphics::prelude::*; pub(crate) struct InnerRenderTexture { fbo: Framebuffer, depth_texture: Option, - pub size: (i32, i32), + pub size: (u32, u32), pub use_mipmaps: bool, + pub texture_id: u64, } impl InnerRenderTexture { - pub fn new(gl: &Context, texture: &InnerTexture, info: &TextureInfo) -> Result { + pub fn new( + gl: &Context, + texture: &InnerTexture, + texture_id: u64, + info: &TextureInfo, + ) -> Result { let use_mipmaps = texture.use_mipmaps; let width = info.width; let height = info.height; @@ -28,6 +34,7 @@ impl InnerRenderTexture { depth_texture, size, use_mipmaps, + texture_id, }) } @@ -95,6 +102,6 @@ unsafe fn create_fbo( } struct DepthInfo { - width: i32, - height: i32, + width: u32, + height: u32, } diff --git a/crates/notan_glow/src/texture.rs b/crates/notan_glow/src/texture.rs index e0ff0414..287aa5c6 100644 --- a/crates/notan_glow/src/texture.rs +++ b/crates/notan_glow/src/texture.rs @@ -6,20 +6,17 @@ pub(crate) type TextureKey = ::Texture; pub(crate) struct InnerTexture { pub texture: TextureKey, - pub size: (i32, i32), - pub is_srgba: bool, + pub size: (u32, u32), pub use_mipmaps: bool, } impl InnerTexture { pub fn new(texture: TextureKey, info: &TextureInfo) -> Result { let size = (info.width, info.height); - let is_srgba = info.format == TextureFormat::SRgba8; let use_mipmaps = info.mipmap_filter.is_some(); Ok(Self { texture, size, - is_srgba, use_mipmaps, }) } @@ -180,8 +177,8 @@ pub(crate) unsafe fn create_texture( glow::TEXTURE_2D, 0, texture_internal_format(&info.format) as _, - info.width, - info.height, + info.width as _, + info.height as _, 0, format, texture_type(&info.format), diff --git a/crates/notan_glow/src/texture_source.rs b/crates/notan_glow/src/texture_source.rs index a22566fa..c3deb5aa 100644 --- a/crates/notan_glow/src/texture_source.rs +++ b/crates/notan_glow/src/texture_source.rs @@ -35,9 +35,7 @@ pub(crate) fn add_texture_from_image( } fn invalid_tex_size(max_size: u32, info: &TextureInfo) -> bool { - let w = info.width as u32; - let h = info.height as u32; - w > max_size || h > max_size + info.width > max_size || info.height > max_size } fn image_load_from_memory(buffer: &[u8]) -> Result { @@ -95,7 +93,7 @@ pub(crate) fn add_texture_from_bytes( ) -> Result<(u64, TextureInfo), String> { #[cfg(debug_assertions)] { - let size = info.width * info.height * (info.bytes_per_pixel() as i32); + let size = info.width * info.height * (info.bytes_per_pixel() as u32); debug_assert_eq!( bytes.len(), size as usize, diff --git a/crates/notan_glow/src/utils.rs b/crates/notan_glow/src/utils.rs index 09cb91d1..b3d1b299 100644 --- a/crates/notan_glow/src/utils.rs +++ b/crates/notan_glow/src/utils.rs @@ -31,13 +31,12 @@ fn create_webgl_context( antialias: bool, transparent: bool, ) -> Result { - //TODO manage errors let gl = win .get_context_with_context_options("webgl", webgl_options(antialias, transparent).as_ref()) - .unwrap() - .unwrap() + .map_err(|e| format!("{e:?}"))? + .ok_or("Cannot adquire the Webgl context. Is the canvas already instantiated?")? .dyn_into::() - .unwrap(); + .map_err(|_| "Cannot adquire WebGL context.")?; let ctx = glow::Context::from_webgl1_context(gl); Ok(ctx) @@ -49,13 +48,12 @@ fn create_webgl2_context( antialias: bool, transparent: bool, ) -> Result { - //TODO manage errors let gl = win .get_context_with_context_options("webgl2", webgl_options(antialias, transparent).as_ref()) - .unwrap() - .unwrap() + .map_err(|e| format!("{e:?}"))? + .ok_or("Cannot adquire the Webgl2 context. Is the canvas already instantiated?")? .dyn_into::() - .unwrap(); + .map_err(|_| "Cannot adquire WebGL2 context.")?; let ctx = glow::Context::from_webgl2_context(gl); Ok(ctx) diff --git a/crates/notan_glyph/Cargo.toml b/crates/notan_glyph/Cargo.toml index d8fb0e01..bf261c0d 100644 --- a/crates/notan_glyph/Cargo.toml +++ b/crates/notan_glyph/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_glyph" -version = "0.9.5" +version = "0.10.0" edition = "2021" readme = "README.md" homepage = "https://github.com/Nazariglez/notan" @@ -11,9 +11,16 @@ description = "Provides glyph's support for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -log = "0.4.17" -glyph_brush = "0.7.5" -bytemuck = "1.13.0" -notan_app = { path = "../notan_app", version = "0.9.5" } -notan_graphics = { path = "../notan_graphics", version = "0.9.5" } -notan_math = { path = "../notan_math", version = "0.9.5" } +notan_app.workspace = true +notan_graphics.workspace = true +notan_math.workspace = true +notan_macro.workspace = true + +log.workspace = true +bytemuck.workspace = true + +glyph_brush = "0.7.7" + +[features] +glsl-to-spirv = ["notan_macro/glsl-to-spirv"] +shaderc = ["notan_macro/shaderc"] diff --git a/crates/notan_glyph/src/lib.rs b/crates/notan_glyph/src/lib.rs index 9387789d..48c360d2 100644 --- a/crates/notan_glyph/src/lib.rs +++ b/crates/notan_glyph/src/lib.rs @@ -136,7 +136,7 @@ pub struct RenderQueueBuilder<'a, F = FontArc, H = DefaultSectionHasher> { pipeline: &'a mut dyn GlyphPipeline, clear: Option, region: Option, - size: Option<(i32, i32)>, + size: Option<(u32, u32)>, transform: Option, } @@ -177,7 +177,7 @@ impl<'a, F: Font + Sync, H: BuildHasher> RenderQueueBuilder<'a, F, H> { self } - pub fn size(mut self, width: i32, height: i32) -> Self { + pub fn size(mut self, width: u32, height: u32) -> Self { self.size = Some((width, height)); self } diff --git a/crates/notan_glyph/src/pipeline.rs b/crates/notan_glyph/src/pipeline.rs index c4136ea6..48877dbd 100644 --- a/crates/notan_glyph/src/pipeline.rs +++ b/crates/notan_glyph/src/pipeline.rs @@ -1,5 +1,6 @@ use crate::instance::GlyphInstance; use notan_app::graphics::*; +use notan_macro::*; use notan_math::Mat4; use notan_math::Rect; @@ -10,7 +11,7 @@ pub trait GlyphPipeline { texture: &Texture, clear: Option, transform: Mat4, - size: (i32, i32), + size: (u32, u32), region: Option, ) -> Renderer { let mut renderer = device.create_renderer(); @@ -34,7 +35,7 @@ pub trait GlyphPipeline { texture: &Texture, clear: Option, transform: Mat4, - size: (i32, i32), + size: (u32, u32), region: Option, ); @@ -166,7 +167,7 @@ impl GlyphPipeline for DefaultGlyphPipeline { texture: &Texture, clear: Option, transform: Mat4, - size: (i32, i32), + size: (u32, u32), region: Option, ) { if self.current_transform != transform { @@ -180,7 +181,7 @@ impl GlyphPipeline for DefaultGlyphPipeline { renderer.set_scissors(region.x, region.y, region.width, region.height); } - renderer.begin(clear.as_ref()); + renderer.begin(clear); renderer.set_pipeline(&self.pipeline); renderer.bind_texture(0, texture); renderer.bind_buffers(&[&self.vbo, &self.ubo]); diff --git a/crates/notan_graphics/Cargo.toml b/crates/notan_graphics/Cargo.toml index f8591fee..91201d11 100644 --- a/crates/notan_graphics/Cargo.toml +++ b/crates/notan_graphics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_graphics" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,13 +12,15 @@ description = "Provides simple graphics API for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -bytemuck = "1.13.0" -parking_lot = "0.12.1" -image = { version = "0.24.5", default-features = false, features = ["jpeg", "png"] } -notan_math = { path = "../notan_math", version = "0.9.5" } -notan_macro = { path = "../notan_macro", version = "0.9.5" } -notan_utils = { path = "../notan_utils", version = "0.9.5" } -glsl-layout = { version = "0.5.0", features = ["glam"] } +notan_math.workspace = true +notan_macro.workspace = true +notan_utils.workspace = true + +bytemuck.workspace = true +parking_lot.workspace = true +image = { workspace = true, optional = true } + +crevice_notan = { version = "0.13.0", features = ["glam"] } [features] -texture_to_file = ["notan_utils/save_file"] +texture_to_file = ["notan_utils/save_file", "image/png"] diff --git a/crates/notan_graphics/src/commands.rs b/crates/notan_graphics/src/commands.rs index dd41b34b..bc3f0180 100644 --- a/crates/notan_graphics/src/commands.rs +++ b/crates/notan_graphics/src/commands.rs @@ -5,8 +5,8 @@ use crate::pipeline::*; #[derive(Debug, Clone)] pub enum Commands { Size { - width: i32, - height: i32, + width: u32, + height: u32, }, Viewport { x: f32, diff --git a/crates/notan_graphics/src/device.rs b/crates/notan_graphics/src/device.rs index 7efa8d31..125e604c 100644 --- a/crates/notan_graphics/src/device.rs +++ b/crates/notan_graphics/src/device.rs @@ -1,6 +1,6 @@ use crate::buffer::*; use crate::commands::*; -use crate::glsl_layout::{Std140, Uniform as UniformLayout}; +use crate::crevice::std140::{AsStd140, Std140}; use crate::limits::Limits; use crate::pipeline::*; use crate::render_texture::*; @@ -93,7 +93,7 @@ pub trait DeviceBackend { fn clean(&mut self, to_clean: &[ResourceId]); /// Sets the render size - fn set_size(&mut self, width: i32, height: i32); + fn set_size(&mut self, width: u32, height: u32); /// Sets the screen dpi fn set_dpi(&mut self, scale_factor: f64); @@ -146,7 +146,7 @@ impl DropManager { } pub struct Device { - size: (i32, i32), + size: (u32, u32), dpi: f64, backend: Box, //TODO generic? drop_manager: Arc, @@ -173,12 +173,12 @@ impl Device { } #[inline] - pub fn size(&self) -> (i32, i32) { + pub fn size(&self) -> (u32, u32) { self.size } #[inline] - pub fn set_size(&mut self, width: i32, height: i32) { + pub fn set_size(&mut self, width: u32, height: u32) { self.size = (width, height); self.backend.set_size(width, height); } @@ -218,7 +218,7 @@ impl Device { /// Creates a render texture builder #[inline] - pub fn create_render_texture(&mut self, width: i32, height: i32) -> RenderTextureBuilder { + pub fn create_render_texture(&mut self, width: u32, height: u32) -> RenderTextureBuilder { RenderTextureBuilder::new(self, width, height) } @@ -458,7 +458,7 @@ impl Device { } } -pub trait Uniform: UniformLayout {} +pub trait Uniform: AsStd140 {} pub trait BufferData { fn upload(&self, device: &mut Device, id: u64); fn save_as_bytes(&self, _data: &mut Vec) {} @@ -519,11 +519,13 @@ where #[inline] fn upload(&self, device: &mut Device, id: u64) { // TODO check opengl version or driver if it uses std140 to layout or not - device.backend.set_buffer_data(id, self.std140().as_raw()); + device + .backend + .set_buffer_data(id, self.as_std140().as_bytes()); } fn save_as_bytes(&self, data: &mut Vec) { - data.extend_from_slice(self.std140().as_raw()); + data.extend_from_slice(self.as_std140().as_bytes()); } } diff --git a/crates/notan_graphics/src/lib.rs b/crates/notan_graphics/src/lib.rs index b109db85..80b8ea75 100644 --- a/crates/notan_graphics/src/lib.rs +++ b/crates/notan_graphics/src/lib.rs @@ -11,7 +11,7 @@ pub mod texture; pub mod prelude; -pub use glsl_layout; +pub use crevice_notan as crevice; #[cfg(feature = "texture_to_file")] mod to_file; @@ -22,7 +22,3 @@ pub use render_texture::*; pub use renderer::*; pub use shader::*; pub use texture::*; - -pub use notan_macro::{ - fragment_shader, include_fragment_shader, include_vertex_shader, vertex_shader, -}; diff --git a/crates/notan_graphics/src/pipeline.rs b/crates/notan_graphics/src/pipeline.rs index db3369e5..6a1ef20d 100644 --- a/crates/notan_graphics/src/pipeline.rs +++ b/crates/notan_graphics/src/pipeline.rs @@ -156,6 +156,12 @@ impl<'a, 'b> PipelineBuilder<'a, 'b> { self } + /// Enable the SRGB Color Space + pub fn with_srgb_space(mut self, srgb: bool) -> Self { + self.options.srgb_space = srgb; + self + } + /// Build the pipeline with the data set on the builder pub fn build(self) -> Result { match self.shaders { @@ -351,6 +357,7 @@ pub struct PipelineOptions { pub depth_stencil: DepthStencil, pub color_mask: ColorMask, pub stencil: Option, + pub srgb_space: bool, } impl Default for PipelineOptions { @@ -362,6 +369,7 @@ impl Default for PipelineOptions { alpha_blend: None, color_mask: Default::default(), stencil: None, + srgb_space: false, } } } diff --git a/crates/notan_graphics/src/prelude.rs b/crates/notan_graphics/src/prelude.rs index c3da85dc..c16b6fa9 100644 --- a/crates/notan_graphics/src/prelude.rs +++ b/crates/notan_graphics/src/prelude.rs @@ -2,14 +2,9 @@ pub use crate::buffer::*; pub use crate::color::*; pub use crate::commands::*; pub use crate::device::*; -pub use crate::glsl_layout; pub use crate::limits::*; pub use crate::pipeline::*; pub use crate::render_texture::*; pub use crate::renderer::*; pub use crate::shader::*; pub use crate::texture::*; - -pub use notan_macro::{ - fragment_shader, include_fragment_shader, include_vertex_shader, vertex_shader, -}; diff --git a/crates/notan_graphics/src/render_texture.rs b/crates/notan_graphics/src/render_texture.rs index d12db9d9..545ecf5f 100644 --- a/crates/notan_graphics/src/render_texture.rs +++ b/crates/notan_graphics/src/render_texture.rs @@ -80,7 +80,7 @@ pub struct RenderTextureBuilder<'a> { } impl<'a> RenderTextureBuilder<'a> { - pub fn new(device: &'a mut Device, width: i32, height: i32) -> Self { + pub fn new(device: &'a mut Device, width: u32, height: u32) -> Self { let info = TextureInfo { width, height, @@ -109,6 +109,29 @@ impl<'a> RenderTextureBuilder<'a> { self } + /// Set the texture wrap modes (x -> s, y -> t) + pub fn with_wrap(mut self, x: TextureWrap, y: TextureWrap) -> Self { + self.info.wrap_x = x; + self.info.wrap_y = y; + self + } + + /// Toggle mipmap generation (with Linear filter if enabled) + pub fn with_mipmaps(mut self, enable: bool) -> Self { + if enable { + self.info.mipmap_filter = Some(TextureFilter::Linear); + } else { + self.info.mipmap_filter = None; + } + self + } + + /// Set mipmap filtering function + pub fn with_mipmap_filter(mut self, filter: TextureFilter) -> Self { + self.info.mipmap_filter = Some(filter); + self + } + pub fn build(self) -> Result { let Self { device, info } = self; diff --git a/crates/notan_graphics/src/renderer.rs b/crates/notan_graphics/src/renderer.rs index 807f1459..bdeb76db 100644 --- a/crates/notan_graphics/src/renderer.rs +++ b/crates/notan_graphics/src/renderer.rs @@ -7,13 +7,13 @@ use crate::texture::*; #[derive(Default, Clone)] pub struct Renderer { commands: Vec, - size: (i32, i32), + size: (u32, u32), primitive: DrawPrimitive, slot_count: u32, } impl Renderer { - pub fn new(width: i32, height: i32) -> Self { + pub fn new(width: u32, height: u32) -> Self { Self { size: (width, height), commands: vec![Commands::Size { width, height }], @@ -22,7 +22,7 @@ impl Renderer { } } - pub fn begin(&mut self, options: Option<&ClearOptions>) { + pub fn begin(&mut self, options: Option) { let (color, stencil, depth) = match options { Some(opts) => (opts.color, opts.stencil, opts.depth), _ => (None, None, None), @@ -44,20 +44,20 @@ impl Renderer { self.unbind_textures(); } - pub fn set_size(&mut self, width: i32, height: i32) { + pub fn set_size(&mut self, width: u32, height: u32) { self.size = (width, height); self.commands.push(Commands::Size { width, height }); } - pub fn size(&self) -> (i32, i32) { + pub fn size(&self) -> (u32, u32) { self.size } - pub fn width(&self) -> i32 { + pub fn width(&self) -> u32 { self.size.0 } - pub fn height(&self) -> i32 { + pub fn height(&self) -> u32 { self.size.1 } diff --git a/crates/notan_graphics/src/texture.rs b/crates/notan_graphics/src/texture.rs index 977daf7e..14333183 100644 --- a/crates/notan_graphics/src/texture.rs +++ b/crates/notan_graphics/src/texture.rs @@ -18,26 +18,26 @@ pub trait TextureSource { #[derive(Debug)] pub struct TextureRead { - pub x_offset: i32, - pub y_offset: i32, - pub width: i32, - pub height: i32, + pub x_offset: u32, + pub y_offset: u32, + pub width: u32, + pub height: u32, pub format: TextureFormat, } #[derive(Debug, Clone)] pub struct TextureUpdate { - pub x_offset: i32, - pub y_offset: i32, - pub width: i32, - pub height: i32, + pub x_offset: u32, + pub y_offset: u32, + pub width: u32, + pub height: u32, pub format: TextureFormat, } #[derive(Debug, Clone)] pub struct TextureInfo { - pub width: i32, - pub height: i32, + pub width: u32, + pub height: u32, pub format: TextureFormat, pub min_filter: TextureFilter, pub mag_filter: TextureFilter, @@ -87,7 +87,6 @@ impl TextureFormat { } } -#[derive(Debug)] struct TextureIdRef { id: u64, drop_manager: Arc, @@ -99,12 +98,18 @@ impl Drop for TextureIdRef { } } +impl Debug for TextureIdRef { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "TextureIdRef({})", self.id) + } +} + #[derive(Debug, Clone)] pub struct Texture { id: u64, _id_ref: Arc, - width: i32, - height: i32, + width: u32, + height: u32, format: TextureFormat, min_filter: TextureFilter, mag_filter: TextureFilter, @@ -330,7 +335,7 @@ impl<'a, 'b> TextureBuilder<'a, 'b> { } /// Creates a Texture from a buffer of pixels - pub fn from_bytes(mut self, bytes: &'b [u8], width: i32, height: i32) -> Self { + pub fn from_bytes(mut self, bytes: &'b [u8], width: u32, height: u32) -> Self { self.source = None; self.kind = Some(TextureKind::Bytes(bytes)); self.info.width = width; @@ -339,14 +344,14 @@ impl<'a, 'b> TextureBuilder<'a, 'b> { } /// Creates a buffer for the size passed in and creates a Texture with it - pub fn from_empty_buffer(mut self, width: i32, height: i32) -> Self { + pub fn from_empty_buffer(mut self, width: u32, height: u32) -> Self { self.source = None; self.kind = Some(TextureKind::EmptyBuffer); self.with_size(width, height) } /// Set the size of the texture (ignored if used with `from_image`, image size will be used instead) - pub fn with_size(mut self, width: i32, height: i32) -> Self { + pub fn with_size(mut self, width: u32, height: u32) -> Self { self.info.width = width; self.info.height = height; self @@ -384,7 +389,7 @@ impl<'a, 'b> TextureBuilder<'a, 'b> { self } - /// Generate the mipmaps + /// Toggle mipmap generation (with Linear filter if enabled) pub fn with_mipmaps(mut self, enable: bool) -> Self { if enable { self.info.mipmap_filter = Some(TextureFilter::Linear); @@ -394,6 +399,7 @@ impl<'a, 'b> TextureBuilder<'a, 'b> { self } + /// Set mipmap filtering function pub fn with_mipmap_filter(mut self, filter: TextureFilter) -> Self { self.info.mipmap_filter = Some(filter); self @@ -412,7 +418,7 @@ impl<'a, 'b> TextureBuilder<'a, 'b> { source = Some(TextureSourceKind::Image(bytes.to_vec())); } Some(TextureKind::Bytes(bytes)) => { - let size = (info.width * info.height * (info.bytes_per_pixel() as i32)) as usize; + let size = (info.width * info.height * (info.bytes_per_pixel() as u32)) as usize; if bytes.len() != size { return Err(format!( "Texture type {:?} with {} bytes, when it should be {} (width: {} * height: {} * bytes: {})", @@ -428,7 +434,7 @@ impl<'a, 'b> TextureBuilder<'a, 'b> { source = Some(TextureSourceKind::Bytes(bytes.to_vec())); } Some(TextureKind::EmptyBuffer) => { - let size = info.width * info.height * (info.bytes_per_pixel() as i32); + let size = info.width * info.height * (info.bytes_per_pixel() as u32); source = Some(TextureSourceKind::Bytes(vec![0; size as _])); } None => {} @@ -442,20 +448,20 @@ impl<'a, 'b> TextureBuilder<'a, 'b> { pub struct TextureReader<'a> { device: &'a mut Device, texture: &'a Texture, - x_offset: i32, - y_offset: i32, - width: i32, - height: i32, + x_offset: u32, + y_offset: u32, + width: u32, + height: u32, format: TextureFormat, } impl<'a> TextureReader<'a> { pub fn new(device: &'a mut Device, texture: &'a Texture) -> Self { let rect = *texture.frame(); - let x_offset = rect.x as i32; - let y_offset = rect.y as i32; - let width = rect.width as i32; - let height = rect.height as i32; + let x_offset = rect.x as _; + let y_offset = rect.y as _; + let width = rect.width as _; + let height = rect.height as _; let format = texture.format; Self { device, @@ -469,25 +475,25 @@ impl<'a> TextureReader<'a> { } /// Read pixels from the axis x offset - pub fn with_x_offset(mut self, offset: i32) -> Self { + pub fn with_x_offset(mut self, offset: u32) -> Self { self.x_offset = offset; self } /// Read pixels from the axis y offset - pub fn with_y_offset(mut self, offset: i32) -> Self { + pub fn with_y_offset(mut self, offset: u32) -> Self { self.y_offset = offset; self } /// Read pixels until this width from the x offset value - pub fn with_width(mut self, width: i32) -> Self { + pub fn with_width(mut self, width: u32) -> Self { self.width = width; self } /// Read pixels until this height from the y offset value - pub fn with_height(mut self, height: i32) -> Self { + pub fn with_height(mut self, height: u32) -> Self { self.height = height; self } @@ -518,10 +524,10 @@ impl<'a> TextureReader<'a> { pub struct TextureUpdater<'a> { device: &'a mut Device, texture: &'a mut Texture, - x_offset: i32, - y_offset: i32, - width: i32, - height: i32, + x_offset: u32, + y_offset: u32, + width: u32, + height: u32, format: TextureFormat, source: Option>, } @@ -547,25 +553,25 @@ impl<'a> TextureUpdater<'a> { } /// Update pixels from the axis x offset - pub fn with_x_offset(mut self, offset: i32) -> Self { + pub fn with_x_offset(mut self, offset: u32) -> Self { self.x_offset = offset; self } /// Update pixels from the axis y offset - pub fn with_y_offset(mut self, offset: i32) -> Self { + pub fn with_y_offset(mut self, offset: u32) -> Self { self.y_offset = offset; self } /// Update pixels until this width from the x offset value - pub fn with_width(mut self, width: i32) -> Self { + pub fn with_width(mut self, width: u32) -> Self { self.width = width; self } /// Update pixels until this height from the y offset value - pub fn with_height(mut self, height: i32) -> Self { + pub fn with_height(mut self, height: u32) -> Self { self.height = height; self } diff --git a/crates/notan_input/Cargo.toml b/crates/notan_input/Cargo.toml index dc6341e9..fc781d89 100644 --- a/crates/notan_input/Cargo.toml +++ b/crates/notan_input/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_input" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -10,11 +10,12 @@ license = "MIT OR Apache-2.0" description = "Provides a set of API to manage user's input" [dependencies] -notan_core = { path = "../notan_core", version = "0.9.5" } -notan_math = { path = "../notan_math", version = "0.9.5" } -hashbrown = "0.13.2" -log = "0.4.17" -serde = { version = "1", optional = true, features = ["serde_derive"] } +notan_core.workspace = true +notan_math.workspace = true + +hashbrown.workspace = true +log.workspace = true +serde = { workspace = true, optional = true } [features] -serde = ["dep:serde", "notan_core/serde", "notan_math/serde", "hashbrown/serde"] \ No newline at end of file +serde = ["dep:serde", "notan_core/serde", "notan_math/serde", "hashbrown/serde"] diff --git a/crates/notan_input/src/mouse.rs b/crates/notan_input/src/mouse.rs index 20307c6d..3a4cf5e5 100644 --- a/crates/notan_input/src/mouse.rs +++ b/crates/notan_input/src/mouse.rs @@ -2,7 +2,7 @@ use hashbrown::{HashMap, HashSet}; use notan_core::events::Event; pub use notan_core::mouse::MouseButton; -use notan_math::{Mat3, Vec2}; +use notan_math::Vec2; #[derive(Default)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] @@ -20,6 +20,12 @@ pub struct Mouse { pub released: HashSet, /// wheel delta pub wheel_delta: Vec2, + /// motion delta + pub motion_delta: (f64, f64), + /// used internally to reset the wheel_delta + scrolling: bool, + /// used internally to reset the motion_delta + moving: bool, } impl Mouse { @@ -33,16 +39,6 @@ impl Mouse { (self.x, self.y) } - #[inline] - #[doc(hidden)] - #[deprecated] - #[allow(deprecated)] - /// Returns a local position - pub fn local_position(&self, m: Mat3) -> (f32, f32) { - let pos = notan_math::mat3_screen_to_local(self.x, self.y, m); - (pos.x, pos.y) - } - #[inline] /// Returns true if the button was released on the last frame pub fn was_released(&self, btn: MouseButton) -> bool { @@ -121,17 +117,41 @@ impl Mouse { self.was_pressed(MouseButton::Right) } + #[inline(always)] + /// Returns true if the user is scrolling in this frame + pub fn is_scrolling(&self) -> bool { + self.scrolling + } + + #[inline(always)] + /// Returns true if the user is moving the mouse in this frame + pub fn is_moving(&self) -> bool { + self.moving + } + #[inline] pub(crate) fn clear(&mut self) { self.pressed.clear(); self.released.clear(); + + if !self.scrolling { + self.wheel_delta.x = 0.0; + self.wheel_delta.y = 0.0; + } + + if !self.moving { + self.motion_delta.0 = 0.0; + self.motion_delta.1 = 0.0; + } + + // we set it to false after the check to reset the wheel_delta to keep the value for at + // least one frame, and if the next frame we're not scrolling then we reset wheel_delta + self.scrolling = false; + self.moving = false; } #[inline] pub(crate) fn process_events(&mut self, evt: &Event, delta: f32) { - self.wheel_delta.x = 0.0; - self.wheel_delta.y = 0.0; - match evt { Event::MouseMove { x, y } => { self.x = *x as f32; @@ -151,16 +171,22 @@ impl Mouse { self.x = *x as f32; self.y = *y as f32; - if let Some(t) = self.down.get_mut(button) { - *t += delta; - } else { - self.down.insert(*button, 0.0); - self.pressed.insert(*button); + match self.down.get_mut(button) { + Some(t) => *t += delta, + None => { + self.down.insert(*button, 0.0); + self.pressed.insert(*button); + } } } Event::MouseWheel { delta_x, delta_y } => { self.wheel_delta.x = *delta_x; self.wheel_delta.y = *delta_y; + self.scrolling = true; + } + Event::MouseMotion { delta } => { + self.motion_delta = *delta; + self.moving = true; } _ => {} } diff --git a/crates/notan_log/Cargo.toml b/crates/notan_log/Cargo.toml index afeaa68f..6a34e07a 100644 --- a/crates/notan_log/Cargo.toml +++ b/crates/notan_log/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_log" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,14 +12,17 @@ description = "Provides a multipatform log support for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -log = "0.4.17" -fern = { version = "0.6.1", features = ["colored"] } -notan_app = { path = "../notan_app", version = "0.9.5" } +notan_app.workspace = true + +log.workspace = true + +fern = { version = "0.6.2", features = ["colored"] } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -time = { version = "0.3.17", features = ["formatting", "local-offset"] } +time = { version = "0.3.21", features = ["formatting", "local-offset"] } [target.'cfg(target_arch = "wasm32")'.dependencies] -console_log = "0.2.0" -wasm-bindgen = "0.2.83" -js-sys = "0.3.60" +wasm-bindgen.workspace = true +js-sys.workspace = true + +console_log = "1.0.0" diff --git a/crates/notan_log/src/config.rs b/crates/notan_log/src/config.rs index 5e7b2db9..8fbac18e 100644 --- a/crates/notan_log/src/config.rs +++ b/crates/notan_log/src/config.rs @@ -5,7 +5,7 @@ use std::collections::HashMap; use crate::console_error::console_error; /// Configure the logs output -/// Logs will show a timestamp using the UTC time with format [year]-[month]-[day] [hour]:[minutes]:[seconds] +/// Logs will show a timestamp using the UTC time with format `[year]-[month]-[day] [hour]:[minutes]:[seconds]` #[derive(Clone)] pub struct LogConfig { level: log::LevelFilter, diff --git a/crates/notan_macro/Cargo.toml b/crates/notan_macro/Cargo.toml index 795035ca..11c1d4ba 100644 --- a/crates/notan_macro/Cargo.toml +++ b/crates/notan_macro/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_macro" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,12 +12,12 @@ description = "Provides a set of utils as macros for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -syn = { version = "1.0.107", features = ["full", "extra-traits"] } -quote = "1.0.23" +syn = { version = "2.0.17", features = ["full", "extra-traits"] } +quote = "1.0.28" num = "0.4.0" glsl-to-spirv = { version = "0.1.7", optional = true } shaderc = { version = "0.8.2", optional = true } -proc-macro2 = "1.0.50" +proc-macro2 = "1.0.59" spirv_cross = { version = "0.23.1", features = ["glsl"] } [build-dependencies] diff --git a/crates/notan_macro/build.rs b/crates/notan_macro/build.rs index fab2958c..ce53e6d4 100644 --- a/crates/notan_macro/build.rs +++ b/crates/notan_macro/build.rs @@ -8,7 +8,8 @@ fn main() { // TODO: add naga once the PR lands cfg_aliases! { - use_glsl_to_spirv: { all(feature = "glsl_to_spirv", not(feature = "shaderc")) }, - use_shaderc: { feature = "shaderc" } + use_glsl_to_spirv: { all(feature = "glsl-to-spirv", not(feature = "shaderc")) }, + use_shaderc: { feature = "shaderc" }, + shader_compilation: { any(use_glsl_to_spirv, use_shaderc) } } } diff --git a/crates/notan_macro/src/lib.rs b/crates/notan_macro/src/lib.rs index 3bb28b44..4bfdcd80 100644 --- a/crates/notan_macro/src/lib.rs +++ b/crates/notan_macro/src/lib.rs @@ -1,10 +1,13 @@ extern crate proc_macro; use proc_macro::*; use quote::quote; -use syn::{parse_macro_input, DeriveInput, LitStr}; +use syn::DeriveInput; +#[cfg(shader_compilation)] +use syn::{parse_macro_input, LitStr}; use syn::{ItemFn, ReturnType}; mod handlers; +#[cfg(shader_compilation)] mod shaders; mod state; @@ -15,7 +18,7 @@ pub fn notan_main(_attr: TokenStream, item: TokenStream) -> TokenStream { } fn handle_main_func(input: ItemFn) -> TokenStream { - let ident = input.sig.ident.clone(); + let ident = &input.sig.ident; let void_ret = input.sig.output == ReturnType::Default; let ret: proc_macro2::TokenStream = if void_ret { "()" } else { "Result<(), String>" } .parse() @@ -63,6 +66,7 @@ pub fn state_derive(input: TokenStream) -> TokenStream { state::impl_state_derive(&ast) } +#[cfg(shader_compilation)] #[proc_macro] pub fn vertex_shader(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as LitStr); @@ -72,6 +76,7 @@ pub fn vertex_shader(input: TokenStream) -> TokenStream { shaders::source_from_spirv(spirv).unwrap() } +#[cfg(shader_compilation)] #[proc_macro] pub fn include_vertex_shader(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as LitStr); @@ -81,6 +86,7 @@ pub fn include_vertex_shader(input: TokenStream) -> TokenStream { shaders::source_from_spirv(spirv).unwrap() } +#[cfg(shader_compilation)] #[proc_macro] pub fn fragment_shader(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as LitStr); @@ -90,6 +96,7 @@ pub fn fragment_shader(input: TokenStream) -> TokenStream { shaders::source_from_spirv(spirv).unwrap() } +#[cfg(shader_compilation)] #[proc_macro] pub fn include_fragment_shader(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as LitStr); @@ -105,7 +112,7 @@ pub fn uniform(_metadata: TokenStream, input: TokenStream) -> TokenStream { let ident = derive.ident; let input: proc_macro2::TokenStream = input.into(); let output = quote! { - #[derive(glsl_layout::Uniform)] + #[derive(::notan::graphics::crevice::std140::AsStd140)] #input impl ::notan::graphics::Uniform for #ident {} diff --git a/crates/notan_macro/src/state.rs b/crates/notan_macro/src/state.rs index dd78f965..150dff03 100644 --- a/crates/notan_macro/src/state.rs +++ b/crates/notan_macro/src/state.rs @@ -4,8 +4,11 @@ use quote::quote; pub(crate) fn impl_state_derive(ast: &syn::DeriveInput) -> TokenStream { let name = &ast.ident; + let generics = &ast.generics; + let (impl_generics, ty_generics, where_clause) = generics.split_for_impl(); + let gen = quote! { - impl notan::app::AppState for #name {} + impl #impl_generics notan::app::AppState for #name #ty_generics #where_clause {} }; gen.into() } diff --git a/crates/notan_math/Cargo.toml b/crates/notan_math/Cargo.toml index 28a69668..3b77ed50 100644 --- a/crates/notan_math/Cargo.toml +++ b/crates/notan_math/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_math" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,8 +12,8 @@ description = "Provides simple set of math's utils for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -glam = { version = "0.22.0", features = ["scalar-math", "bytemuck"] } -serde = { version = "1", optional = true, features = ["serde_derive"] } +glam = { version = "0.24.0", features = ["bytemuck"] } +serde = { workspace = true, optional = true } [features] serde = ["dep:serde", "glam/serde"] diff --git a/crates/notan_math/src/lib.rs b/crates/notan_math/src/lib.rs index 81a9fe91..57637052 100644 --- a/crates/notan_math/src/lib.rs +++ b/crates/notan_math/src/lib.rs @@ -1,7 +1,4 @@ mod rect; -mod utils; - -pub use rect::*; pub use glam::*; -pub use utils::*; +pub use rect::*; diff --git a/crates/notan_math/src/utils.rs b/crates/notan_math/src/utils.rs deleted file mode 100644 index e78569c8..00000000 --- a/crates/notan_math/src/utils.rs +++ /dev/null @@ -1,28 +0,0 @@ -/// Returns a local position from screen -#[inline] -#[deprecated] -#[doc(hidden)] -pub fn mat3_screen_to_local(x: f32, y: f32, m: glam::Mat3) -> glam::Vec2 { - let inverse = m.inverse(); - let v = inverse * glam::vec3(x, y, 1.0); - glam::vec2(v.x, v.y) -} - -/// Returns a screen position from local -#[inline] -#[deprecated] -#[doc(hidden)] -pub fn mat3_local_to_screen(x: f32, y: f32, m: glam::Mat3) -> glam::Vec2 { - let v = m * glam::vec3(x, y, 1.0); - glam::vec2(v.x, v.y) -} - -/// Returns a local position from another local -#[inline] -#[deprecated] -#[doc(hidden)] -#[allow(deprecated)] -pub fn mat3_local_to_local(x: f32, y: f32, from: glam::Mat3, to: glam::Mat3) -> glam::Vec2 { - let from_point = mat3_local_to_screen(x, y, from); - mat3_screen_to_local(from_point.x, from_point.y, to) -} diff --git a/crates/notan_oddio/Cargo.toml b/crates/notan_oddio/Cargo.toml index e104a3d3..4d056741 100644 --- a/crates/notan_oddio/Cargo.toml +++ b/crates/notan_oddio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_oddio" -version = "0.9.5" +version = "0.10.0" edition = "2021" readme = "README.md" homepage = "https://github.com/Nazariglez/notan" @@ -9,9 +9,11 @@ license = "MIT OR Apache-2.0" description = "Provides support for Audio features using Oddio" [dependencies] -log = "0.4.17" -hashbrown = "0.13.2" -notan_audio = { path = "../notan_audio", version = "0.9.5" } -cpal = { version = "0.14.2", features = ["wasm-bindgen"] } +notan_audio.workspace = true + +log.workspace = true +hashbrown.workspace = true + +cpal = { version = "0.15.2", features = ["wasm-bindgen"] } oddio = "0.6.2" symphonia = { version = "0.5.2", features = ["mp3"] } diff --git a/crates/notan_oddio/src/backend.rs b/crates/notan_oddio/src/backend.rs index 75baa053..6e0bad43 100644 --- a/crates/notan_oddio/src/backend.rs +++ b/crates/notan_oddio/src/backend.rs @@ -241,6 +241,7 @@ impl InnerBackend { |err| { log::error!("{:?}", err); }, + None, ) .map_err(|e| format!("{e:?}"))?; @@ -367,7 +368,7 @@ impl InnerBackend { self.sounds.remove(id); }); - log::debug!( + log::trace!( "Audio resources cleaned: Sources({:?}) - Sounds({:?})", sources, sounds, diff --git a/crates/notan_oddio/src/decoder.rs b/crates/notan_oddio/src/decoder.rs index d9ab8573..51a2b164 100644 --- a/crates/notan_oddio/src/decoder.rs +++ b/crates/notan_oddio/src/decoder.rs @@ -43,7 +43,13 @@ fn decode_bytes(bytes: Vec) -> Result<(Vec, u32), String> { .codec_params() .sample_rate .ok_or_else(|| "Cannot get sample rate".to_string())?; - let samples = get_samples(&mut decoder, &mut format, track_id)?; + + let is_stereo = decoder + .codec_params() + .channels + .map_or(false, |ch| ch.count() == 2); + + let samples = get_samples(&mut decoder, &mut format, track_id, is_stereo)?; Ok((samples, sample_rate)) } @@ -51,6 +57,7 @@ fn get_samples( decoder: &mut Box, format: &mut Box, track_id: u32, + is_stereo: bool, ) -> Result, String> { let mut samples = vec![]; loop { @@ -76,9 +83,33 @@ fn get_samples( }; } + // duplicate mono samples to make it stereo? + if !is_stereo { + mono_to_stereo(&mut samples); + } + Ok(samples) } +fn mono_to_stereo(samples: &mut Vec) { + let original_len = samples.len(); + samples.resize(original_len * 2, 0.0); + + let mut write_idx = samples.len() - 1; + let mut read_idx = original_len - 1; + + while read_idx > 0 { + samples[write_idx] = samples[read_idx]; + samples[write_idx - 1] = samples[read_idx]; + + write_idx -= 2; + read_idx -= 1; + } + + samples[write_idx] = samples[read_idx]; + samples[write_idx - 1] = samples[read_idx]; +} + fn decode_packet( samples: &mut Vec, decoder: &mut Box, diff --git a/crates/notan_random/Cargo.toml b/crates/notan_random/Cargo.toml index 3710bc2d..e6d108a5 100644 --- a/crates/notan_random/Cargo.toml +++ b/crates/notan_random/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_random" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -16,4 +16,4 @@ rand = "0.8.5" rand_pcg = "0.3.1" [target.'cfg(target_arch = "wasm32")'.dependencies] -getrandom = { version = "0.2.8", features = ["js"] } +getrandom = { version = "0.2.9", features = ["js"] } diff --git a/crates/notan_random/src/utils.rs b/crates/notan_random/src/utils.rs index 72530e67..b6398180 100644 --- a/crates/notan_random/src/utils.rs +++ b/crates/notan_random/src/utils.rs @@ -4,6 +4,7 @@ use rand_pcg::Pcg32; use std::ops::{Deref, DerefMut}; /// Wrapper around a random generator based on Pcg32. +#[derive(Clone)] pub struct Random { rng: Pcg32, } diff --git a/crates/notan_text/Cargo.toml b/crates/notan_text/Cargo.toml index 0ab31b09..2f3cef6f 100644 --- a/crates/notan_text/Cargo.toml +++ b/crates/notan_text/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_text" -version = "0.9.5" +version = "0.10.0" edition = "2021" readme = "README.md" homepage = "https://github.com/Nazariglez/notan" @@ -11,11 +11,17 @@ description = "Provides a simple Text API for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -notan_app = { path = "../notan_app", version = "0.9.5" } -notan_graphics = { path = "../notan_graphics", version = "0.9.5" } -notan_glyph = { path = "../notan_glyph", version = "0.9.5" } -notan_math = { path = "../notan_math", version = "0.9.5" } -log = "0.4.17" +notan_app.workspace = true +notan_graphics.workspace = true +notan_glyph.workspace = true +notan_math.workspace = true + +log.workspace = true +parking_lot.workspace = true +hashbrown.workspace = true + lazy_static = "1.4.0" -parking_lot = "0.12.1" -hashbrown = "0.13.2" + +[features] +glsl-to-spirv = ["notan_glyph/glsl-to-spirv"] +shaderc = ["notan_glyph/shaderc"] diff --git a/crates/notan_text/src/lib.rs b/crates/notan_text/src/lib.rs index 9ceeac61..f737f4cd 100644 --- a/crates/notan_text/src/lib.rs +++ b/crates/notan_text/src/lib.rs @@ -299,8 +299,8 @@ impl Drop for ChainTextBuilder<'_, '_> { // get minX, minY, maxX, maxY for sections here... pub struct Text<'a> { - pub(crate) width: i32, - pub(crate) height: i32, + pub(crate) width: u32, + pub(crate) height: u32, pub(crate) sections: Vec>, pub(crate) pipeline_type: Option, pub(crate) clear_options: Option, @@ -310,7 +310,7 @@ pub struct Text<'a> { } impl<'a> Text<'a> { - pub fn new(width: i32, height: i32) -> Self { + pub fn new(width: u32, height: u32) -> Self { Self { sections: vec![], width, diff --git a/crates/notan_utils/Cargo.toml b/crates/notan_utils/Cargo.toml index a1ed113c..c81c0e21 100644 --- a/crates/notan_utils/Cargo.toml +++ b/crates/notan_utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_utils" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -13,12 +13,13 @@ description = "Provides a simple set of utils Notan" [dependencies] instant = { version = "0.1.12", features = ["wasm-bindgen"] } -log = "0.4.17" +log.workspace = true [target.'cfg(target_arch = "wasm32")'.dependencies] -wasm-bindgen = { version = "0.2.83", optional = true } -js-sys = { version = "0.3.60", optional = true } -web-sys = { version = "0.3.60", optional = true } +wasm-bindgen = { workspace = true, optional = true } +js-sys = { workspace = true, optional = true } +web-sys = { workspace = true, optional = true } + mime_guess = { version = "2.0.4", optional = true } [features] diff --git a/crates/notan_web/Cargo.toml b/crates/notan_web/Cargo.toml index 8d7820de..304d2201 100644 --- a/crates/notan_web/Cargo.toml +++ b/crates/notan_web/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_web" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,21 +12,23 @@ description = "Provides a web/wasm32 backend for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -log = "0.4.17" -wasm-bindgen = "0.2.83" -js-sys = "0.3.60" -wasm-bindgen-futures = "0.4.33" +notan_core.workspace = true +notan_app.workspace = true +notan_glow.workspace = true +notan_graphics.workspace = true +notan_audio = { workspace = true, optional = true } +notan_oddio = { workspace = true, optional = true } + +log.workspace = true +wasm-bindgen.workspace = true +js-sys.workspace = true +wasm-bindgen-futures.workspace = true +futures-util.workspace = true + console_error_panic_hook = "0.1.7" -futures-util = "0.3.25" -notan_core = { path = "../notan_core", version = "0.9.5" } -notan_app = { path = "../notan_app", version = "0.9.5" } -notan_glow = { path = "../notan_glow", version = "0.9.5" } -notan_graphics = { path = "../notan_graphics", version = "0.9.5" } -notan_audio = { path = "../notan_audio", version = "0.9.5", optional = true } -notan_oddio = { path = "../notan_oddio", version = "0.9.5", optional = true } [dependencies.web-sys] -version = "0.3.60" +workspace = true features = [ "Screen", "Document", diff --git a/crates/notan_web/src/mouse.rs b/crates/notan_web/src/mouse.rs index 0da94957..36b6a160 100644 --- a/crates/notan_web/src/mouse.rs +++ b/crates/notan_web/src/mouse.rs @@ -88,6 +88,7 @@ pub fn enable_mouse( &mut last_x.borrow_mut(), &mut last_y.borrow_mut(), ); + let _ = canvas.focus(); add_evt_down(Event::MouseDown { button, x, y }); }, )?); diff --git a/crates/notan_web/src/utils.rs b/crates/notan_web/src/utils.rs index a853f41a..126e1198 100644 --- a/crates/notan_web/src/utils.rs +++ b/crates/notan_web/src/utils.rs @@ -2,7 +2,7 @@ use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys::{Document, HtmlCanvasElement, Window}; -pub fn set_size_dpi(canvas: &HtmlCanvasElement, width: i32, height: i32) { +pub fn set_size_dpi(canvas: &HtmlCanvasElement, width: u32, height: u32) { let auto_res = canvas .get_attribute("notan-auto-res") .unwrap_or_else(|| "false".to_string()) @@ -69,6 +69,14 @@ pub fn get_or_create_canvas(doc: &Document, canvas_id: &str) -> Result (i32, i32) { +pub fn get_notan_size(canvas: &HtmlCanvasElement) -> (u32, u32) { let width = canvas .get_attribute("notan-width") .unwrap_or_else(|| "0".to_string()) - .parse::() + .parse::() .unwrap_or(0); let height = canvas .get_attribute("notan-height") .unwrap_or_else(|| "0".to_string()) - .parse::() + .parse::() .unwrap_or(0); (width, height) diff --git a/crates/notan_web/src/window.rs b/crates/notan_web/src/window.rs index 1e373a6c..9568818e 100644 --- a/crates/notan_web/src/window.rs +++ b/crates/notan_web/src/window.rs @@ -36,11 +36,11 @@ pub struct WebWindowBackend { events: Rc>, fullscreen_requested: Rc>>, - fullscreen_last_size: Rc>>, + fullscreen_last_size: Rc>>, fullscreen_callback_ref: Option>, - min_size: Option<(i32, i32)>, - max_size: Option<(i32, i32)>, + min_size: Option<(u32, u32)>, + max_size: Option<(u32, u32)>, resize_callback_ref: Option>, _context_menu_callback_ref: Closure, @@ -98,6 +98,8 @@ impl WebWindowBackend { e.prevent_default(); })?; + let _ = canvas.focus(); + let fullscreen_requested = Rc::new(RefCell::new(None)); let fullscreen_last_size = Rc::new(RefCell::new(None)); let fullscreen_callback_ref = None; @@ -193,8 +195,8 @@ impl WebWindowBackend { let (ww, hh) = if self.config.maximized { ( - self.canvas_parent.client_width(), - self.canvas_parent.client_height(), + self.canvas_parent.client_width() as _, + self.canvas_parent.client_height() as _, ) } else { (self.config.width, self.config.height) @@ -262,6 +264,12 @@ impl WindowBackend for WebWindowBackend { *self.captured.borrow() } + fn container_size(&self) -> (i32, i32) { + let width = self.canvas_parent.client_width(); + let height = self.canvas_parent.client_height(); + (width, height) + } + fn cursor(&self) -> CursorIcon { self.cursor } @@ -291,6 +299,19 @@ impl WindowBackend for WebWindowBackend { *self.lazy.borrow() } + fn is_focused(&self) -> bool { + self.document + .has_focus() + .ok() + .unwrap_or(false) + .then(|| { + self.document + .active_element() + .map_or(false, |el| el.id() == self.canvas.id()) + }) + .unwrap_or(false) + } + // No operation, as unsupported in browser fn mouse_passthrough(&mut self) -> bool { false @@ -317,12 +338,6 @@ impl WindowBackend for WebWindowBackend { (width, height) } - fn container_size(&self) -> (i32, i32) { - let width = self.canvas_parent.client_width(); - let height = self.canvas_parent.client_height(); - (width, height) - } - // No operation, as unsupported in browser fn set_always_on_top(&mut self, _enabled: bool) {} @@ -348,6 +363,9 @@ impl WindowBackend for WebWindowBackend { } } + // No operation, as unsupported in browser + fn set_cursor_position(&mut self, _x: f32, _y: f32) {} + fn set_fullscreen(&mut self, enabled: bool) { *self.fullscreen_requested.borrow_mut() = Some(enabled); } @@ -369,7 +387,7 @@ impl WindowBackend for WebWindowBackend { // No operation, as unsupported in browser fn set_position(&mut self, _x: i32, _y: i32) {} - fn set_size(&mut self, width: i32, height: i32) { + fn set_size(&mut self, width: u32, height: u32) { set_size_dpi(&self.canvas, width as _, height as _); self.config.width = width; self.config.height = height; @@ -382,7 +400,7 @@ impl WindowBackend for WebWindowBackend { } } - fn size(&self) -> (i32, i32) { + fn size(&self) -> (u32, u32) { get_notan_size(&self.canvas) } @@ -419,7 +437,7 @@ fn enable_fullscreen(win: &mut WebWindowBackend) -> Result<(), String> { win.fullscreen_callback_ref = Some(window_add_event_listener("fullscreenchange", move |_| { let (width, height) = if document.fullscreen() { - (canvas.client_width(), canvas.client_height()) + (canvas.client_width() as _, canvas.client_height() as _) } else { match *last_size.borrow() { Some(size) => size, @@ -449,8 +467,8 @@ fn fullscreen_dispatcher_callback(win: &mut WebWindowBackend) -> Rc Result<(), String> { let max_size = win.max_size; let add_event = win.add_event_fn(); win.resize_callback_ref = Some(window_add_event_listener("resize", move |_| { - let mut p_width = parent.client_width(); - let mut p_height = parent.client_height(); + let mut p_width = parent.client_width() as _; + let mut p_height = parent.client_height() as _; if let Some((w, h)) = min_size { if p_width < w { @@ -500,7 +518,7 @@ fn enable_resize(win: &mut WebWindowBackend) -> Result<(), String> { } } - set_size_dpi(&canvas, p_width as _, p_height as _); + set_size_dpi(&canvas, p_width, p_height); add_event(Event::WindowResize { width: p_width, height: p_height, diff --git a/crates/notan_winit/Cargo.toml b/crates/notan_winit/Cargo.toml index 0bf7fa96..640470c7 100644 --- a/crates/notan_winit/Cargo.toml +++ b/crates/notan_winit/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notan_winit" -version = "0.9.5" +version = "0.10.0" authors = ["Nazarí González "] edition = "2021" readme = "README.md" @@ -12,21 +12,23 @@ description = "Provides a native backend using winit for Notan" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -log = "0.4.17" -notan_core = { path = "../notan_core", version = "0.9.5" } -notan_app = { path = "../notan_app", version = "0.9.5" } -notan_glow = { path = "../notan_glow", version = "0.9.5" } -notan_audio = { path = "../notan_audio", version = "0.9.5", optional = true } -notan_oddio = { path = "../notan_oddio", version = "0.9.5", optional = true } -notan_input = { path = "../notan_input", version = "0.9.5", optional = true } -glutin = "0.30.3" -glutin-winit = "0.2.1" -winit = "0.27.5" -raw-window-handle = "0.5.0" +notan_core.workspace = true +notan_app.workspace = true +notan_glow.workspace = true +notan_audio = { workspace = true, optional = true } +notan_oddio = { workspace = true, optional = true } +notan_input = { workspace = true, optional = true } + +image.workspace = true +log.workspace = true + +glutin = "0.30.8" +glutin-winit = "0.3.0" +winit = "0.28.6" +raw-window-handle = "0.5.2" arboard = { version = "3.2.0", optional = true, default-features = false } -webbrowser = { version = "0.8.4", optional = true } +webbrowser = { version = "0.8.10", optional = true } mime_guess = { version = "2.0.4", optional = true } -image = { version = "0.24.5", default-features = false, features = ["jpeg", "png", "ico"] } [features] audio = ["notan_app/audio", "notan_audio", "notan_oddio"] diff --git a/crates/notan_winit/src/backend.rs b/crates/notan_winit/src/backend.rs index 8fa65060..8f7cc941 100644 --- a/crates/notan_winit/src/backend.rs +++ b/crates/notan_winit/src/backend.rs @@ -279,6 +279,11 @@ impl BackendSystem for WinitBackend { WEvent::RedrawEventsCleared => { request_redraw = false; } + WEvent::DeviceEvent { ref event, .. } => { + if let Some(evt) = mouse::process_device_events(event) { + add_event(b, &mut request_redraw, evt); + } + } _ => {} } diff --git a/crates/notan_winit/src/gl_manager.rs b/crates/notan_winit/src/gl_manager.rs index 945ee0cd..da4ac8de 100644 --- a/crates/notan_winit/src/gl_manager.rs +++ b/crates/notan_winit/src/gl_manager.rs @@ -48,32 +48,32 @@ impl GlManager { .with_window_builder(Some(builder)) .build(event_loop, template, |configs| { let mut support: Option = None; - configs.into_iter().for_each(|new_conf| match &support { - Some(GlSupport::Full(conf)) => { - let is = check_support(needs_transparency, conf, &new_conf); - if is.full_support && is.more_samples { - support = Some(GlSupport::Full(new_conf)); + configs.into_iter().for_each(|conf| match &support { + Some(GlSupport::Full(_)) => { + let is = check_support(config.multisampling, needs_transparency, &conf); + if is.full_support && is.req_samples { + support = Some(GlSupport::Full(conf)); } } - Some(GlSupport::Srgba(conf)) => { - let is = check_support(needs_transparency, conf, &new_conf); + Some(GlSupport::Srgba(_)) => { + let is = check_support(config.multisampling, needs_transparency, &conf); if is.full_support { - support = Some(GlSupport::Full(new_conf)); - } else if is.srgb && is.more_samples { - support = Some(GlSupport::Srgba(new_conf)); + support = Some(GlSupport::Full(conf)); + } else if is.srgb && is.req_samples { + support = Some(GlSupport::Srgba(conf)); } } - Some(GlSupport::Any(conf)) => { - let is = check_support(needs_transparency, conf, &new_conf); + Some(GlSupport::Any(_)) => { + let is = check_support(config.multisampling, needs_transparency, &conf); if is.full_support { - support = Some(GlSupport::Full(new_conf)); + support = Some(GlSupport::Full(conf)); } else if is.srgb { - support = Some(GlSupport::Srgba(new_conf)); - } else if is.more_samples { - support = Some(GlSupport::Any(new_conf)); + support = Some(GlSupport::Srgba(conf)); + } else if is.req_samples { + support = Some(GlSupport::Any(conf)); } } - None => support = Some(GlSupport::Any(new_conf)), + None => support = Some(GlSupport::Any(conf)), }); match support { @@ -199,19 +199,15 @@ impl GlManager { } struct InnerSupport { - more_samples: bool, + req_samples: bool, srgb: bool, full_support: bool, } -fn check_support( - needs_transparency: bool, - current_conf: &GConfig, - new_conf: &GConfig, -) -> InnerSupport { - let more_samples = new_conf.num_samples() > current_conf.num_samples(); - let srgb = new_conf.srgb_capable(); - let supports_transparency = new_conf.supports_transparency().unwrap_or(false); +fn check_support(required_samples: u8, needs_transparency: bool, conf: &GConfig) -> InnerSupport { + let req_samples = conf.num_samples() == required_samples; + let srgb = conf.srgb_capable(); + let supports_transparency = conf.supports_transparency().unwrap_or(false); let transparency = if needs_transparency { supports_transparency } else { @@ -220,7 +216,7 @@ fn check_support( let full_support = srgb && transparency; InnerSupport { - more_samples, + req_samples, srgb, full_support, } diff --git a/crates/notan_winit/src/mouse.rs b/crates/notan_winit/src/mouse.rs index 9a4998fd..0e0fd4c7 100644 --- a/crates/notan_winit/src/mouse.rs +++ b/crates/notan_winit/src/mouse.rs @@ -3,7 +3,7 @@ use winit::dpi::LogicalPosition; use notan_core::events::Event; use notan_core::mouse::MouseButton; use winit::event::ElementState; -use winit::event::{MouseButton as WMouseButton, MouseScrollDelta, WindowEvent}; +use winit::event::{DeviceEvent, MouseButton as WMouseButton, MouseScrollDelta, WindowEvent}; pub fn process_events( event: &WindowEvent, @@ -61,6 +61,14 @@ pub fn process_events( *my = position.y as _; Some(Event::MouseMove { x: *mx, y: *my }) } + + _ => None, + } +} + +pub fn process_device_events(event: &DeviceEvent) -> Option { + match event { + DeviceEvent::MouseMotion { delta } => Some(Event::MouseMotion { delta: *delta }), _ => None, } } diff --git a/crates/notan_winit/src/window.rs b/crates/notan_winit/src/window.rs index 2a136e68..0e1215e9 100644 --- a/crates/notan_winit/src/window.rs +++ b/crates/notan_winit/src/window.rs @@ -3,10 +3,12 @@ use std::path::PathBuf; use crate::gl_manager::GlManager; use notan_app::WindowConfig; use notan_app::{CursorIcon, WindowBackend}; -use winit::dpi::{LogicalSize, PhysicalPosition}; +use winit::dpi::{LogicalPosition, LogicalSize, PhysicalPosition}; use winit::event_loop::EventLoop; use winit::window::Fullscreen::Borderless; -use winit::window::{CursorGrabMode, CursorIcon as WCursorIcon, Icon, Window, WindowBuilder}; +use winit::window::{ + CursorGrabMode, CursorIcon as WCursorIcon, Icon, Window, WindowBuilder, WindowLevel, +}; pub struct WinitWindowBackend { pub(crate) gl_manager: GlManager, @@ -51,6 +53,10 @@ impl WindowBackend for WinitWindowBackend { self.window().fullscreen().is_some() } + fn is_focused(&self) -> bool { + self.window().has_focus() + } + fn lazy_loop(&self) -> bool { self.lazy } @@ -81,7 +87,12 @@ impl WindowBackend for WinitWindowBackend { } fn set_always_on_top(&mut self, enabled: bool) { - self.window().set_always_on_top(enabled); + let level = if enabled { + WindowLevel::AlwaysOnTop + } else { + WindowLevel::Normal + }; + self.window().set_window_level(level); self.is_always_on_top = enabled; } @@ -122,6 +133,20 @@ impl WindowBackend for WinitWindowBackend { } } + fn set_cursor_position(&mut self, x: f32, y: f32) { + if let Err(e) = self + .window() + .set_cursor_position(LogicalPosition::new(x, y)) + { + log::error!( + "Error setting mouse cursor position to x: {0} y: {1} error: {2}", + x, + y, + e + ); + } + } + fn set_fullscreen(&mut self, enabled: bool) { if enabled { let monitor = self.window().current_monitor(); @@ -148,7 +173,7 @@ impl WindowBackend for WinitWindowBackend { .set_outer_position(PhysicalPosition::new(x, y)); } - fn set_size(&mut self, width: i32, height: i32) { + fn set_size(&mut self, width: u32, height: u32) { self.window() .set_inner_size(LogicalSize::new(width, height)); } @@ -160,7 +185,7 @@ impl WindowBackend for WinitWindowBackend { } } - fn size(&self) -> (i32, i32) { + fn size(&self) -> (u32, u32) { let inner = self.window().inner_size(); let logical = inner.to_logical::(self.scale_factor); (logical.width as _, logical.height as _) @@ -227,13 +252,18 @@ fn load_icon_from_data(data: &'static [u8]) -> Icon { impl WinitWindowBackend { pub(crate) fn new(config: WindowConfig, event_loop: &EventLoop<()>) -> Result { + let level = if config.always_on_top { + WindowLevel::AlwaysOnTop + } else { + WindowLevel::Normal + }; let mut builder = WindowBuilder::new() .with_title(&config.title) .with_inner_size(LogicalSize::new(config.width, config.height)) .with_maximized(config.maximized) .with_resizable(config.resizable) .with_transparent(config.transparent) - .with_always_on_top(config.always_on_top) + .with_window_level(level) .with_visible(config.visible) .with_decorations(config.decorations) .with_window_icon(load_icon( @@ -264,6 +294,22 @@ impl WinitWindowBackend { builder = builder.with_max_inner_size(LogicalSize::new(w, h)); } + if let Some((x, y)) = config.position { + let safe_x = x; + let safe_y = y; + + // This is already done by the OS in Linux/MacOS + #[cfg(windows)] + let (safe_x, safe_y) = { + let clamped_position = + clamp_window_to_sane_position(config.width, config.height, x, y, &event_loop); + + (clamped_position.0, clamped_position.1) + }; + + builder = builder.with_position(LogicalPosition::new(safe_x as f64, safe_y as f64)); + } + let gl_manager = GlManager::new(builder, event_loop, &config)?; // Try setting vsync. @@ -360,3 +406,65 @@ fn winit_cursor(cursor: CursorIcon) -> Option { CursorIcon::ResizeRow => WCursorIcon::RowResize, }) } + +#[cfg(windows)] +fn clamp_window_to_sane_position( + width: u32, + height: u32, + x: i32, + y: i32, + event_loop: &EventLoop<()>, +) -> (i32, i32) { + let monitors = event_loop.available_monitors(); + // default to primary monitor, in case the correct monitor was disconnected. + let mut active_monitor = if let Some(active_monitor) = event_loop + .primary_monitor() + .or_else(|| event_loop.available_monitors().next()) + { + active_monitor + } else { + return (x, y); // no monitors 🤷 + }; + + for monitor in monitors { + let monitor_x_range = (monitor.position().x - width as i32) + ..(monitor.position().x + monitor.size().width as i32); + let monitor_y_range = (monitor.position().y - height as i32) + ..(monitor.position().y + monitor.size().height as i32); + + if monitor_x_range.contains(&x) && monitor_y_range.contains(&y) { + active_monitor = monitor; + } + } + + let mut inner_size_pixels = ( + width as f32 * active_monitor.scale_factor() as f32, + height as f32 * active_monitor.scale_factor() as f32, + ); + + // Add size of title bar. This is 32 px by default in Win 10/11. + if cfg!(target_os = "windows") { + inner_size_pixels.1 += 32.0 * active_monitor.scale_factor() as f32; + } + + let monitor_position = ( + active_monitor.position().x as f32, + active_monitor.position().y as f32, + ); + + let monitor_size = active_monitor.size(); + + // To get the maximum position, we get the rightmost corner of the display, then subtract + // the size of the window to get the bottom right most value window.position can have. + + let clamped_x = x.clamp( + monitor_position.0 as i32, + monitor_position.0 as i32 + monitor_size.width as i32 - inner_size_pixels.0 as i32, + ); + let clamped_y = y.clamp( + monitor_position.1 as i32, + monitor_position.1 as i32 + monitor_size.height as i32 - inner_size_pixels.1 as i32, + ); + + (clamped_x, clamped_y) +} diff --git a/examples/audio_basic.rs b/examples/audio_basic.rs index 8db9b5f4..df464135 100644 --- a/examples/audio_basic.rs +++ b/examples/audio_basic.rs @@ -62,7 +62,7 @@ fn set_volume(index: usize, app: &mut App, state: &mut State) { fn main() -> Result<(), String> { notan::init_with(setup) .add_config(EguiConfig) - .add_config(WindowConfig::default().size(300, 300)) + .add_config(WindowConfig::default().set_size(300, 300)) .draw(draw) .build() } diff --git a/examples/draw_animation_list.rs b/examples/draw_animation_list.rs index 3a17fab9..9176557f 100644 --- a/examples/draw_animation_list.rs +++ b/examples/draw_animation_list.rs @@ -47,10 +47,10 @@ fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { // An animation list take a &[&Texture] as frames draw.animation_list(&state.textures.iter().collect::>()) - // just a matrix translation - .translate(300.0, 200.0) // just a matrix scale .scale(2.0, 2.0) + // just a matrix translation + .translate(300.0, 200.0) // normalized frame time .time(state.time); diff --git a/examples/draw_blend_mode_object.rs b/examples/draw_blend_mode_object.rs index 1ebc28f4..a5f9756e 100644 --- a/examples/draw_blend_mode_object.rs +++ b/examples/draw_blend_mode_object.rs @@ -72,8 +72,8 @@ fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { // Draw image with a custom blend mode draw.image(&state.texture) - .translate(xx, yy) .scale(scale, scale) + .translate(xx, yy) .blend_mode(*mode); // print names diff --git a/examples/draw_bunnymark.rs b/examples/draw_bunnymark.rs index ba5862e5..9e8a0fbc 100644 --- a/examples/draw_bunnymark.rs +++ b/examples/draw_bunnymark.rs @@ -107,7 +107,7 @@ fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { #[notan_main] fn main() -> Result<(), String> { notan::init_with(init) - .add_config(WindowConfig::new().vsync(true)) + .add_config(WindowConfig::new().set_vsync(true)) .add_config(DrawConfig) .update(update) .draw(draw) diff --git a/examples/draw_mask_animated.rs b/examples/draw_mask_animated.rs index e71a5fb5..0b78e469 100644 --- a/examples/draw_mask_animated.rs +++ b/examples/draw_mask_animated.rs @@ -2,13 +2,13 @@ use notan::{draw::*, prelude::*}; fn main() { notan::init() - .add_config(WindowConfig::new().size(500, 500)) + .add_config(WindowConfig::new().set_size(500, 500)) .add_config(DrawConfig) .draw(|app: &mut App, gfx: &mut Graphics| { let mut draw = gfx.create_draw(); draw.clear(Color::BLACK); - let elapsed = app.timer.time_since_init(); + let elapsed = app.timer.elapsed_f32(); let pulse_progress = ((elapsed % 4.) - 2.).abs() / 2.; // 4s roundtrip pulse let radius = 200. * (1. - pulse_progress); diff --git a/examples/draw_path_flower.rs b/examples/draw_path_flower.rs index eb8fa544..a19d802c 100644 --- a/examples/draw_path_flower.rs +++ b/examples/draw_path_flower.rs @@ -17,14 +17,14 @@ const PI: f32 = std::f32::consts::PI; #[notan_main] fn main() -> Result<(), String> { notan::init() - .add_config(WindowConfig::new().multisampling(8)) + .add_config(WindowConfig::new().set_multisampling(8)) .add_config(DrawConfig) .draw(draw) .build() } fn draw(app: &mut App, gfx: &mut Graphics) { - let time = app.timer.time_since_init() * 1000.0; + let time = app.timer.elapsed_f32() * 1000.0; let mut draw = gfx.create_draw(); draw.clear(Color::BLACK); diff --git a/examples/draw_projection.rs b/examples/draw_projection.rs index 9f1f1a5e..798576cd 100644 --- a/examples/draw_projection.rs +++ b/examples/draw_projection.rs @@ -8,7 +8,7 @@ const WORK_SIZE: Vec2 = vec2(800.0, 600.0); #[notan_main] fn main() -> Result<(), String> { - let win_config = WindowConfig::default().resizable(true); + let win_config = WindowConfig::default().set_resizable(true); notan::init() .add_config(win_config) diff --git a/examples/draw_transform_local.rs b/examples/draw_transform_local.rs index d095e123..08d1168d 100644 --- a/examples/draw_transform_local.rs +++ b/examples/draw_transform_local.rs @@ -27,17 +27,17 @@ fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { draw.rect((0.0, 0.0), (100.0, 100.0)) .color(Color::AQUA) - // Matrix translation - .translate(220.0, 220.0) // Helper to pivot from a point using degrees - .rotate_degrees_from((50.0, 50.0), state.rot); + .rotate_degrees_from((50.0, 50.0), state.rot) + // Matrix translation + .translate(220.0, 220.0); draw.circle(20.0) .color(Color::ORANGE) - // Matrix translation - .translate(500.0, 320.0) // Helper to scale from a point - .scale_from((0.0, 0.0), (2.0 + n.sin(), 2.0 + n.cos())); + .scale_from((0.0, 0.0), (2.0 + n.sin(), 2.0 + n.cos())) + // Matrix translation + .translate(500.0, 320.0); // Create a matrix that we can set to the next paint let translation = Mat3::from_translation(Vec2::new(200.0, 400.0)); diff --git a/examples/egui_basic.rs b/examples/egui_basic.rs index d3f24d85..43e48e78 100644 --- a/examples/egui_basic.rs +++ b/examples/egui_basic.rs @@ -4,9 +4,9 @@ use notan::prelude::*; #[notan_main] fn main() -> Result<(), String> { let win = WindowConfig::new() - .vsync(true) - .lazy_loop(true) - .high_dpi(true); + .set_vsync(true) + .set_lazy_loop(true) + .set_high_dpi(true); notan::init() .add_config(win) diff --git a/examples/egui_custom_font.rs b/examples/egui_custom_font.rs index 77a880ea..1e68b2d9 100644 --- a/examples/egui_custom_font.rs +++ b/examples/egui_custom_font.rs @@ -4,9 +4,9 @@ use notan::prelude::*; #[notan_main] fn main() -> Result<(), String> { let win = WindowConfig::new() - .vsync(true) - .lazy_loop(true) - .high_dpi(true); + .set_vsync(true) + .set_lazy_loop(true) + .set_high_dpi(true); notan::init() .add_config(win) diff --git a/examples/egui_demo.rs b/examples/egui_demo.rs index a61f831e..c9370787 100644 --- a/examples/egui_demo.rs +++ b/examples/egui_demo.rs @@ -9,12 +9,12 @@ struct State { #[notan_main] fn main() -> Result<(), String> { let win = WindowConfig::default() - .resizable(true) - .size(1280, 1024) - .vsync(true) - .high_dpi(true) + .set_resizable(true) + .set_size(1280, 1024) + .set_vsync(true) + .set_high_dpi(true) // enable lazy mode to only draw after an input - .lazy_loop(true); + .set_lazy_loop(true); notan::init_with(State::default) .add_config(win) diff --git a/examples/egui_paint.rs b/examples/egui_paint.rs index 1cd61d20..aec36b9e 100644 --- a/examples/egui_paint.rs +++ b/examples/egui_paint.rs @@ -19,9 +19,9 @@ impl State { #[notan_main] fn main() -> Result<(), String> { let win = WindowConfig::default() - .lazy_loop(true) - .vsync(true) - .high_dpi(true); + .set_lazy_loop(true) + .set_vsync(true) + .set_high_dpi(true); notan::init_with(State::new) .add_config(win) .add_config(EguiConfig) diff --git a/examples/egui_render_texture.rs b/examples/egui_render_texture.rs index 5dcdd472..30f89885 100644 --- a/examples/egui_render_texture.rs +++ b/examples/egui_render_texture.rs @@ -35,7 +35,7 @@ impl State { #[notan_main] fn main() -> Result<(), String> { notan::init_with(State::new) - .add_config(WindowConfig::new().vsync(true).high_dpi(true)) + .add_config(WindowConfig::new().set_vsync(true).set_high_dpi(true)) .add_config(EguiConfig) .draw(draw) .build() @@ -203,7 +203,7 @@ impl Cube { gfx.set_buffer_data(&self.uniform_buffer, &rotated_matrix(self.mvp, self.angle)); let mut renderer = gfx.create_renderer(); - renderer.begin(Some(&ClearOptions { + renderer.begin(Some(ClearOptions { color: Some(Color::new(0.1, 0.2, 0.3, 1.0)), depth: Some(1.0), ..Default::default() diff --git a/examples/egui_shape_widget.rs b/examples/egui_shape_widget.rs index 8255f46a..aac0e66c 100644 --- a/examples/egui_shape_widget.rs +++ b/examples/egui_shape_widget.rs @@ -2,8 +2,8 @@ use notan::draw::*; use notan::egui::{self, *}; use notan::prelude::*; -const WIDTH: i32 = 1200; -const HEIGHT: i32 = 800; +const WIDTH: u32 = 1200; +const HEIGHT: u32 = 800; #[derive(AppState)] struct State { @@ -33,11 +33,11 @@ impl Default for State { #[notan_main] fn main() -> Result<(), String> { let win_config = WindowConfig::new() - .size(WIDTH, HEIGHT) - .multisampling(8) - .lazy_loop(true) - .vsync(true) - .high_dpi(true); + .set_size(WIDTH, HEIGHT) + .set_multisampling(8) + .set_lazy_loop(true) + .set_vsync(true) + .set_high_dpi(true); notan::init_with(State::default) .add_config(win_config) @@ -77,8 +77,8 @@ fn draw_shape(draw: &mut Draw, state: &mut State) { let center_y = (a.1 + b.1 + c.1) / 3.0; draw.triangle(a, b, c) - .translate(width * 0.5 - center_x, height * 0.5 - center_y) .rotate_degrees_from((center_x, center_y), state.rotation) + .translate(width * 0.5 - center_x, height * 0.5 - center_y) .skew(state.skew_x, state.skew_y) .color_vertex(state.color.0, state.color.1, state.color.2); } diff --git a/examples/game_15_puzzle.rs b/examples/game_15_puzzle.rs index 6ab35132..ae51530e 100644 --- a/examples/game_15_puzzle.rs +++ b/examples/game_15_puzzle.rs @@ -13,8 +13,8 @@ const OUTLINE_COLOR: Color = Color::from_rgb(0.0, 0.8, 0.7); #[notan_main] fn main() -> Result<(), String> { let win = WindowConfig::default() - .size(BOARD_SIZE as _, BOARD_SIZE as _) - .multisampling(8); + .set_size(BOARD_SIZE as _, BOARD_SIZE as _) + .set_multisampling(8); notan::init_with(State::new) .add_config(win) diff --git a/examples/game_of_life.rs b/examples/game_of_life.rs index aae9eac2..d7bc4100 100644 --- a/examples/game_of_life.rs +++ b/examples/game_of_life.rs @@ -63,7 +63,7 @@ fn main() -> Result<(), String> { let width = WIDTH * 4; let height = HEIGHT * 4; - let win_config = WindowConfig::new().size(width as _, height as _); + let win_config = WindowConfig::new().set_size(width as _, height as _); notan::init_with(setup) .initialize(init) diff --git a/examples/game_pong.rs b/examples/game_pong.rs index 276b45d3..42a58336 100644 --- a/examples/game_pong.rs +++ b/examples/game_pong.rs @@ -1,8 +1,8 @@ use notan::draw::*; use notan::prelude::*; -const WIDTH: i32 = 800; -const HEIGHT: i32 = 580; +const WIDTH: u32 = 800; +const HEIGHT: u32 = 580; const WALL_SIZE: f32 = 20.0; const PADDLE_WIDTH: f32 = 30.0; const PADDLE_HEIGHT: f32 = PADDLE_WIDTH * 4.0; @@ -15,7 +15,7 @@ const PI: f32 = std::f32::consts::PI; #[notan_main] fn main() -> Result<(), String> { - let win_config = WindowConfig::new().size(WIDTH, HEIGHT).vsync(true); + let win_config = WindowConfig::new().set_size(WIDTH, HEIGHT).set_vsync(true); notan::init_with(State::new) .add_config(win_config) @@ -109,7 +109,7 @@ fn draw(gfx: &mut Graphics, state: &mut State) { draw.rect((0.0, 0.0), (width, WALL_SIZE)); draw.rect((0.0, height - WALL_SIZE), (width, WALL_SIZE)); - let points = HEIGHT / WALL_SIZE as i32; + let points = HEIGHT / WALL_SIZE as u32; for i in (0..points).step_by(2) { draw.rect( (width * 0.5 - WALL_SIZE * 0.5, WALL_SIZE * i as f32), diff --git a/examples/game_snake.rs b/examples/game_snake.rs index b408ea86..228677d0 100644 --- a/examples/game_snake.rs +++ b/examples/game_snake.rs @@ -12,7 +12,7 @@ const MIN_MOVEMENT_MS: f32 = 0.02; #[notan_main] fn main() -> Result<(), String> { - let win_config = WindowConfig::new().size(800, 600).vsync(true); + let win_config = WindowConfig::new().set_size(800, 600).set_vsync(true); notan::init_with(State::new) .add_config(win_config) diff --git a/examples/game_tetris.rs b/examples/game_tetris.rs index abdad6ec..ce64eab3 100644 --- a/examples/game_tetris.rs +++ b/examples/game_tetris.rs @@ -11,7 +11,9 @@ const ACCELERATION_BY_LINE: f32 = 0.02; #[notan_main] fn main() -> Result<(), String> { - let win_config = WindowConfig::new().size(500, TILE_SIZE * ROWS).vsync(true); + let win_config = WindowConfig::new() + .set_size(500, (TILE_SIZE * ROWS) as _) + .set_vsync(true); notan::init_with(State::new) .add_config(win_config) @@ -457,7 +459,7 @@ fn index(x: i32, y: i32) -> usize { fn create_texture(gfx: &mut Graphics) -> Texture { let rt = gfx - .create_render_texture(TILE_SIZE, TILE_SIZE) + .create_render_texture(TILE_SIZE as _, TILE_SIZE as _) .build() .unwrap(); diff --git a/examples/game_tic_tac_toe.rs b/examples/game_tic_tac_toe.rs index bd59ffd1..00949921 100644 --- a/examples/game_tic_tac_toe.rs +++ b/examples/game_tic_tac_toe.rs @@ -70,9 +70,9 @@ impl State { fn main() -> Result<(), String> { let win = WindowConfig::default() - .multisampling(8) - .size(WIDTH as _, HEIGHT as _) - .vsync(true); + .set_multisampling(8) + .set_size(WIDTH as _, HEIGHT as _) + .set_vsync(true); notan::init_with(State::new) .add_config(win) diff --git a/examples/input_mouse_local_position.rs b/examples/input_mouse_local_position.rs index 8ff889f2..ca4a8914 100644 --- a/examples/input_mouse_local_position.rs +++ b/examples/input_mouse_local_position.rs @@ -27,8 +27,8 @@ fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { let mut rect = draw.rect((0.0, 0.0), size); // set the rectangle's transformation - rect.translate(200.0, 150.0) - .rotate_from((size.0 * 0.5, size.1 * 0.5), state.rot); + rect.rotate_from((size.0 * 0.5, size.1 * 0.5), state.rot) + .translate(200.0, 150.0); // get the local position based on the current projection + matrix let local = rect.screen_to_local_position(app.mouse.x, app.mouse.y); diff --git a/examples/input_mouse_wheel.rs b/examples/input_mouse_wheel.rs index 3ea59d4b..5415197d 100644 --- a/examples/input_mouse_wheel.rs +++ b/examples/input_mouse_wheel.rs @@ -1,4 +1,3 @@ -use notan::app::Event; use notan::draw::*; use notan::prelude::*; @@ -13,7 +12,7 @@ struct State { fn main() -> Result<(), String> { notan::init_with(setup) .add_config(DrawConfig) - .event(event) + .update(update) .draw(draw) .build() } @@ -30,13 +29,13 @@ fn setup(gfx: &mut Graphics) -> State { } } -fn event(state: &mut State, evt: Event) { - match evt { - Event::MouseWheel { delta_x, delta_y } => { - state.x = (state.x + delta_x).max(0.0).min(800.0); - state.y = (state.y + delta_y).max(0.0).min(600.0); - } - _ => {} +fn update(app: &mut App, state: &mut State) { + if app.mouse.is_scrolling() { + let delta_x = app.mouse.wheel_delta.x; + let delta_y = app.mouse.wheel_delta.y; + + state.x = (state.x + delta_x).max(0.0).min(800.0); + state.y = (state.y + delta_y).max(0.0).min(600.0); } } diff --git a/examples/renderer_clear.rs b/examples/renderer_clear.rs index 465cc862..d848b518 100644 --- a/examples/renderer_clear.rs +++ b/examples/renderer_clear.rs @@ -8,8 +8,8 @@ fn main() -> Result<(), String> { fn draw(app: &mut App, gfx: &mut Graphics) { // "Random" color bases on the app's time let color = Color::from_rgb( - app.timer.time_since_init().cos(), - app.timer.time_since_init().sin(), + app.timer.elapsed_f32().cos(), + app.timer.elapsed_f32().sin(), 1.0, ); @@ -17,7 +17,7 @@ fn draw(app: &mut App, gfx: &mut Graphics) { let mut renderer = gfx.create_renderer(); // begin a pass to clear the screen - renderer.begin(Some(&ClearOptions::color(color))); + renderer.begin(Some(ClearOptions::color(color))); renderer.end(); // render to screen diff --git a/examples/renderer_cube.rs b/examples/renderer_cube.rs index 91632999..bd915ede 100644 --- a/examples/renderer_cube.rs +++ b/examples/renderer_cube.rs @@ -162,7 +162,7 @@ fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { gfx.set_buffer_data(&state.ubo, &rotated_matrix(state.mvp, state.angle)); - renderer.begin(Some(&state.clear_options)); + renderer.begin(Some(state.clear_options)); renderer.set_pipeline(&state.pipeline); renderer.bind_buffers(&[&state.vbo, &state.ebo, &state.ubo]); renderer.draw(0, 36); diff --git a/examples/renderer_instancing.rs b/examples/renderer_instancing.rs index cd3a7678..fa2cd8c7 100644 --- a/examples/renderer_instancing.rs +++ b/examples/renderer_instancing.rs @@ -95,7 +95,7 @@ fn setup(gfx: &mut Graphics) -> State { fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { // Renderer pass as usual but instead of .draw uses .draw_instanced let mut renderer = gfx.create_renderer(); - renderer.begin(Some(&ClearOptions::color(Color::BLACK))); + renderer.begin(Some(ClearOptions::color(Color::BLACK))); renderer.set_pipeline(&state.pipeline); renderer.bind_buffers(&[&state.vbo, &state.ubo]); renderer.draw_instanced(0, 3, INSTANCES as _); diff --git a/examples/renderer_instancing_cubes.rs b/examples/renderer_instancing_cubes.rs index 14245039..3407077d 100644 --- a/examples/renderer_instancing_cubes.rs +++ b/examples/renderer_instancing_cubes.rs @@ -143,7 +143,6 @@ fn setup(gfx: &mut Graphics) -> State { // Generate 1 color per cube let mut rng = Random::default(); let colors = (0..INSTANCES) - .into_iter() .flat_map(|_| { [ rng.gen_range(0.0..1.0), @@ -207,7 +206,7 @@ fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { gfx.set_buffer_data(&state.ubo, &rotated_matrix(state.mvp, state.angle)); - renderer.begin(Some(&state.clear_options)); + renderer.begin(Some(state.clear_options)); renderer.set_pipeline(&state.pipeline); renderer.bind_buffers(&[&state.ubo, &state.pos_vbo, &state.color_vbo, &state.ebo]); renderer.draw_instanced(0, 36, INSTANCES as _); diff --git a/examples/renderer_postprocess.rs b/examples/renderer_postprocess.rs index 44706374..8cd31256 100644 --- a/examples/renderer_postprocess.rs +++ b/examples/renderer_postprocess.rs @@ -10,7 +10,7 @@ struct State { #[notan_main] fn main() -> Result<(), String> { notan::init_with(setup) - .add_config(WindowConfig::default().vsync(true)) + .add_config(WindowConfig::default().set_vsync(true)) .draw(draw) .build() } @@ -90,7 +90,7 @@ struct PostProcessTarget { } impl PostProcessTarget { - fn new(gfx: &mut Graphics, width: i32, height: i32) -> Self { + fn new(gfx: &mut Graphics, width: u32, height: u32) -> Self { let render_texture = gfx .create_render_texture(width, height) .with_depth() @@ -165,7 +165,7 @@ impl PostProcessTarget { let mut renderer = gfx.create_renderer(); - renderer.begin(Some(&ClearOptions::none())); + renderer.begin(Some(ClearOptions::none())); renderer.set_pipeline(&self.pipeline); renderer.bind_texture(0, &self.render_texture); renderer.bind_buffers(&[ @@ -327,7 +327,7 @@ impl Cube { gfx.set_buffer_data(&self.uniform_buffer, &rotated_matrix(self.mvp, self.angle)); let mut renderer = gfx.create_renderer(); - renderer.begin(Some(&ClearOptions { + renderer.begin(Some(ClearOptions { color: Some(Color::new(0.1, 0.2, 0.3, 1.0)), depth: Some(1.0), ..Default::default() diff --git a/examples/renderer_quad.rs b/examples/renderer_quad.rs index ee67d691..96f035e2 100644 --- a/examples/renderer_quad.rs +++ b/examples/renderer_quad.rs @@ -92,7 +92,7 @@ fn setup(gfx: &mut Graphics) -> State { fn draw(gfx: &mut Graphics, state: &mut State) { let mut renderer = gfx.create_renderer(); - renderer.begin(Some(&state.clear_options)); + renderer.begin(Some(state.clear_options)); renderer.set_pipeline(&state.pipeline); renderer.bind_buffers(&[&state.vertex_buffer, &state.index_buffer]); renderer.draw(0, 6); diff --git a/examples/renderer_quad_wireframe.rs b/examples/renderer_quad_wireframe.rs index a9ef0507..42cd1832 100644 --- a/examples/renderer_quad_wireframe.rs +++ b/examples/renderer_quad_wireframe.rs @@ -84,7 +84,7 @@ fn setup(gfx: &mut Graphics) -> State { fn draw(gfx: &mut Graphics, state: &mut State) { let mut renderer = gfx.create_renderer(); - renderer.begin(Some(&ClearOptions::color(Color::BLACK))); + renderer.begin(Some(ClearOptions::color(Color::BLACK))); renderer.set_pipeline(&state.pipeline); renderer.set_primitive(DrawPrimitive::LineStrip); renderer.bind_buffers(&[&state.vertex_buffer, &state.index_buffer]); diff --git a/examples/renderer_render_texture.rs b/examples/renderer_render_texture.rs index f229988f..85e7a5b0 100644 --- a/examples/renderer_render_texture.rs +++ b/examples/renderer_render_texture.rs @@ -70,7 +70,7 @@ fn setup(gfx: &mut Graphics) -> State { .build() .unwrap(); - let (width, height) = (texture.width() as i32, texture.height() as i32); + let (width, height) = (texture.width() as _, texture.height() as _); let render_texture = gfx.create_render_texture(width, height).build().unwrap(); let render_texture2 = gfx.create_render_texture(width, height).build().unwrap(); @@ -154,7 +154,7 @@ fn render_texture( ) -> Renderer { let mut renderer = gfx.create_renderer(); - renderer.begin(Some(&ClearOptions { + renderer.begin(Some(ClearOptions { color: clear_color, ..Default::default() })); diff --git a/examples/renderer_stencil.rs b/examples/renderer_stencil.rs new file mode 100644 index 00000000..d99a10ef --- /dev/null +++ b/examples/renderer_stencil.rs @@ -0,0 +1,173 @@ +use notan::prelude::*; + +const VERT: ShaderSource = notan::vertex_shader! { + r#" + #version 450 + layout(location = 0) in vec2 a_pos; + layout(location = 1) in vec3 a_color; + + layout(location = 0) out vec3 v_color; + + void main() { + v_color = a_color; + gl_Position = vec4(a_pos - 0.5, 0.0, 1.0); + } + "# +}; + +const FRAG: ShaderSource = notan::fragment_shader! { + r#" + #version 450 + precision mediump float; + + layout(location = 0) in vec3 v_color; + layout(location = 0) out vec4 color; + + void main() { + color = vec4(v_color, 1.0); + } + "# +}; + +#[derive(AppState)] +struct State { + clear_options: ClearOptions, + mask_pipeline: Pipeline, + pipeline: Pipeline, + mask_vbo: Buffer, + vbo: Buffer, +} + +#[notan_main] +fn main() -> Result<(), String> { + notan::init_with(setup).draw(draw).build() +} + +fn setup(gfx: &mut Graphics) -> State { + let clear_options = ClearOptions { + color: Some(Color::new(0.1, 0.2, 0.3, 1.0)), + depth: None, + stencil: Some(0), + }; + + let vertex_info = VertexInfo::new() + .attr(0, VertexFormat::Float32x2) + .attr(1, VertexFormat::Float32x3); + + let stencil_maks_opts = StencilOptions { + stencil_fail: StencilAction::Keep, + depth_fail: StencilAction::Keep, + pass: StencilAction::Replace, + compare: CompareMode::Always, + read_mask: 0xff, + write_mask: 0xff, + reference: 1, + }; + + let mask_pipeline = gfx + .create_pipeline() + .from(&VERT, &FRAG) + .with_vertex_info(&vertex_info) + .with_stencil(stencil_maks_opts) + .build() + .unwrap(); + + let stencil_opts = StencilOptions { + stencil_fail: StencilAction::Keep, + depth_fail: StencilAction::Keep, + pass: StencilAction::Keep, + compare: CompareMode::Equal, + read_mask: 0xff, + write_mask: 0x00, + reference: 1, + }; + + let pipeline = gfx + .create_pipeline() + .from(&VERT, &FRAG) + .with_vertex_info(&vertex_info) + .with_stencil(stencil_opts) + .build() + .unwrap(); + + // masking vertices + #[rustfmt::skip] + let mask_vertices = [ + 0.5, 1.35, 1.0, 1.0, 1.0, + 0.25, 0.85, 1.0, 1.0, 1.0, + 0.75, 0.85, 1.0, 1.0, 1.0, + + 0.75, 0.85, 1.0, 1.0, 1.0, + 0.5, 0.35, 1.0, 1.0, 1.0, + 1.0, 0.35, 1.0, 1.0, 1.0, + + 0.25, 0.85, 1.0, 1.0, 1.0, + 0.0, 0.35, 1.0, 1.0, 1.0, + 0.5, 0.35, 1.0, 1.0, 1.0, + + 0.5, 0.35, 1.0, 1.0, 1.0, + 0.25, -0.15, 1.0, 1.0, 1.0, + 0.75, -0.15, 1.0, 1.0, 1.0, + + 1.0, 0.35, 1.0, 1.0, 1.0, + 0.75, -0.15, 1.0, 1.0, 1.0, + 1.25, -0.15, 1.0, 1.0, 1.0, + + 0.0, 0.35, 1.0, 1.0, 1.0, + -0.25, -0.15, 1.0, 1.0, 1.0, + 0.25, -0.15, 1.0, 1.0, 1.0, + ]; + + let mask_vbo = gfx + .create_vertex_buffer() + .with_info(&vertex_info) + .with_data(&mask_vertices) + .build() + .unwrap(); + + // triangle + #[rustfmt::skip] + let vertices = [ + 0.5, 1.0, 1.0, 0.2, 0.3, + 0.0, 0.0, 0.1, 1.0, 0.3, + 1.0, 0.0, 0.1, 0.2, 1.0, + ]; + + let vbo = gfx + .create_vertex_buffer() + .with_info(&vertex_info) + .with_data(&vertices) + .build() + .unwrap(); + + State { + clear_options, + mask_pipeline: mask_pipeline, + pipeline: pipeline, + mask_vbo: mask_vbo, + vbo: vbo, + } +} + +fn draw(gfx: &mut Graphics, state: &mut State) { + let mut renderer = gfx.create_renderer(); + + renderer.begin(Some(state.clear_options)); + + // Render the mask + renderer.set_pipeline(&state.mask_pipeline); + renderer.bind_buffer(&state.mask_vbo); + renderer.draw(0, 18); + + renderer.end(); + + // render the triangle + renderer.begin(None); + renderer.set_pipeline(&state.pipeline); + renderer.bind_buffer(&state.vbo); + renderer.draw(0, 3); + + renderer.end(); + + gfx.render(&renderer); +} diff --git a/examples/renderer_texture.rs b/examples/renderer_texture.rs index 25b0287d..2078d64f 100644 --- a/examples/renderer_texture.rs +++ b/examples/renderer_texture.rs @@ -110,7 +110,7 @@ fn setup(gfx: &mut Graphics) -> State { fn draw(gfx: &mut Graphics, state: &mut State) { let mut renderer = gfx.create_renderer(); - renderer.begin(Some(&state.clear_options)); + renderer.begin(Some(state.clear_options)); renderer.set_pipeline(&state.pipeline); renderer.bind_texture(0, &state.texture); renderer.bind_buffers(&[&state.vertex_buffer, &state.index_buffer]); diff --git a/examples/renderer_texture_r32.rs b/examples/renderer_texture_r32.rs index 5bdf62d4..d029054a 100644 --- a/examples/renderer_texture_r32.rs +++ b/examples/renderer_texture_r32.rs @@ -2,7 +2,7 @@ use notan::math::*; use notan::prelude::*; use std::ops::Rem; -const TEXTURE_SIZE: IVec2 = IVec2::new(10, 10); +const TEXTURE_SIZE: UVec2 = UVec2::new(10, 10); const TOTAL: usize = (TEXTURE_SIZE.x * TEXTURE_SIZE.y) as usize; //language=glsl @@ -55,7 +55,7 @@ struct State { #[notan_main] fn main() -> Result<(), String> { - let win_config = WindowConfig::new().size(400, 400).lazy_loop(true); + let win_config = WindowConfig::new().set_size(400, 400).set_lazy_loop(true); notan::init_with(setup) .add_config(win_config) @@ -131,7 +131,7 @@ fn setup(gfx: &mut Graphics) -> State { fn draw(gfx: &mut Graphics, state: &mut State) { let mut renderer = gfx.create_renderer(); - renderer.begin(Some(&state.clear_options)); + renderer.begin(Some(state.clear_options)); renderer.set_pipeline(&state.pipeline); renderer.bind_texture(0, &state.texture); renderer.bind_buffers(&[&state.vertex_buffer, &state.index_buffer]); diff --git a/examples/renderer_textured_cube.rs b/examples/renderer_textured_cube.rs index ff966b9c..033b08bf 100644 --- a/examples/renderer_textured_cube.rs +++ b/examples/renderer_textured_cube.rs @@ -166,7 +166,7 @@ fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { let vertices_count = 180; let count = vertices_count / state.pipeline.offset(); - renderer.begin(Some(&state.clear_options)); + renderer.begin(Some(state.clear_options)); renderer.set_pipeline(&state.pipeline); renderer.bind_buffers(&[&state.vertex_buffer, &state.uniform_buffer]); renderer.bind_texture(0, &state.texture); diff --git a/examples/renderer_triangle.rs b/examples/renderer_triangle.rs index da8d6c2e..23fdd92a 100644 --- a/examples/renderer_triangle.rs +++ b/examples/renderer_triangle.rs @@ -81,7 +81,7 @@ fn setup(gfx: &mut Graphics) -> State { fn draw(gfx: &mut Graphics, state: &mut State) { let mut renderer = gfx.create_renderer(); - renderer.begin(Some(&state.clear_options)); + renderer.begin(Some(state.clear_options)); renderer.set_pipeline(&state.pipeline); renderer.bind_buffer(&state.vbo); renderer.draw(0, 3); diff --git a/examples/renderer_uniform_std140.rs b/examples/renderer_uniform_std140.rs index 2a4e36d5..fc811e3b 100644 --- a/examples/renderer_uniform_std140.rs +++ b/examples/renderer_uniform_std140.rs @@ -249,7 +249,7 @@ fn setup(gfx: &mut Graphics) -> State { } fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { - let time = app.timer.time_since_init(); + let time = app.timer.elapsed_f32(); gfx.set_buffer_data(&state.transform_ubo, &Transform::with_view(time)); gfx.set_buffer_data(&state.light_ubo, &Light::with_time(time)); @@ -261,7 +261,7 @@ fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { stencil: None, }; - renderer.begin(Some(&clear)); + renderer.begin(Some(clear)); renderer.set_pipeline(&state.pipeline); renderer.bind_buffers(&[&state.vbo, &state.transform_ubo, &state.light_ubo]); diff --git a/examples/texture_params.rs b/examples/texture_params.rs new file mode 100644 index 00000000..060edc57 --- /dev/null +++ b/examples/texture_params.rs @@ -0,0 +1,231 @@ +// This example shows how to use texture params and mipmaps. + +use notan::draw::*; +use notan::prelude::*; + +const WINDOW_WIDTH: u32 = 1200; +const WINDOW_HEIGHT: u32 = 600; +const CELL_WIDTH: f32 = (WINDOW_WIDTH as f32) / 3.0; +const CELL_HEIGHT: f32 = (WINDOW_HEIGHT as f32) / 2.0; + +fn smoothstep(edge0: f32, edge1: f32, x: f32) -> f32 { + let x = f32::clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); + x * x * (3.0 - 2.0 * x) +} + +//language=glsl +const FRAGMENT: ShaderSource = notan::fragment_shader! { + r#" + #version 450 + precision mediump float; + + layout(location = 0) in vec2 v_uvs; + layout(location = 1) in vec4 v_color; + + layout(binding = 0) uniform sampler2D u_texture; + layout(set = 0, binding = 1) uniform TextureInfo { + float lod; + float offset; + float offset_dir; + }; + + layout(location = 0) out vec4 color; + + void main() { + vec2 uv_offset = vec2(1.0, offset_dir) * offset; + color = textureLod(u_texture, v_uvs + uv_offset, lod); + } +"# +}; + +#[derive(AppState)] +struct State { + texture1: Texture, + texture2: Texture, + texture3: Texture, + render_texture1: RenderTexture, + render_texture2: RenderTexture, + render_texture3: RenderTexture, + font: Font, + pipeline: Pipeline, + uniforms: Buffer, + + is_first_render: bool, +} + +#[notan_main] +fn main() -> Result<(), String> { + let window_config = WindowConfig::new().set_size(WINDOW_WIDTH, WINDOW_HEIGHT); + + notan::init_with(init) + .add_config(window_config) + .add_config(DrawConfig) + .draw(draw) + .build() +} + +fn init(gfx: &mut Graphics) -> State { + let font = gfx + .create_font(include_bytes!("assets/Ubuntu-B.ttf")) + .unwrap(); + + let ferris = include_bytes!("assets/ferris.png"); + + // Texture + let texture1 = gfx + .create_texture() + .from_image(ferris) + .with_premultiplied_alpha() + .build() + .unwrap(); + + // Texture w/ mipmap + let texture2 = gfx + .create_texture() + .from_image(ferris) + .with_premultiplied_alpha() + .with_filter(TextureFilter::Linear, TextureFilter::Linear) + .with_mipmaps(true) + .build() + .unwrap(); + + // Texture w/ mipmap & wrap + let texture3 = gfx + .create_texture() + .from_image(ferris) + .with_premultiplied_alpha() + .with_wrap(TextureWrap::Repeat, TextureWrap::Repeat) + .with_filter(TextureFilter::Linear, TextureFilter::Linear) + .with_mipmaps(true) + .build() + .unwrap(); + + let (width, height) = texture1.size(); + + // RenderTexture + let render_texture1 = gfx + .create_render_texture(width as u32, height as u32) + .with_format(TextureFormat::Rgba32) + .build() + .unwrap(); + + // RenderTexture w/ mipmap + let render_texture2 = gfx + .create_render_texture(width as u32, height as u32) + .with_format(TextureFormat::Rgba32) + .with_mipmaps(true) + .with_filter(TextureFilter::Linear, TextureFilter::Linear) + .build() + .unwrap(); + + // RenderTexture w/ mipmap & wrap + let render_texture3 = gfx + .create_render_texture(width as u32, height as u32) + .with_format(TextureFormat::Rgba32) + .with_mipmaps(true) + .with_filter(TextureFilter::Linear, TextureFilter::Linear) + .with_wrap(TextureWrap::Repeat, TextureWrap::Repeat) + .build() + .unwrap(); + + let pipeline = create_image_pipeline(gfx, Some(&FRAGMENT)).unwrap(); + let uniforms = gfx + .create_uniform_buffer(1, "TextureInfo") + .with_data(&[0.0]) + .build() + .unwrap(); + + State { + font, + + texture1, + texture2, + texture3, + + render_texture1, + render_texture2, + render_texture3, + + pipeline, + uniforms, + + is_first_render: true, + } +} + +fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { + if state.is_first_render { + // Copy the original texture content to the RenderTextures + for rt in [ + &state.render_texture1, + &state.render_texture2, + &state.render_texture3, + ] { + let mut draw = gfx.create_draw(); + draw.set_size(state.texture1.width(), state.texture1.height()); + draw.image(&state.texture1).blend_mode(BlendMode::NONE); + gfx.render_to(rt, &draw); + } + + state.is_first_render = false; + } + + // Update params + let time = app.timer.elapsed_f32(); + let lod = smoothstep(0.0, 1.0, f32::max(time.cos(), 0.0)) * 5.0; + let offset = smoothstep(0.0, 1.0, f32::max(-time.cos(), 0.0)) * 0.5; + + // Clear canvas + let mut draw = gfx.create_draw(); + draw.clear(Color::GRAY); + gfx.render(&draw); + + let cells = [ + (&state.texture1, "Texture"), + (&state.texture2, "Texture w/ mipmap"), + (&state.texture3, "Texture w/ mipmap & wrap"), + (&state.render_texture1, "RenderTexture"), + (&state.render_texture2, "RenderTexture w/ mipmap"), + (&state.render_texture3, "RenderTexture w/ mipmap & wrap"), + ]; + let scale = CELL_WIDTH / state.texture1.width(); + + // Render textures + for (i, (tex, label)) in cells.iter().enumerate() { + let x = (i % 3) as f32; + let y = (i / 3) as f32; + + let offset_dir = if tex.is_render_texture() { -1.0 } else { 1.0 }; + gfx.set_buffer_data(&state.uniforms, &[lod, offset, offset_dir]); + + let mut draw = gfx.create_draw(); + + draw.image_pipeline() + .pipeline(&state.pipeline) + .uniform_buffer(&state.uniforms); + + draw.image(tex) + .blend_mode(BlendMode::OVER) + .scale(scale, scale) + .translate(x * CELL_WIDTH, y * CELL_HEIGHT + 10.0); + + draw.text(&state.font, label) + .size(20.0) + .position(x * CELL_WIDTH + 10.0, y * CELL_HEIGHT + 10.0) + .color(Color::WHITE); + + gfx.render(&draw); + } + + // Show LOD and offset as text + let mut draw = gfx.create_draw(); + draw.text( + &state.font, + &format!("LOD: {:.2} / Offset: {:.2}", lod, offset), + ) + .size(20.0) + .position(10.0, WINDOW_HEIGHT as f32 - 30.0) + .color(Color::WHITE); + + gfx.render(&draw); +} diff --git a/examples/texture_to_file.rs b/examples/texture_to_file.rs index ac732b49..c0c6e842 100644 --- a/examples/texture_to_file.rs +++ b/examples/texture_to_file.rs @@ -117,7 +117,7 @@ impl State { #[notan_main] fn main() -> Result<(), String> { - let win_config = WindowConfig::default().vsync(true).lazy_loop(true); + let win_config = WindowConfig::default().set_vsync(true).set_lazy_loop(true); notan::init_with(State::new) .add_config(win_config) diff --git a/examples/window_config.rs b/examples/window_config.rs index fbe3d641..dbeb9e0e 100644 --- a/examples/window_config.rs +++ b/examples/window_config.rs @@ -6,13 +6,13 @@ use notan::prelude::*; fn main() -> Result<(), String> { // Check the documentation for more options let window_config = WindowConfig::new() - .title("Window Config Demo") - .size(1026, 600) // window's size - .vsync(true) // enable vsync - .resizable(true) // window can be resized - .min_size(600, 400) // Set a minimum window size - .window_icon(Some(PathBuf::from("./examples/assets/rust.ico"))) - .taskbar_icon(Some(PathBuf::from("./examples/assets/rust.ico"))); + .set_title("Window Config Demo") + .set_size(1026, 600) // window's size + .set_vsync(true) // enable vsync + .set_resizable(true) // window can be resized + .set_min_size(600, 400) // Set a minimum window size + .set_window_icon(Some(PathBuf::from("./examples/assets/rust.ico"))) + .set_taskbar_icon(Some(PathBuf::from("./examples/assets/rust.ico"))); notan::init().add_config(window_config).build() } diff --git a/examples/window_focus.rs b/examples/window_focus.rs new file mode 100644 index 00000000..87df8e9a --- /dev/null +++ b/examples/window_focus.rs @@ -0,0 +1,44 @@ +use notan::draw::*; +use notan::prelude::*; + +#[derive(AppState)] +struct State { + font: Font, +} + +#[notan_main] +fn main() -> Result<(), String> { + notan::init_with(setup) + .add_config(DrawConfig) + .draw(draw) + .build() +} + +fn setup(gfx: &mut Graphics) -> State { + let font = gfx + .create_font(include_bytes!("assets/Ubuntu-B.ttf")) + .unwrap(); + State { font } +} + +fn draw(app: &mut App, gfx: &mut Graphics, state: &mut State) { + let window = app.window(); + let ww = window.width() as f32; + let hh = window.height() as f32; + + let text = if window.is_focused() { + "Window is currently focused" + } else { + "Window is no longer focused" + }; + + let mut draw = gfx.create_draw(); + draw.clear(Color::BLACK); + draw.text(&state.font, text) + .position(ww * 0.5, hh * 0.5) + .size(40.0) + .h_align_center() + .v_align_middle(); + + gfx.render(&draw); +} diff --git a/examples/window_icon_from_raw.rs b/examples/window_icon_from_raw.rs index 0d36e021..6966065b 100644 --- a/examples/window_icon_from_raw.rs +++ b/examples/window_icon_from_raw.rs @@ -4,7 +4,7 @@ use notan::prelude::*; fn main() -> Result<(), String> { // Check the documentation for more options let window_config = WindowConfig::new() - .title("Window Icon Data Demo") + .set_title("Window Icon Data Demo") .set_window_icon_data(Some(include_bytes!("./assets/rust.ico"))) .set_taskbar_icon_data(Some(include_bytes!("./assets/rust.ico"))); diff --git a/examples/window_initial_position.rs b/examples/window_initial_position.rs new file mode 100644 index 00000000..0244e0cc --- /dev/null +++ b/examples/window_initial_position.rs @@ -0,0 +1,7 @@ +use notan::prelude::*; + +#[notan_main] +fn main() -> Result<(), String> { + let win = WindowConfig::default().set_position(100, 100); + notan::init().add_config(win).build() +} diff --git a/examples/window_transparent.rs b/examples/window_transparent.rs index 75e35a90..e27c85e2 100644 --- a/examples/window_transparent.rs +++ b/examples/window_transparent.rs @@ -3,7 +3,9 @@ use notan::prelude::*; #[notan_main] fn main() -> Result<(), String> { - let win = WindowConfig::default().transparent(true).decorations(false); + let win = WindowConfig::default() + .set_transparent(true) + .set_decorations(false); notan::init() .add_config(win) .add_config(DrawConfig) // Simple way to add the draw extension diff --git a/scripts/upgrade.sh b/scripts/upgrade.sh new file mode 100755 index 00000000..be92b40b --- /dev/null +++ b/scripts/upgrade.sh @@ -0,0 +1,13 @@ +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) + +for crate in crates/*; do + current="$SCRIPT_DIR/../$crate" + echo "$current" + cd $current + cargo upgrade +done + +current="$SCRIPT_DIR/../" +echo $current +cd $current +cargo upgrade