gui: initial environment to draw content
This commit is contained in:
parent
18e0d6d500
commit
a5ba9660b3
9 changed files with 143 additions and 296 deletions
253
Cargo.lock
generated
253
Cargo.lock
generated
|
@ -26,57 +26,7 @@ checksum = "3083ac5a97521e35388ca80cf365b6be5210962cc59f11ee238cd92ac2fa9524"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"enumset",
|
"enumset",
|
||||||
"kurbo",
|
"kurbo",
|
||||||
]
|
"serde",
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "accesskit_consumer"
|
|
||||||
version = "0.12.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3f47393f706a2d2f9d1ebd109351f886afd256a09d2308861a6dec0853a625e2"
|
|
||||||
dependencies = [
|
|
||||||
"accesskit",
|
|
||||||
"parking_lot 0.12.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "accesskit_macos"
|
|
||||||
version = "0.4.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fabafb94d8a4dd6b20fe4112f943756ff8dc9778e3d742fb5478bf7f000a3282"
|
|
||||||
dependencies = [
|
|
||||||
"accesskit",
|
|
||||||
"accesskit_consumer",
|
|
||||||
"objc2",
|
|
||||||
"once_cell",
|
|
||||||
"parking_lot 0.12.1",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "accesskit_windows"
|
|
||||||
version = "0.10.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "662496f45a2e2ddff05e28d0a9fc2b319cc4f886d3664e3469c3d30800598962"
|
|
||||||
dependencies = [
|
|
||||||
"accesskit",
|
|
||||||
"accesskit_consumer",
|
|
||||||
"arrayvec 0.7.2",
|
|
||||||
"once_cell",
|
|
||||||
"parking_lot 0.12.1",
|
|
||||||
"paste",
|
|
||||||
"windows 0.42.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "accesskit_winit"
|
|
||||||
version = "0.7.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2f270416d033ab5b2a8fa72a976dfdad0db1ea194721f16cadbdb45ff219779f"
|
|
||||||
dependencies = [
|
|
||||||
"accesskit",
|
|
||||||
"accesskit_macos",
|
|
||||||
"accesskit_windows",
|
|
||||||
"parking_lot 0.12.1",
|
|
||||||
"winit",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -113,6 +63,7 @@ checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
"serde",
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -395,25 +346,6 @@ dependencies = [
|
||||||
"generic-array",
|
"generic-array",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[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]]
|
[[package]]
|
||||||
name = "built"
|
name = "built"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
|
@ -535,15 +467,6 @@ 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 = "cgl"
|
|
||||||
version = "0.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff"
|
|
||||||
dependencies = [
|
|
||||||
"libc",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "chrono"
|
name = "chrono"
|
||||||
version = "0.4.24"
|
version = "0.4.24"
|
||||||
|
@ -1024,6 +947,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b601108bca3af7650440ace4ca55b2daf52c36f2635be3587d77b16efd8d0691"
|
checksum = "b601108bca3af7650440ace4ca55b2daf52c36f2635be3587d77b16efd8d0691"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1036,9 +960,6 @@ dependencies = [
|
||||||
"egui",
|
"egui",
|
||||||
"egui-wgpu",
|
"egui-wgpu",
|
||||||
"egui-winit",
|
"egui-winit",
|
||||||
"egui_glow",
|
|
||||||
"glow",
|
|
||||||
"glutin",
|
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"percent-encoding",
|
"percent-encoding",
|
||||||
"raw-window-handle 0.5.2",
|
"raw-window-handle 0.5.2",
|
||||||
|
@ -1060,6 +981,7 @@ dependencies = [
|
||||||
"ahash 0.8.3",
|
"ahash 0.8.3",
|
||||||
"epaint",
|
"epaint",
|
||||||
"nohash-hasher",
|
"nohash-hasher",
|
||||||
|
"serde",
|
||||||
"tracing",
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -1084,7 +1006,6 @@ version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5696bdbe60898b81157f07ae34fe02dbfd522174bd6e620942c269cd7307901f"
|
checksum = "5696bdbe60898b81157f07ae34fe02dbfd522174bd6e620942c269cd7307901f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"accesskit_winit",
|
|
||||||
"arboard",
|
"arboard",
|
||||||
"egui",
|
"egui",
|
||||||
"instant",
|
"instant",
|
||||||
|
@ -1103,6 +1024,7 @@ dependencies = [
|
||||||
"egui",
|
"egui",
|
||||||
"egui_extras",
|
"egui_extras",
|
||||||
"enum-map",
|
"enum-map",
|
||||||
|
"serde",
|
||||||
"tracing",
|
"tracing",
|
||||||
"unicode_names2",
|
"unicode_names2",
|
||||||
]
|
]
|
||||||
|
@ -1117,21 +1039,6 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "egui_glow"
|
|
||||||
version = "0.20.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6d4b5960cb1bae1c403a6c9027a745210a41913433b10c73b6e7d76a1017f8b4"
|
|
||||||
dependencies = [
|
|
||||||
"bytemuck",
|
|
||||||
"egui",
|
|
||||||
"glow",
|
|
||||||
"memoffset",
|
|
||||||
"tracing",
|
|
||||||
"wasm-bindgen",
|
|
||||||
"web-sys",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "emath"
|
name = "emath"
|
||||||
version = "0.20.0"
|
version = "0.20.0"
|
||||||
|
@ -1139,6 +1046,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5277249c8c3430e7127e4f2c40a77485e7baf11ae132ce9b3253a8ed710df0a0"
|
checksum = "5277249c8c3430e7127e4f2c40a77485e7baf11ae132ce9b3253a8ed710df0a0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1178,6 +1086,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "19be8061a06ab6f3a6cf21106c873578bf01bd42ad15e0311a9c76161cb1c753"
|
checksum = "19be8061a06ab6f3a6cf21106c873578bf01bd42ad15e0311a9c76161cb1c753"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"enumset_derive",
|
"enumset_derive",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1232,6 +1141,7 @@ dependencies = [
|
||||||
"emath",
|
"emath",
|
||||||
"nohash-hasher",
|
"nohash-hasher",
|
||||||
"parking_lot 0.12.1",
|
"parking_lot 0.12.1",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1596,17 +1506,6 @@ dependencies = [
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gl_generator"
|
|
||||||
version = "0.14.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d"
|
|
||||||
dependencies = [
|
|
||||||
"khronos_api",
|
|
||||||
"log",
|
|
||||||
"xml-rs",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glob"
|
name = "glob"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
@ -1625,58 +1524,6 @@ dependencies = [
|
||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glutin"
|
|
||||||
version = "0.30.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f89bab9ec7715de13d5d5402238e66f48e3a5ae636ebb45aba4013c962e2ff15"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.3.2",
|
|
||||||
"cfg_aliases",
|
|
||||||
"cgl",
|
|
||||||
"core-foundation 0.9.3",
|
|
||||||
"dispatch",
|
|
||||||
"glutin_egl_sys",
|
|
||||||
"glutin_glx_sys",
|
|
||||||
"glutin_wgl_sys",
|
|
||||||
"libloading",
|
|
||||||
"objc2",
|
|
||||||
"once_cell",
|
|
||||||
"raw-window-handle 0.5.2",
|
|
||||||
"wayland-sys 0.30.1",
|
|
||||||
"windows-sys 0.45.0",
|
|
||||||
"x11-dl",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glutin_egl_sys"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e5aaf0abb5c4148685b33101ae326a207946b4d3764d6cdc79f8316cdaa8367d"
|
|
||||||
dependencies = [
|
|
||||||
"gl_generator",
|
|
||||||
"windows-sys 0.45.0",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glutin_glx_sys"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1b53cb5fe568964aa066a3ba91eac5ecbac869fb0842cd0dc9e412434f1a1494"
|
|
||||||
dependencies = [
|
|
||||||
"gl_generator",
|
|
||||||
"x11-dl",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glutin_wgl_sys"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ef89398e90033fc6bc65e9bd42fd29bbbfd483bda5b56dc5562f455550618165"
|
|
||||||
dependencies = [
|
|
||||||
"gl_generator",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gpu-alloc"
|
name = "gpu-alloc"
|
||||||
version = "0.5.3"
|
version = "0.5.3"
|
||||||
|
@ -2189,7 +2036,7 @@ dependencies = [
|
||||||
"iana-time-zone-haiku",
|
"iana-time-zone-haiku",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"windows 0.48.0",
|
"windows",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2358,12 +2205,6 @@ dependencies = [
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "khronos_api"
|
|
||||||
version = "3.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kurbo"
|
name = "kurbo"
|
||||||
version = "0.8.3"
|
version = "0.8.3"
|
||||||
|
@ -2371,6 +2212,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7a53776d271cfb873b17c618af0298445c88afc52837f3e948fa3fafd131f449"
|
checksum = "7a53776d271cfb873b17c618af0298445c88afc52837f3e948fa3fafd131f449"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec 0.7.2",
|
"arrayvec 0.7.2",
|
||||||
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2959,32 +2801,6 @@ dependencies = [
|
||||||
"objc_id",
|
"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"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "fe31e5425d3d0b89a15982c024392815da40689aceb34bad364d58732bcfd649"
|
|
||||||
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]]
|
[[package]]
|
||||||
name = "objc_exception"
|
name = "objc_exception"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
|
@ -3140,12 +2956,6 @@ dependencies = [
|
||||||
"subtle",
|
"subtle",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "paste"
|
|
||||||
version = "1.0.12"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pbkdf2"
|
name = "pbkdf2"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
|
@ -4528,7 +4338,7 @@ dependencies = [
|
||||||
"scoped-tls",
|
"scoped-tls",
|
||||||
"wayland-commons",
|
"wayland-commons",
|
||||||
"wayland-scanner",
|
"wayland-scanner",
|
||||||
"wayland-sys 0.29.5",
|
"wayland-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4540,7 +4350,7 @@ dependencies = [
|
||||||
"nix 0.24.3",
|
"nix 0.24.3",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"wayland-sys 0.29.5",
|
"wayland-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -4588,18 +4398,6 @@ dependencies = [
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wayland-sys"
|
|
||||||
version = "0.30.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "96b2a02ac608e07132978689a6f9bf4214949c85998c247abadd4f4129b1aa06"
|
|
||||||
dependencies = [
|
|
||||||
"dlib",
|
|
||||||
"lazy_static",
|
|
||||||
"log",
|
|
||||||
"pkg-config",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "web-sys"
|
name = "web-sys"
|
||||||
version = "0.3.61"
|
version = "0.3.61"
|
||||||
|
@ -4792,22 +4590,6 @@ version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows"
|
|
||||||
version = "0.42.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0286ba339aa753e70765d521bb0242cc48e1194562bfa2a2ad7ac8a6de28f5d5"
|
|
||||||
dependencies = [
|
|
||||||
"windows-implement",
|
|
||||||
"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]]
|
[[package]]
|
||||||
name = "windows"
|
name = "windows"
|
||||||
version = "0.48.0"
|
version = "0.48.0"
|
||||||
|
@ -4817,17 +4599,6 @@ dependencies = [
|
||||||
"windows-targets 0.48.0",
|
"windows-targets 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-implement"
|
|
||||||
version = "0.42.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "9539b6bd3eadbd9de66c9666b22d802b833da7e996bc06896142e09854a61767"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2 1.0.56",
|
|
||||||
"quote 1.0.26",
|
|
||||||
"syn 1.0.109",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.36.1"
|
version = "0.36.1"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|uiMode"
|
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|uiMode|keyboard"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
|
@ -39,7 +39,7 @@ unsafe fn android_main(app: AndroidApp) {
|
||||||
builder.with_android_app(app);
|
builder.with_android_app(app);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
use crate::gui::platform::app::Android;
|
use crate::gui::platform::Android;
|
||||||
start(options, Box::new(|_cc| Box::new(
|
start(options, Box::new(|_cc| Box::new(
|
||||||
PlatformApp::new(_cc, Android::new(_app))
|
PlatformApp::new(_cc, Android::new(_app))
|
||||||
)));
|
)));
|
||||||
|
|
|
@ -12,8 +12,40 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use std::any::Any;
|
||||||
|
use eframe::Frame;
|
||||||
|
use egui::Context;
|
||||||
|
use crate::gui::PlatformCallbacks;
|
||||||
|
use crate::gui::screens::{Screen};
|
||||||
|
|
||||||
pub struct PlatformApp<Platform> {
|
pub struct PlatformApp<Platform> {
|
||||||
pub(crate) root: egui_demo_lib::DemoWindows,
|
pub(crate) screens: Screens,
|
||||||
// root: super::views::main
|
|
||||||
pub(crate) platform: Platform,
|
pub(crate) platform: Platform,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct Screens {
|
||||||
|
screens: Vec<Box<dyn Screen>>,
|
||||||
|
current: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Screens {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self::from_screens(vec![
|
||||||
|
Box::new(super::screens::Wallets::default())
|
||||||
|
])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Screens {
|
||||||
|
pub fn from_screens(screens: Vec<Box<dyn Screen>>) -> Self {
|
||||||
|
let current = screens[0].name().to_string();
|
||||||
|
Self {
|
||||||
|
screens,
|
||||||
|
current,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn ui(&mut self, ctx: &Context, frame: &mut Frame, cb: &dyn PlatformCallbacks) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -13,7 +13,18 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
pub use crate::gui::app::PlatformApp;
|
pub use app::PlatformApp;
|
||||||
|
|
||||||
pub mod views;
|
pub mod screens;
|
||||||
pub mod platform;
|
pub mod platform;
|
||||||
|
|
||||||
|
pub trait Ui {
|
||||||
|
fn ui(&mut self, ui: &mut egui::Ui);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub trait PlatformCallbacks {
|
||||||
|
fn show_keyboard(&mut self);
|
||||||
|
fn hide_keyboard(&mut self);
|
||||||
|
fn copy_string_to_buffer(&mut self, data: String);
|
||||||
|
fn get_string_from_buffer(&mut self) -> String;
|
||||||
|
}
|
|
@ -14,11 +14,14 @@
|
||||||
|
|
||||||
use egui::{Color32, FontTweak, Visuals};
|
use egui::{Color32, FontTweak, Visuals};
|
||||||
use egui::epaint::Shadow;
|
use egui::epaint::Shadow;
|
||||||
use jni::objects::{JObject, JPrimitiveArray};
|
|
||||||
use crate::gui::PlatformApp;
|
|
||||||
|
|
||||||
|
use jni::objects::{JObject, JPrimitiveArray};
|
||||||
use winit::platform::android::activity::AndroidApp;
|
use winit::platform::android::activity::AndroidApp;
|
||||||
|
|
||||||
|
use crate::gui::{PlatformApp, PlatformCallbacks};
|
||||||
|
use crate::gui::app::Screens;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct Android {
|
pub struct Android {
|
||||||
pub android_app: AndroidApp,
|
pub android_app: AndroidApp,
|
||||||
pub cutouts: [i32; 4],
|
pub cutouts: [i32; 4],
|
||||||
|
@ -27,7 +30,7 @@ pub struct Android {
|
||||||
|
|
||||||
impl Android {
|
impl Android {
|
||||||
pub fn new(app: AndroidApp) -> Self {
|
pub fn new(app: AndroidApp) -> Self {
|
||||||
Android {
|
Self {
|
||||||
android_app: app,
|
android_app: app,
|
||||||
cutouts: Default::default(),
|
cutouts: Default::default(),
|
||||||
window_size: Default::default()
|
window_size: Default::default()
|
||||||
|
@ -35,35 +38,29 @@ impl Android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl PlatformCallbacks for Android {
|
||||||
|
fn show_keyboard(&mut self) {
|
||||||
|
self.android_app.show_soft_input(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn hide_keyboard(&mut self) {
|
||||||
|
self.android_app.hide_soft_input(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn copy_string_to_buffer(&mut self, data: String) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_string_from_buffer(&mut self) -> String {
|
||||||
|
"".to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl PlatformApp<Android> {
|
impl PlatformApp<Android> {
|
||||||
pub fn new(cc: &eframe::CreationContext<'_>, platform: Android) -> Self {
|
pub fn new(cc: &eframe::CreationContext<'_>, platform: Android) -> Self {
|
||||||
setup_fonts(&cc.egui_ctx);
|
setup_fonts(&cc.egui_ctx);
|
||||||
// cc.egui_ctx.set_visuals(Visuals {
|
|
||||||
// dark_mode: false,
|
|
||||||
// override_text_color: None,
|
|
||||||
// widgets: Default::default(),
|
|
||||||
// selection: Default::default(),
|
|
||||||
// hyperlink_color: Default::default(),
|
|
||||||
// faint_bg_color: Default::default(),
|
|
||||||
// extreme_bg_color: Default::default(),
|
|
||||||
// code_bg_color: Default::default(),
|
|
||||||
// warn_fg_color: Default::default(),
|
|
||||||
// error_fg_color: Default::default(),
|
|
||||||
// window_rounding: Default::default(),
|
|
||||||
// window_shadow: Default::default(),
|
|
||||||
// window_fill: Default::default(),
|
|
||||||
// window_stroke: Default::default(),
|
|
||||||
// panel_fill: Default::default(),
|
|
||||||
// popup_shadow: Default::default(),
|
|
||||||
// resize_corner_size: 0.0,
|
|
||||||
// text_cursor_width: 0.0,
|
|
||||||
// text_cursor_preview: false,
|
|
||||||
// clip_rect_margin: 0.0,
|
|
||||||
// button_frame: false,
|
|
||||||
// collapsing_header_frame: false,
|
|
||||||
// });
|
|
||||||
Self {
|
Self {
|
||||||
root: Default::default(),
|
screens: Screens::default(),
|
||||||
platform,
|
platform,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,9 +88,6 @@ fn setup_fonts(ctx: &egui::Context) {
|
||||||
|
|
||||||
impl eframe::App for PlatformApp<Android> {
|
impl eframe::App for PlatformApp<Android> {
|
||||||
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
fn update(&mut self, ctx: &egui::Context, frame: &mut eframe::Frame) {
|
||||||
println!("12345 - X {}", frame.info().window_info.size.x);
|
|
||||||
println!("12345 - Y {}", frame.info().window_info.size.y);
|
|
||||||
|
|
||||||
let _x = frame.info().window_info.size.x;
|
let _x = frame.info().window_info.size.x;
|
||||||
let _y = frame.info().window_info.size.y;
|
let _y = frame.info().window_info.size.y;
|
||||||
if _x != self.platform.window_size[0] || _y != self.platform.window_size[1] {
|
if _x != self.platform.window_size[0] || _y != self.platform.window_size[1] {
|
||||||
|
@ -102,10 +96,11 @@ impl eframe::App for PlatformApp<Android> {
|
||||||
self.platform.cutouts = get_display_cutouts(&self.platform.android_app);
|
self.platform.cutouts = get_display_cutouts(&self.platform.android_app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let is_dark = ctx.style().visuals.dark_mode;
|
||||||
egui::TopBottomPanel::top("top_padding_panel")
|
egui::TopBottomPanel::top("top_padding_panel")
|
||||||
.frame(egui::Frame {
|
.frame(egui::Frame {
|
||||||
shadow: Shadow::NONE,
|
shadow: Shadow::NONE,
|
||||||
fill: Color32::TRANSPARENT,
|
fill: if is_dark {Color32::BLACK} else {Color32::WHITE},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.show_separator_line(false)
|
.show_separator_line(false)
|
||||||
|
@ -113,21 +108,10 @@ impl eframe::App for PlatformApp<Android> {
|
||||||
.exact_height(self.platform.cutouts[0] as f32)
|
.exact_height(self.platform.cutouts[0] as f32)
|
||||||
.show(ctx, |ui| {});
|
.show(ctx, |ui| {});
|
||||||
|
|
||||||
egui::SidePanel::right("right_padding_panel")
|
|
||||||
.frame(egui::Frame {
|
|
||||||
shadow: Shadow::NONE,
|
|
||||||
fill: Color32::TRANSPARENT,
|
|
||||||
..Default::default()
|
|
||||||
})
|
|
||||||
.show_separator_line(false)
|
|
||||||
.resizable(false)
|
|
||||||
.default_width(self.platform.cutouts[1] as f32)
|
|
||||||
.show(ctx, |ui| {});
|
|
||||||
|
|
||||||
egui::TopBottomPanel::bottom("bottom_padding_panel")
|
egui::TopBottomPanel::bottom("bottom_padding_panel")
|
||||||
.frame(egui::Frame {
|
.frame(egui::Frame {
|
||||||
shadow: Shadow::NONE,
|
shadow: Shadow::NONE,
|
||||||
fill: Color32::TRANSPARENT,
|
fill: if is_dark {Color32::BLACK} else {Color32::WHITE},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.show_separator_line(false)
|
.show_separator_line(false)
|
||||||
|
@ -135,10 +119,21 @@ impl eframe::App for PlatformApp<Android> {
|
||||||
.exact_height(self.platform.cutouts[2] as f32)
|
.exact_height(self.platform.cutouts[2] as f32)
|
||||||
.show(ctx, |ui| {});
|
.show(ctx, |ui| {});
|
||||||
|
|
||||||
|
egui::SidePanel::right("right_padding_panel")
|
||||||
|
.frame(egui::Frame {
|
||||||
|
shadow: Shadow::NONE,
|
||||||
|
fill: if is_dark {Color32::BLACK} else {Color32::WHITE},
|
||||||
|
..Default::default()
|
||||||
|
})
|
||||||
|
.show_separator_line(false)
|
||||||
|
.resizable(false)
|
||||||
|
.default_width(self.platform.cutouts[1] as f32)
|
||||||
|
.show(ctx, |ui| {});
|
||||||
|
|
||||||
egui::SidePanel::left("left_padding_panel")
|
egui::SidePanel::left("left_padding_panel")
|
||||||
.frame(egui::Frame {
|
.frame(egui::Frame {
|
||||||
shadow: Shadow::NONE,
|
shadow: Shadow::NONE,
|
||||||
fill: Color32::TRANSPARENT,
|
fill: if is_dark {Color32::BLACK} else {Color32::WHITE},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.show_separator_line(false)
|
.show_separator_line(false)
|
||||||
|
@ -147,7 +142,7 @@ impl eframe::App for PlatformApp<Android> {
|
||||||
.show(ctx, |ui| {});
|
.show(ctx, |ui| {});
|
||||||
|
|
||||||
egui::CentralPanel::default().show(ctx, |ui| {
|
egui::CentralPanel::default().show(ctx, |ui| {
|
||||||
self.root.ui(ctx);
|
self.screens.ui(ctx, frame, &self.platform);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,11 @@
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
pub use self::platform::*;
|
||||||
|
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
#[path = "android/mod.rs"]
|
#[path = "android/mod.rs"]
|
||||||
pub mod app;
|
pub mod platform;
|
||||||
#[cfg(not(target_os = "android"))]
|
#[cfg(not(target_os = "android"))]
|
||||||
#[path = "desktop/mod.rs"]
|
#[path = "desktop/mod.rs"]
|
||||||
pub mod app;
|
pub mod app;
|
||||||
|
|
|
@ -11,4 +11,10 @@
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
pub mod main;
|
|
||||||
|
mod wallets;
|
||||||
|
pub use wallets::Wallets;
|
||||||
|
|
||||||
|
pub trait Screen {
|
||||||
|
fn name(&self) -> &'static str;
|
||||||
|
}
|
|
@ -12,3 +12,34 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
use egui::ScrollArea;
|
||||||
|
use crate::gui::Ui;
|
||||||
|
|
||||||
|
pub struct Wallets {
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for Wallets {
|
||||||
|
fn default() -> Self {
|
||||||
|
Self {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Ui for Wallets {
|
||||||
|
fn ui(&mut self, ui: &mut egui::Ui) {
|
||||||
|
ScrollArea::vertical()
|
||||||
|
.auto_shrink([false; 2])
|
||||||
|
.show(ui, |ui| {
|
||||||
|
for item in 1..=50 {
|
||||||
|
ui.heading(format!("This is future Wallet {}", item));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl super::Screen for Wallets {
|
||||||
|
fn name(&self) -> &'static str {
|
||||||
|
"Wallets"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue