game-activity depends on egui-winit example

This commit is contained in:
ardocrat 2023-04-10 18:19:53 +03:00
parent ed95fe341a
commit c69b8d4ca1
4 changed files with 67 additions and 75 deletions

122
Cargo.lock generated
View file

@ -818,6 +818,13 @@ dependencies = [
"syn 0.15.44", "syn 0.15.44",
] ]
[[package]]
name = "ecolor"
version = "0.21.0"
dependencies = [
"bytemuck",
]
[[package]] [[package]]
name = "ecolor" name = "ecolor"
version = "0.21.0" version = "0.21.0"
@ -829,13 +836,12 @@ dependencies = [
[[package]] [[package]]
name = "egui" name = "egui"
version = "0.17.0" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0a3cd1d47e12f7a17912595241622e373aa652a4e0fa90b3f9278f90a64aedf7"
dependencies = [ dependencies = [
"ahash 0.7.6", "ahash 0.8.3",
"epaint 0.17.0", "epaint 0.21.0",
"nohash-hasher", "nohash-hasher",
"tracing",
] ]
[[package]] [[package]]
@ -845,18 +851,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6412a21e0bde7c0918f7fb44bbbb86b5e1f88e63c026a4e747cc7af02f76dfbe" checksum = "6412a21e0bde7c0918f7fb44bbbb86b5e1f88e63c026a4e747cc7af02f76dfbe"
dependencies = [ dependencies = [
"ahash 0.8.3", "ahash 0.8.3",
"epaint 0.21.0", "epaint 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"nohash-hasher", "nohash-hasher",
"tracing",
] ]
[[package]] [[package]]
name = "egui-winit" name = "egui-winit"
version = "0.21.1" version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab43597ba41f0ce39a364ad83185594578bfd8b3409b99dbcbb01df23afc3dbb"
dependencies = [ dependencies = [
"android-activity",
"arboard", "arboard",
"egui 0.21.0", "egui 0.21.0",
"instant", "instant",
@ -872,7 +874,7 @@ version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86ac92d1776423b835012ac316bb0c27cd32bf0e21d82d183260732f0580a547" checksum = "86ac92d1776423b835012ac316bb0c27cd32bf0e21d82d183260732f0580a547"
dependencies = [ dependencies = [
"egui 0.21.0", "egui 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"egui_extras", "egui_extras",
"enum-map", "enum-map",
"tracing", "tracing",
@ -885,7 +887,7 @@ version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f051342e97dfa2445107cb7d2e720617f5c840199b5cb4fe0ffcf481fcf5cce" checksum = "8f051342e97dfa2445107cb7d2e720617f5c840199b5cb4fe0ffcf481fcf5cce"
dependencies = [ dependencies = [
"egui 0.21.0", "egui 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde", "serde",
] ]
@ -896,7 +898,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72e3987dfe2ed2852a5b78aa5b1c5a0e39ffc14445e6611b00b61d653fd95535" checksum = "72e3987dfe2ed2852a5b78aa5b1c5a0e39ffc14445e6611b00b61d653fd95535"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"egui 0.21.0", "egui 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wgpu", "wgpu",
] ]
@ -906,15 +908,16 @@ version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea93cdf93d8a4b2515dba53e3c83ede5dcededb41cb3aea02e7ef267d60a7653" checksum = "ea93cdf93d8a4b2515dba53e3c83ede5dcededb41cb3aea02e7ef267d60a7653"
dependencies = [ dependencies = [
"egui 0.21.0", "egui 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"winit", "winit",
] ]
[[package]] [[package]]
name = "emath" name = "emath"
version = "0.17.0" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [
checksum = "a977a80456be58a2c2d48e69c1d0baadef46cecef5a0c98df141c468da006f12" "bytemuck",
]
[[package]] [[package]]
name = "emath" name = "emath"
@ -983,15 +986,16 @@ dependencies = [
[[package]] [[package]]
name = "epaint" name = "epaint"
version = "0.17.0" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "033292846059f08e03a71e1b5db2ee6ab7c9622c3b48da21f4bd13258ebee2db"
dependencies = [ dependencies = [
"ab_glyph", "ab_glyph",
"ahash 0.7.6", "ahash 0.8.3",
"atomic_refcell", "atomic_refcell",
"emath 0.17.0", "bytemuck",
"ecolor 0.21.0",
"emath 0.21.0",
"nohash-hasher", "nohash-hasher",
"parking_lot 0.12.1",
] ]
[[package]] [[package]]
@ -1004,31 +1008,21 @@ dependencies = [
"ahash 0.8.3", "ahash 0.8.3",
"atomic_refcell", "atomic_refcell",
"bytemuck", "bytemuck",
"ecolor", "ecolor 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"emath 0.21.0", "emath 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"nohash-hasher", "nohash-hasher",
"parking_lot 0.12.1", "parking_lot 0.12.1",
] ]
[[package]]
name = "epi"
version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c95445deccef4d29fa30488d3f7f2e942dd343eef01228becc7cefd5b918176e"
dependencies = [
"egui 0.17.0",
"tracing",
]
[[package]] [[package]]
name = "errno" name = "errno"
version = "0.3.0" version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
dependencies = [ dependencies = [
"errno-dragonfly", "errno-dragonfly",
"libc", "libc",
"windows-sys 0.45.0", "windows-sys 0.48.0",
] ]
[[package]] [[package]]
@ -1286,9 +1280,9 @@ dependencies = [
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.8" version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"libc", "libc",
@ -1390,13 +1384,12 @@ version = "0.1.0"
dependencies = [ dependencies = [
"android_logger", "android_logger",
"built", "built",
"egui 0.21.0", "egui 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)",
"egui-winit", "egui-winit",
"egui_demo_lib", "egui_demo_lib",
"egui_wgpu_backend", "egui_wgpu_backend",
"egui_winit_platform", "egui_winit_platform",
"env_logger 0.10.0", "env_logger 0.10.0",
"epi",
"futures 0.3.28", "futures 0.3.28",
"grin_api", "grin_api",
"grin_chain", "grin_chain",
@ -1926,13 +1919,13 @@ dependencies = [
[[package]] [[package]]
name = "io-lifetimes" name = "io-lifetimes"
version = "1.0.9" version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
dependencies = [ dependencies = [
"hermit-abi 0.3.1", "hermit-abi 0.3.1",
"libc", "libc",
"windows-sys 0.45.0", "windows-sys 0.48.0",
] ]
[[package]] [[package]]
@ -1946,14 +1939,14 @@ dependencies = [
[[package]] [[package]]
name = "is-terminal" name = "is-terminal"
version = "0.4.6" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8" checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
dependencies = [ dependencies = [
"hermit-abi 0.3.1", "hermit-abi 0.3.1",
"io-lifetimes", "io-lifetimes",
"rustix", "rustix",
"windows-sys 0.45.0", "windows-sys 0.48.0",
] ]
[[package]] [[package]]
@ -2616,9 +2609,9 @@ checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7"
[[package]] [[package]]
name = "objc2" name = "objc2"
version = "0.3.0-beta.3" version = "0.3.0-beta.3.patch-leaks.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe31e5425d3d0b89a15982c024392815da40689aceb34bad364d58732bcfd649" checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468"
dependencies = [ dependencies = [
"block2", "block2",
"objc-sys", "objc-sys",
@ -2696,9 +2689,9 @@ dependencies = [
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.84" version = "0.9.85"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a20eace9dc2d82904039cb76dcf50fb1a0bba071cfd1629720b5d6f1ddba0fa" checksum = "0d3d193fb1488ad46ffe3aaabc912cc931d02ee8518fe2959aea8ef52718b0c0"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@ -3190,16 +3183,16 @@ checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda"
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.37.7" version = "0.37.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d" checksum = "85597d61f83914ddeba6a47b3b8ffe7365107221c2e557ed94426489fefb5f77"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"errno", "errno",
"io-lifetimes", "io-lifetimes",
"libc", "libc",
"linux-raw-sys", "linux-raw-sys",
"windows-sys 0.45.0", "windows-sys 0.48.0",
] ]
[[package]] [[package]]
@ -3811,21 +3804,9 @@ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"log", "log",
"pin-project-lite 0.2.9", "pin-project-lite 0.2.9",
"tracing-attributes",
"tracing-core", "tracing-core",
] ]
[[package]]
name = "tracing-attributes"
version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
dependencies = [
"proc-macro2 1.0.56",
"quote 1.0.26",
"syn 1.0.109",
]
[[package]] [[package]]
name = "tracing-core" name = "tracing-core"
version = "0.1.30" version = "0.1.30"
@ -4390,6 +4371,15 @@ 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.0",
]
[[package]] [[package]]
name = "windows-targets" name = "windows-targets"
version = "0.42.2" version = "0.42.2"

View file

@ -22,18 +22,16 @@ grin_p2p = "5.1.2"
grin_servers = "5.1.2" grin_servers = "5.1.2"
grin_store = "5.1.2" grin_store = "5.1.2"
grin_util = "5.1.2" grin_util = "5.1.2"
openssl-sys = { version = "0.9.82", features = ["vendored"]} openssl-sys = { version = "0.9.82", features = ["vendored"] }
#grin_wallet_api = "5.1.0" #grin_wallet_api = "5.1.0"
#grin_wallet_libwallet = "5.1.0" #grin_wallet_libwallet = "5.1.0"
#grin_wallet_controller = "5.1.0" #grin_wallet_controller = "5.1.0"
#grin_wallet_config = "5.1.0" #grin_wallet_config = "5.1.0"
#grin_wallet_util = "5.1.0" #grin_wallet_util = "5.1.0"
egui = "0.21.0" egui = "0.21.0"
egui-winit = "0.21.1" egui-winit = { version = "0.21.1", features = ['default', 'bytemuck', 'android-game-activity'] }
wgpu = "0.15.1" wgpu = "0.15.1"
egui_wgpu_backend = "0.22.0" egui_wgpu_backend = "0.22.0"
epi = "0.17.0"
egui_winit_platform = "0.18.0" egui_winit_platform = "0.18.0"
pollster = "0.3.0" pollster = "0.3.0"
egui_demo_lib = "0.21.0" egui_demo_lib = "0.21.0"
@ -41,6 +39,9 @@ egui_demo_lib = "0.21.0"
## grin_servers ## grin_servers
futures = "0.3" futures = "0.3"
[patch.crates-io]
egui-winit = { path = '../egui/crates/egui-winit' }
[build-dependencies] [build-dependencies]
built = { version = "0.6.0", features = ["git2"]} built = { version = "0.6.0", features = ["git2"]}
@ -50,7 +51,7 @@ winit = { version = "0.28.3" }
[target.'cfg(target_os = "android")'.dependencies] [target.'cfg(target_os = "android")'.dependencies]
android_logger = "0.13.1" android_logger = "0.13.1"
winit = { version = "0.28.3", features = [ "android-native-activity" ] } winit = { version = "0.28.3", features = [ "android-game-activity" ] }
[lib] [lib]
name="grin_android" name="grin_android"

View file

@ -1,12 +1,12 @@
package mw.gri.android; package mw.gri.android;
import android.app.NativeActivity;
import android.os.Bundle; import android.os.Bundle;
import android.system.ErrnoException; import android.system.ErrnoException;
import android.system.Os; import android.system.Os;
import android.view.WindowManager; import androidx.core.view.WindowCompat;
import com.google.androidgamesdk.GameActivity;
public class MainActivity extends NativeActivity { public class MainActivity extends GameActivity {
static { static {
System.loadLibrary("grin_android"); System.loadLibrary("grin_android");
@ -19,6 +19,7 @@ public class MainActivity extends NativeActivity {
} catch (ErrnoException e) { } catch (ErrnoException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
WindowCompat.setDecorFitsSystemWindows(getWindow(), true);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
} }
} }

View file

@ -1,6 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools"> <resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. --> <!-- Base application theme. -->
<style name="Theme.Main" parent="Theme.MaterialComponents.DayNight.DarkActionBar"> <style name="Theme.Main" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. --> <!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item> <item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item> <item name="colorPrimaryVariant">@color/purple_700</item>