switch to winit 0.30 (not finished)

This commit is contained in:
Arkitu 2024-09-08 20:03:55 +02:00
parent 81e4cee845
commit 8269c11adc
5 changed files with 424 additions and 163 deletions

355
Cargo.lock generated
View File

@ -48,9 +48,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f"
[[package]] [[package]]
name = "android-activity" name = "android-activity"
version = "0.5.2" version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee91c0c2905bae44f84bfa4e044536541df26b7703fd0888deeb9060fcc44289" checksum = "ef6978589202a00cd7e118380c448a08b6ed394c3a8df3a430d0898e3a42d046"
dependencies = [ dependencies = [
"android-properties", "android-properties",
"bitflags 2.6.0", "bitflags 2.6.0",
@ -62,7 +62,7 @@ dependencies = [
"log", "log",
"ndk", "ndk",
"ndk-context", "ndk-context",
"ndk-sys", "ndk-sys 0.6.0+11769913",
"num_enum", "num_enum",
"thiserror", "thiserror",
] ]
@ -229,22 +229,12 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
[[package]]
name = "block-sys"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae85a0696e7ea3b835a453750bf002770776609115e6d25c6d2ff28a8200f7e7"
dependencies = [
"objc-sys",
]
[[package]] [[package]]
name = "block2" name = "block2"
version = "0.3.0" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15b55663a85f33501257357e6421bb33e769d5c9ffb5ba0921c975a123e35e68" checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
dependencies = [ dependencies = [
"block-sys",
"objc2", "objc2",
] ]
@ -256,9 +246,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]] [[package]]
name = "bytemuck" name = "bytemuck"
version = "1.17.0" version = "1.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae"
dependencies = [ dependencies = [
"bytemuck_derive", "bytemuck_derive",
] ]
@ -288,9 +278,9 @@ checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"
[[package]] [[package]]
name = "calloop" name = "calloop"
version = "0.12.4" version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fba7adb4dd5aa98e5553510223000e7148f621165ec5f9acd7113f6ca4995298" checksum = "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"log", "log",
@ -302,9 +292,9 @@ dependencies = [
[[package]] [[package]]
name = "calloop-wayland-source" name = "calloop-wayland-source"
version = "0.2.0" version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f0ea9b9476c7fad82841a8dbb380e2eae480c21910feba80725b46931ed8f02" checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"
dependencies = [ dependencies = [
"calloop", "calloop",
"rustix", "rustix",
@ -341,6 +331,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e"
[[package]]
name = "cfg_aliases"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]] [[package]]
name = "codespan-reporting" name = "codespan-reporting"
version = "0.11.1" version = "0.11.1"
@ -529,6 +525,12 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2"
[[package]]
name = "dpi"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53"
[[package]] [[package]]
name = "env_filter" name = "env_filter"
version = "0.1.2" version = "0.1.2"
@ -770,17 +772,6 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "icrate"
version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "99d3aaff8a54577104bafdf686ff18565c3b6903ca5782a2026ef06e2c7aa319"
dependencies = [
"block2",
"dispatch",
"objc2",
]
[[package]] [[package]]
name = "indexmap" name = "indexmap"
version = "2.4.0" version = "2.4.0"
@ -973,7 +964,7 @@ dependencies = [
"arrayvec", "arrayvec",
"bit-set", "bit-set",
"bitflags 2.6.0", "bitflags 2.6.0",
"cfg_aliases", "cfg_aliases 0.1.1",
"codespan-reporting", "codespan-reporting",
"hexf-parse", "hexf-parse",
"indexmap", "indexmap",
@ -1014,14 +1005,14 @@ dependencies = [
[[package]] [[package]]
name = "ndk" name = "ndk"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2076a31b7010b17a38c01907c45b945e8f11495ee4dd588309718901b1f7a5b7" checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"jni-sys", "jni-sys",
"log", "log",
"ndk-sys", "ndk-sys 0.6.0+11769913",
"num_enum", "num_enum",
"raw-window-handle 0.5.2", "raw-window-handle 0.5.2",
"raw-window-handle 0.6.2", "raw-window-handle 0.6.2",
@ -1043,6 +1034,15 @@ dependencies = [
"jni-sys", "jni-sys",
] ]
[[package]]
name = "ndk-sys"
version = "0.6.0+11769913"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873"
dependencies = [
"jni-sys",
]
[[package]] [[package]]
name = "noise" name = "noise"
version = "0.9.0" version = "0.9.0"
@ -1140,19 +1140,200 @@ checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"
[[package]] [[package]]
name = "objc2" name = "objc2"
version = "0.4.1" version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "559c5a40fdd30eb5e344fbceacf7595a81e242529fb4e21cf5f43fb4f11ff98d" checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804"
dependencies = [ dependencies = [
"objc-sys", "objc-sys",
"objc2-encode", "objc2-encode",
] ]
[[package]] [[package]]
name = "objc2-encode" name = "objc2-app-kit"
version = "3.0.0" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d079845b37af429bfe5dfa76e6d087d788031045b25cfc6fd898486fd9847666" checksum = "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff"
dependencies = [
"bitflags 2.6.0",
"block2",
"libc",
"objc2",
"objc2-core-data",
"objc2-core-image",
"objc2-foundation",
"objc2-quartz-core",
]
[[package]]
name = "objc2-cloud-kit"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009"
dependencies = [
"bitflags 2.6.0",
"block2",
"objc2",
"objc2-core-location",
"objc2-foundation",
]
[[package]]
name = "objc2-contacts"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889"
dependencies = [
"block2",
"objc2",
"objc2-foundation",
]
[[package]]
name = "objc2-core-data"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"
dependencies = [
"bitflags 2.6.0",
"block2",
"objc2",
"objc2-foundation",
]
[[package]]
name = "objc2-core-image"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"
dependencies = [
"block2",
"objc2",
"objc2-foundation",
"objc2-metal",
]
[[package]]
name = "objc2-core-location"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781"
dependencies = [
"block2",
"objc2",
"objc2-contacts",
"objc2-foundation",
]
[[package]]
name = "objc2-encode"
version = "4.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8"
[[package]]
name = "objc2-foundation"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
dependencies = [
"bitflags 2.6.0",
"block2",
"dispatch",
"libc",
"objc2",
]
[[package]]
name = "objc2-link-presentation"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398"
dependencies = [
"block2",
"objc2",
"objc2-app-kit",
"objc2-foundation",
]
[[package]]
name = "objc2-metal"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
dependencies = [
"bitflags 2.6.0",
"block2",
"objc2",
"objc2-foundation",
]
[[package]]
name = "objc2-quartz-core"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"
dependencies = [
"bitflags 2.6.0",
"block2",
"objc2",
"objc2-foundation",
"objc2-metal",
]
[[package]]
name = "objc2-symbols"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc"
dependencies = [
"objc2",
"objc2-foundation",
]
[[package]]
name = "objc2-ui-kit"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f"
dependencies = [
"bitflags 2.6.0",
"block2",
"objc2",
"objc2-cloud-kit",
"objc2-core-data",
"objc2-core-image",
"objc2-core-location",
"objc2-foundation",
"objc2-link-presentation",
"objc2-quartz-core",
"objc2-symbols",
"objc2-uniform-type-identifiers",
"objc2-user-notifications",
]
[[package]]
name = "objc2-uniform-type-identifiers"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe"
dependencies = [
"block2",
"objc2",
"objc2-foundation",
]
[[package]]
name = "objc2-user-notifications"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3"
dependencies = [
"bitflags 2.6.0",
"block2",
"objc2",
"objc2-core-location",
"objc2-foundation",
]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
@ -1213,6 +1394,26 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
[[package]]
name = "pin-project"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3"
dependencies = [
"pin-project-internal",
]
[[package]]
name = "pin-project-internal"
version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.75",
]
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-lite"
version = "0.2.14" version = "0.2.14"
@ -1366,15 +1567,6 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
[[package]]
name = "redox_syscall"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29"
dependencies = [
"bitflags 1.3.2",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.4.1" version = "0.4.1"
@ -1485,9 +1677,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]] [[package]]
name = "sctk-adwaita" name = "sctk-adwaita"
version = "0.8.3" version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70b31447ca297092c5a9916fc3b955203157b37c19ca8edde4f52e9843e602c7" checksum = "b6277f0217056f77f1d8f49f2950ac6c278c0d607c45f5ee99328d792ede24ec"
dependencies = [ dependencies = [
"ab_glyph", "ab_glyph",
"log", "log",
@ -1561,9 +1753,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
[[package]] [[package]]
name = "smithay-client-toolkit" name = "smithay-client-toolkit"
version = "0.18.1" version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "922fd3eeab3bd820d76537ce8f582b1cf951eceb5475c28500c7457d9d17f53a" checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"calloop", "calloop",
@ -1913,9 +2105,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-protocols" name = "wayland-protocols"
version = "0.31.2" version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f81f365b8b4a97f422ac0e8737c438024b5951734506b0e1d775c73030561f4" checksum = "62989625a776e827cc0f15d41444a3cea5205b963c3a25be48ae1b52d6b4daaa"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"wayland-backend", "wayland-backend",
@ -1925,9 +2117,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-protocols-plasma" name = "wayland-protocols-plasma"
version = "0.2.0" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23803551115ff9ea9bce586860c5c5a971e360825a0309264102a9495a5ff479" checksum = "f79f2d57c7fcc6ab4d602adba364bf59a5c24de57bd194486bf9b8360e06bfc4"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"wayland-backend", "wayland-backend",
@ -1938,9 +2130,9 @@ dependencies = [
[[package]] [[package]]
name = "wayland-protocols-wlr" name = "wayland-protocols-wlr"
version = "0.2.0" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad1f61b76b6c2d8742e10f9ba5c3737f6530b4c243132c2a2ccc8aa96fe25cd6" checksum = "fd993de54a40a40fbe5601d9f1fbcaef0aebcc5fda447d7dc8f6dcbaae4f8953"
dependencies = [ dependencies = [
"bitflags 2.6.0", "bitflags 2.6.0",
"wayland-backend", "wayland-backend",
@ -1984,9 +2176,9 @@ dependencies = [
[[package]] [[package]]
name = "web-time" name = "web-time"
version = "0.2.4" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb"
dependencies = [ dependencies = [
"js-sys", "js-sys",
"wasm-bindgen", "wasm-bindgen",
@ -1999,7 +2191,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1d1c4ba43f80542cf63a0a6ed3134629ae73e8ab51e4b765a67f3aa062eb433" checksum = "e1d1c4ba43f80542cf63a0a6ed3134629ae73e8ab51e4b765a67f3aa062eb433"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"cfg_aliases", "cfg_aliases 0.1.1",
"document-features", "document-features",
"js-sys", "js-sys",
"log", "log",
@ -2026,7 +2218,7 @@ dependencies = [
"arrayvec", "arrayvec",
"bit-vec", "bit-vec",
"bitflags 2.6.0", "bitflags 2.6.0",
"cfg_aliases", "cfg_aliases 0.1.1",
"document-features", "document-features",
"indexmap", "indexmap",
"log", "log",
@ -2054,7 +2246,7 @@ dependencies = [
"bit-set", "bit-set",
"bitflags 2.6.0", "bitflags 2.6.0",
"block", "block",
"cfg_aliases", "cfg_aliases 0.1.1",
"core-graphics-types", "core-graphics-types",
"d3d12", "d3d12",
"glow", "glow",
@ -2070,7 +2262,7 @@ dependencies = [
"log", "log",
"metal", "metal",
"naga", "naga",
"ndk-sys", "ndk-sys 0.5.0+25.2.9519653",
"objc", "objc",
"once_cell", "once_cell",
"parking_lot", "parking_lot",
@ -2173,15 +2365,6 @@ dependencies = [
"windows-targets 0.42.2", "windows-targets 0.42.2",
] ]
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets 0.48.5",
]
[[package]] [[package]]
name = "windows-sys" name = "windows-sys"
version = "0.52.0" version = "0.52.0"
@ -2380,38 +2563,42 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]] [[package]]
name = "winit" name = "winit"
version = "0.29.15" version = "0.30.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d59ad965a635657faf09c8f062badd885748428933dad8e8bdd64064d92e5ca" checksum = "0be9e76a1f1077e04a411f0b989cbd3c93339e1771cb41e71ac4aee95bfd2c67"
dependencies = [ dependencies = [
"ahash", "ahash",
"android-activity", "android-activity",
"atomic-waker", "atomic-waker",
"bitflags 2.6.0", "bitflags 2.6.0",
"block2",
"bytemuck", "bytemuck",
"calloop", "calloop",
"cfg_aliases", "cfg_aliases 0.2.1",
"concurrent-queue",
"core-foundation", "core-foundation",
"core-graphics", "core-graphics",
"cursor-icon", "cursor-icon",
"icrate", "dpi",
"js-sys", "js-sys",
"libc", "libc",
"log",
"memmap2", "memmap2",
"ndk", "ndk",
"ndk-sys",
"objc2", "objc2",
"once_cell", "objc2-app-kit",
"objc2-foundation",
"objc2-ui-kit",
"orbclient", "orbclient",
"percent-encoding", "percent-encoding",
"pin-project",
"raw-window-handle 0.5.2", "raw-window-handle 0.5.2",
"raw-window-handle 0.6.2", "raw-window-handle 0.6.2",
"redox_syscall 0.3.5", "redox_syscall 0.4.1",
"rustix", "rustix",
"sctk-adwaita", "sctk-adwaita",
"smithay-client-toolkit", "smithay-client-toolkit",
"smol_str", "smol_str",
"tracing",
"unicode-segmentation", "unicode-segmentation",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",
@ -2421,7 +2608,7 @@ dependencies = [
"wayland-protocols-plasma", "wayland-protocols-plasma",
"web-sys", "web-sys",
"web-time", "web-time",
"windows-sys 0.48.0", "windows-sys 0.52.0",
"x11-dl", "x11-dl",
"x11rb", "x11rb",
"xkbcommon-dl", "xkbcommon-dl",

View File

@ -15,13 +15,13 @@ package = "com.forestiles.arkitu"
build_targets = ["armv7-linux-androideabi", "aarch64-linux-android", "i686-linux-android", "x86_64-linux-android"] build_targets = ["armv7-linux-androideabi", "aarch64-linux-android", "i686-linux-android", "x86_64-linux-android"]
[dependencies] [dependencies]
winit = { version = "0.29", features = ["rwh_05", "android-native-activity"] } winit = { version = "0.30", features = ["rwh_05", "android-native-activity"] }
env_logger = "0.11" env_logger = "0.11"
log = "0.4" log = "0.4"
wgpu = "22.1" wgpu = "22.1"
cfg-if = "1" cfg-if = "1"
pollster = "0.3" pollster = "0.3"
bytemuck = { version = "1.17", features = [ "derive" ] } bytemuck = { version = "1.18", features = [ "derive" ] }
rand = { version = "0.8", features = ["small_rng"] } rand = { version = "0.8", features = ["small_rng"] }
nalgebra = "0.33" nalgebra = "0.33"
voronoice = "0.2" voronoice = "0.2"

View File

@ -1,3 +1,5 @@
use std::sync::Arc;
use bytemuck::{Pod, Zeroable}; use bytemuck::{Pod, Zeroable};
use wgpu::{include_wgsl, util::DeviceExt, BindGroup, Buffer, Device, Queue, RenderPipeline, Surface, SurfaceConfiguration, VertexBufferLayout}; use wgpu::{include_wgsl, util::DeviceExt, BindGroup, Buffer, Device, Queue, RenderPipeline, Surface, SurfaceConfiguration, VertexBufferLayout};
use winit::{event::{Event, WindowEvent}, window::Window}; use winit::{event::{Event, WindowEvent}, window::Window};
@ -47,16 +49,14 @@ pub struct Graphics<'a> {
uniforms_bind_group: BindGroup uniforms_bind_group: BindGroup
} }
impl<'a> Graphics<'a> { impl<'a> Graphics<'a> {
pub async fn init(app: &App<'a>) -> Self { pub async fn init(state: &State, window: Arc<Window>) -> Self {
let mut size = app.window.inner_size();
let instance = wgpu::Instance::new(wgpu::InstanceDescriptor { let instance = wgpu::Instance::new(wgpu::InstanceDescriptor {
backends: wgpu::Backends::PRIMARY, backends: wgpu::Backends::PRIMARY,
dx12_shader_compiler: Default::default(), dx12_shader_compiler: Default::default(),
..Default::default() ..Default::default()
}); });
let surface = instance.create_surface(app.window).unwrap(); let surface = instance.create_surface(window).unwrap();
let adapter = instance let adapter = instance
.request_adapter(&wgpu::RequestAdapterOptions { .request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::default(), power_preference: wgpu::PowerPreference::default(),
@ -86,19 +86,19 @@ impl<'a> Graphics<'a> {
let vertex_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { let vertex_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("Vertex Buffer"), label: Some("Vertex Buffer"),
contents: &[bytemuck::cast_slice::<Vertex, _>(&app.state.vertices), &[0; 100000]].concat(), contents: &[bytemuck::cast_slice::<Vertex, _>(&state.vertices), &[0; 100000]].concat(),
usage: wgpu::BufferUsages::VERTEX | wgpu::BufferUsages::COPY_DST, usage: wgpu::BufferUsages::VERTEX | wgpu::BufferUsages::COPY_DST,
}); });
let index_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { let index_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("Index Buffer"), label: Some("Index Buffer"),
contents: &[bytemuck::cast_slice::<u32, _>(&app.state.indices), &[0; 100000]].concat(), contents: &[bytemuck::cast_slice::<u32, _>(&state.indices), &[0; 100000]].concat(),
usage: wgpu::BufferUsages::INDEX | wgpu::BufferUsages::COPY_DST, usage: wgpu::BufferUsages::INDEX | wgpu::BufferUsages::COPY_DST,
}); });
let uniforms_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { let uniforms_buf = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: Some("Uniforms Buffer"), label: Some("Uniforms Buffer"),
contents: bytemuck::cast_slice(&[app.state.uniforms]), contents: bytemuck::cast_slice(&[state.uniforms]),
usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST, usage: wgpu::BufferUsages::UNIFORM | wgpu::BufferUsages::COPY_DST,
}); });
let uniforms_bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor { let uniforms_bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
@ -184,6 +184,19 @@ impl<'a> Graphics<'a> {
uniforms_bind_group uniforms_bind_group
} }
} }
pub fn window_event(&mut self, event: &WindowEvent, window: &Window) {
match event {
WindowEvent::Resized(new_size) => {
// Reconfigure the surface with the new size
self.surface_config.width = new_size.width;
self.surface_config.height = new_size.height;
self.surface.configure(&self.device, &self.surface_config);
// On macos the window needs to be redrawn manually after resizing
window.request_redraw();
},
_ => {}
}
}
pub fn event(&mut self, event: &Event<()>, window: &Window) { pub fn event(&mut self, event: &Event<()>, window: &Window) {
match event { match event {
Event::WindowEvent { Event::WindowEvent {

View File

@ -1,54 +1,118 @@
mod graphics; mod graphics;
mod state; mod state;
use std::sync::Arc;
use state::State; use state::State;
use graphics::Graphics; use graphics::Graphics;
use winit::{dpi::PhysicalSize, event::{Event, WindowEvent}, event_loop::EventLoop, window::Window}; use winit::{application::ApplicationHandler, dpi::PhysicalSize, event::{Event, WindowEvent}, event_loop::EventLoop, window::{Window, WindowAttributes}};
struct App<'a> { struct App<'a> {
// event_loop: EventLoop<()>, // event_loop: EventLoop<()>,
window: &'a Window, window: Option<Arc<Window>>,
graphics: Option<Graphics<'a>>, graphics: Option<Graphics<'a>>,
state: State state: State
} }
impl<'a> App<'a> { impl App<'_> {
fn run(&mut self, event_loop: EventLoop<()>) { fn new() -> Self {
dbg!("run"); Self {
event_loop.run(move |event, target| { window: None,
// dbg!(&event); graphics: None,
let _ = &self; state: State::new()
// let _ = (&graphics, &window, &state); }
match event {
Event::Resumed => {
// std::thread::sleep(Duration::from_secs(5));
self.graphics = Some(pollster::block_on(Graphics::init(&self)));
},
Event::WindowEvent {
event: WindowEvent::CloseRequested,
..
} => target.exit(),
Event::WindowEvent {
event: WindowEvent::RedrawRequested,
..
} => {
if let Some(g) = &mut self.graphics {
self.state.update_if_needed();
self.state.render(self.window.inner_size());
g.update(&self.state);
g.render(&self.state);
}
}
e => {
if let Some(g) = &mut self.graphics {
g.event(&e, &self.window);
}
self.state.event(&e, &self.window);
}
}
}).unwrap();
} }
} }
impl ApplicationHandler for App<'_> {
fn resumed(&mut self, event_loop: &winit::event_loop::ActiveEventLoop) {
#[cfg(not(any(target_family = "wasm", target_os = "android")))]
let window = event_loop.create_window(
WindowAttributes::default()
.with_inner_size(PhysicalSize::new(1080*2/5, 2000*2/5))
).unwrap();
self.window = Some(Arc::new(window));
self.graphics = Some(pollster::block_on(Graphics::init(&self.state, self.window.clone().unwrap())));
}
fn window_event(
&mut self,
event_loop: &winit::event_loop::ActiveEventLoop,
window_id: winit::window::WindowId,
event: WindowEvent,
) {
match event {
WindowEvent::CloseRequested => event_loop.exit(),
WindowEvent::RedrawRequested => {
if let Some(g) = &mut self.graphics {
self.state.update_if_needed();
self.state.render(self.window.as_ref().unwrap().inner_size());
g.update(&self.state);
g.render(&self.state);
}
},
WindowEvent::MouseWheel { delta, .. } => {
dbg!(delta);
},
e => {
if let Some(g) = &mut self.graphics {
g.window_event(&e, &self.window.as_ref().unwrap());
}
self.state.window_event(&e, &self.window.as_ref().unwrap());
}
}
}
fn device_event(
&mut self,
event_loop: &winit::event_loop::ActiveEventLoop,
device_id: winit::event::DeviceId,
event: winit::event::DeviceEvent,
) {
self.state.device_event(&event);
}
fn about_to_wait(&mut self, event_loop: &winit::event_loop::ActiveEventLoop) {
if let Some(window) = self.window.as_ref() {
window.request_redraw();
}
}
}
// impl<'a> App<'a> {
// fn run(&mut self, event_loop: EventLoop<()>) {
// dbg!("run");
// event_loop.run_app(move |event, target| {
// // dbg!(&event);
// let _ = &self;
// // let _ = (&graphics, &window, &state);
// match event {
// Event::Resumed => {
// // std::thread::sleep(Duration::from_secs(5));
// self.graphics = Some(pollster::block_on(Graphics::init(&self)));
// },
// Event::WindowEvent {
// event: WindowEvent::CloseRequested,
// ..
// } => target.exit(),
// Event::WindowEvent {
// event: WindowEvent::RedrawRequested,
// ..
// } => {
// if let Some(g) = &mut self.graphics {
// self.state.update_if_needed();
// self.state.render(self.window.inner_size());
// g.update(&self.state);
// g.render(&self.state);
// }
// }
// e => {
// if let Some(g) = &mut self.graphics {
// g.event(&e, &self.window);
// }
// self.state.event(&e, &self.window);
// }
// }
// }).unwrap();
// }
// }
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]
pub fn main() { pub fn main() {
// #[cfg(target_family = "wasm")] // #[cfg(target_family = "wasm")]
@ -70,30 +134,14 @@ pub fn main() {
// .unwrap(); // .unwrap();
// (event_loop, window) // (event_loop, window)
// }; // };
#[cfg(target_os = "android")] #[cfg(not(target_family = "wasm"))]
let (event_loop, window) = { let event_loop = {
use winit::platform::android::EventLoopBuilderExtAndroid;
let event_loop = winit::event_loop::EventLoopBuilder::new()
.with_android_app(app)
.build()
.unwrap();
let window = winit::window::WindowBuilder::new().build(&event_loop).unwrap();
(event_loop, window)
};
#[cfg(not(any(target_family = "wasm", target_os = "android")))]
let (event_loop, window) = {
env_logger::init(); env_logger::init();
let event_loop = winit::event_loop::EventLoop::new().unwrap(); winit::event_loop::EventLoop::new().unwrap()
let window = winit::window::WindowBuilder::new().build(&event_loop).unwrap();
(event_loop, window)
}; };
App { event_loop.run_app(&mut App::new()).unwrap();
window: &window,
graphics: None,
state: State::new()
}.run(event_loop);
// static mut graphics: Option<Graphics> = None; // static mut graphics: Option<Graphics> = None;
// event_loop.run(move |event, target| { // event_loop.run(move |event, target| {
@ -149,6 +197,7 @@ fn android_main(app: winit::platform::android::activity::AndroidApp) {
android_logger::init_once(android_logger::Config::default()); android_logger::init_once(android_logger::Config::default());
log::error!("testbbbbbbbbbbb"); log::error!("testbbbbbbbbbbb");
println!("coucou");
app.set_window_flags(WindowManagerFlags::KEEP_SCREEN_ON & WindowManagerFlags::FULLSCREEN, WindowManagerFlags::empty()); app.set_window_flags(WindowManagerFlags::KEEP_SCREEN_ON & WindowManagerFlags::FULLSCREEN, WindowManagerFlags::empty());

View File

@ -51,9 +51,9 @@ impl State {
s.render(PhysicalSize::new(1, 1)); s.render(PhysicalSize::new(1, 1));
s s
} }
pub fn event(&mut self, event: &Event<()>, window: &Window) { pub fn window_event(&mut self, event: &WindowEvent, window: &Window) {
match event { match event {
Event::WindowEvent { event: WindowEvent::MouseInput { state, button, ..}, ..} => { WindowEvent::MouseInput { state, button, ..} => {
if state.is_pressed() { if state.is_pressed() {
match button { match button {
MouseButton::Left => { MouseButton::Left => {
@ -73,7 +73,7 @@ impl State {
} }
} }
}, },
Event::WindowEvent { event: WindowEvent::CursorMoved { position, .. }, ..} => { WindowEvent::CursorMoved { position, .. } => {
let w_size = window.inner_size(); let w_size = window.inner_size();
dbg!(position); dbg!(position);
let pos = Point { let pos = Point {
@ -93,14 +93,7 @@ impl State {
self.selected_tile = c.iter_path(pos).last().unwrap(); self.selected_tile = c.iter_path(pos).last().unwrap();
} }
}, },
Event::DeviceEvent { event: DeviceEvent::MouseWheel { delta }, ..} => { WindowEvent::KeyboardInput { event: KeyEvent { physical_key: PhysicalKey::Code(kc), state, .. }, .. } => {
self.framerate -= match delta {
MouseScrollDelta::PixelDelta(pos) => pos.y as f32,
MouseScrollDelta::LineDelta(_, y) => *y
} * 0.1;
self.framerate = self.framerate.max(0.);
},
Event::WindowEvent { event: WindowEvent::KeyboardInput { event: KeyEvent { physical_key: PhysicalKey::Code(kc), state, .. }, .. }, .. } => {
if state.is_pressed() { if state.is_pressed() {
match kc { match kc {
KeyCode::KeyW => { KeyCode::KeyW => {
@ -130,6 +123,18 @@ impl State {
_ => {} _ => {}
} }
} }
pub fn device_event(&mut self, event: &DeviceEvent) {
match event {
DeviceEvent::MouseWheel { delta } => {
self.framerate -= match delta {
MouseScrollDelta::PixelDelta(pos) => pos.y as f32,
MouseScrollDelta::LineDelta(_, y) => *y
} * 0.1;
self.framerate = self.framerate.max(0.);
},
_ => {}
}
}
pub fn render(&mut self, screen_size: PhysicalSize<u32>) { pub fn render(&mut self, screen_size: PhysicalSize<u32>) {
let screen_size = (screen_size.width as f32, screen_size.height as f32); let screen_size = (screen_size.width as f32, screen_size.height as f32);
let y_ratio = (screen_size.0 / screen_size.1).max(1.); let y_ratio = (screen_size.0 / screen_size.1).max(1.);
@ -148,7 +153,7 @@ impl State {
let vs = c.iter_vertices().collect::<Vec<_>>(); let vs = c.iter_vertices().collect::<Vec<_>>();
let i = self.vertices.len() as u32; let i = self.vertices.len() as u32;
for v in vs.iter() { for v in vs.iter() {
self.vertices.push(Vertex { pos: [v.x as f32 * x_ratio, v.y as f32 * y_ratio], color }); self.vertices.push(Vertex { pos: [v.x as f32, v.y as f32], color });
} }
for v in 1..(vs.len()-1) as u32 { for v in 1..(vs.len()-1) as u32 {
self.indices.push(i); self.indices.push(i);
@ -171,7 +176,7 @@ impl State {
let vs = c.iter_vertices().collect::<Vec<_>>(); let vs = c.iter_vertices().collect::<Vec<_>>();
let i = self.vertices.len() as u32; let i = self.vertices.len() as u32;
for v in vs.iter() { for v in vs.iter() {
self.vertices.push(Vertex { pos: [v.x as f32 * x_ratio, v.y as f32 * y_ratio], color }); self.vertices.push(Vertex { pos: [v.x as f32, v.y as f32], color });
} }
for v in 1..(vs.len()-1) as u32 { for v in 1..(vs.len()-1) as u32 {
self.indices.push(i); self.indices.push(i);
@ -179,6 +184,13 @@ impl State {
self.indices.push(i+v+1); self.indices.push(i+v+1);
} }
} }
for v in self.vertices.iter_mut() {
v.pos[0] *= x_ratio;
v.pos[1] *= y_ratio;
}
self.ui.render(&mut self.vertices, &mut self.indices);
} }
pub fn update_if_needed(&mut self) { pub fn update_if_needed(&mut self) {
while self.last_frame.elapsed().as_secs_f32() > 1. / self.framerate { while self.last_frame.elapsed().as_secs_f32() > 1. / self.framerate {