~starkingdoms/starkingdoms

ba254ec74e51495678ac09f06342403ab08434a2 — ghostly_zsh 8 months ago 494c0b1
sync, i guess
M Cargo.lock => Cargo.lock +54 -308
@@ 2185,7 2185,7 @@ dependencies = [
 "bitflags 1.3.2",
 "core-foundation",
 "core-graphics-types",
 "foreign-types 0.5.0",
 "foreign-types",
 "libc",
]



@@ 2656,6 2656,20 @@ dependencies = [
]

[[package]]
name = "ehttp"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59a81c221a1e4dad06cb9c9deb19aea1193a5eea084e8cd42d869068132bf876"
dependencies = [
 "document-features",
 "js-sys",
 "ureq",
 "wasm-bindgen",
 "wasm-bindgen-futures",
 "web-sys",
]

[[package]]
name = "either"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 2929,21 2943,12 @@ dependencies = [

[[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",
 "foreign-types-shared",
]

[[package]]


@@ 2959,12 2964,6 @@ dependencies = [

[[package]]
name = "foreign-types-shared"
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"


@@ 3475,17 3474,6 @@ dependencies = [
]

[[package]]
name = "http-body"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2"
dependencies = [
 "bytes",
 "http 0.2.12",
 "pin-project-lite",
]

[[package]]
name = "httparse"
version = "1.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 3520,43 3508,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"

[[package]]
name = "hyper"
version = "0.14.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7"
dependencies = [
 "bytes",
 "futures-channel",
 "futures-core",
 "futures-util",
 "h2",
 "http 0.2.12",
 "http-body",
 "httparse",
 "httpdate",
 "itoa",
 "pin-project-lite",
 "socket2",
 "tokio",
 "tower-service",
 "tracing",
 "want",
]

[[package]]
name = "hyper-tls"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905"
dependencies = [
 "bytes",
 "hyper",
 "native-tls",
 "tokio",
 "tokio-native-tls",
]

[[package]]
name = "iana-time-zone"
version = "0.1.61"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 3727,12 3678,6 @@ dependencies = [
]

[[package]]
name = "ipnet"
version = "2.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708"

[[package]]
name = "is-terminal"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 3821,9 3766,9 @@ checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0"

[[package]]
name = "js-sys"
version = "0.3.76"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7"
checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f"
dependencies = [
 "once_cell",
 "wasm-bindgen",


@@ 4136,7 4081,7 @@ dependencies = [
 "bitflags 2.6.0",
 "block",
 "core-graphics-types",
 "foreign-types 0.5.0",
 "foreign-types",
 "log",
 "objc",
 "paste",


@@ 4151,7 4096,7 @@ dependencies = [
 "bitflags 2.6.0",
 "block",
 "core-graphics-types",
 "foreign-types 0.5.0",
 "foreign-types",
 "log",
 "objc",
 "paste",


@@ 4330,23 4275,6 @@ dependencies = [
]

[[package]]
name = "native-tls"
version = "0.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466"
dependencies = [
 "libc",
 "log",
 "openssl",
 "openssl-probe",
 "openssl-sys",
 "schannel",
 "security-framework",
 "security-framework-sys",
 "tempfile",
]

[[package]]
name = "ndk"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 4855,50 4783,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9"

[[package]]
name = "openssl"
version = "0.10.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5"
dependencies = [
 "bitflags 2.6.0",
 "cfg-if",
 "foreign-types 0.3.2",
 "libc",
 "once_cell",
 "openssl-macros",
 "openssl-sys",
]

[[package]]
name = "openssl-macros"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
dependencies = [
 "proc-macro2",
 "quote",
 "syn 2.0.94",
]

[[package]]
name = "openssl-probe"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"

[[package]]
name = "openssl-sys"
version = "0.9.104"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741"
dependencies = [
 "cc",
 "libc",
 "pkg-config",
 "vcpkg",
]

[[package]]
name = "orbclient"
version = "0.3.47"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 5148,6 5032,18 @@ dependencies = [
]

[[package]]
name = "poll-promise"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f6a58fecbf9da8965bcdb20ce4fd29788d1acee68ddbb64f0ba1b81bccdb7df"
dependencies = [
 "document-features",
 "static_assertions",
 "wasm-bindgen",
 "wasm-bindgen-futures",
]

[[package]]
name = "polling"
version = "3.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 5543,46 5439,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832"

[[package]]
name = "reqwest"
version = "0.11.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62"
dependencies = [
 "base64 0.21.7",
 "bytes",
 "encoding_rs",
 "futures-core",
 "futures-util",
 "h2",
 "http 0.2.12",
 "http-body",
 "hyper",
 "hyper-tls",
 "ipnet",
 "js-sys",
 "log",
 "mime",
 "native-tls",
 "once_cell",
 "percent-encoding",
 "pin-project-lite",
 "rustls-pemfile",
 "serde",
 "serde_json",
 "serde_urlencoded",
 "sync_wrapper",
 "system-configuration",
 "tokio",
 "tokio-native-tls",
 "tower-service",
 "url",
 "wasm-bindgen",
 "wasm-bindgen-futures",
 "web-sys",
 "winreg",
]

[[package]]
name = "resvg"
version = "0.44.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 5711,9 5567,9 @@ dependencies = [

[[package]]
name = "rustls"
version = "0.23.20"
version = "0.23.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5065c3f250cbd332cd894be57c40fa52387247659b14a2d6041d121547903b1b"
checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395"
dependencies = [
 "log",
 "once_cell",


@@ 5725,15 5581,6 @@ dependencies = [
]

[[package]]
name = "rustls-pemfile"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c"
dependencies = [
 "base64 0.21.7",
]

[[package]]
name = "rustls-pki-types"
version = "1.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 5799,15 5646,6 @@ dependencies = [
]

[[package]]
name = "schannel"
version = "0.1.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d"
dependencies = [
 "windows-sys 0.59.0",
]

[[package]]
name = "scoped-futures"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 5843,29 5681,6 @@ dependencies = [
]

[[package]]
name = "security-framework"
version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02"
dependencies = [
 "bitflags 2.6.0",
 "core-foundation",
 "core-foundation-sys",
 "libc",
 "security-framework-sys",
]

[[package]]
name = "security-framework-sys"
version = "2.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32"
dependencies = [
 "core-foundation-sys",
 "libc",
]

[[package]]
name = "semver"
version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 6214,11 6029,12 @@ dependencies = [
 "egui",
 "egui-wgpu",
 "egui-winit",
 "ehttp",
 "futures",
 "image 0.25.5",
 "nalgebra 0.33.2",
 "poll-promise",
 "pollster",
 "reqwest",
 "resvg",
 "serde",
 "serde_json",


@@ 6359,12 6175,6 @@ dependencies = [
]

[[package]]
name = "sync_wrapper"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"

[[package]]
name = "sysinfo"
version = "0.30.13"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 6379,27 6189,6 @@ dependencies = [
]

[[package]]
name = "system-configuration"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7"
dependencies = [
 "bitflags 1.3.2",
 "core-foundation",
 "system-configuration-sys",
]

[[package]]
name = "system-configuration-sys"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9"
dependencies = [
 "core-foundation-sys",
 "libc",
]

[[package]]
name = "system-deps"
version = "6.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 6657,16 6446,6 @@ dependencies = [
]

[[package]]
name = "tokio-native-tls"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2"
dependencies = [
 "native-tls",
 "tokio",
]

[[package]]
name = "tokio-postgres"
version = "0.7.11"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 6776,12 6555,6 @@ dependencies = [
]

[[package]]
name = "tower-service"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"

[[package]]
name = "tracing"
version = "0.1.40"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 6920,12 6693,6 @@ dependencies = [
]

[[package]]
name = "try-lock"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"

[[package]]
name = "ttf-parser"
version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 7176,12 6943,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"

[[package]]
name = "vcpkg"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"

[[package]]
name = "version-compare"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 7204,15 6965,6 @@ dependencies = [
]

[[package]]
name = "want"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
dependencies = [
 "try-lock",
]

[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"


@@ 7226,20 6978,21 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"

[[package]]
name = "wasm-bindgen"
version = "0.2.99"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396"
checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5"
dependencies = [
 "cfg-if",
 "once_cell",
 "rustversion",
 "wasm-bindgen-macro",
]

[[package]]
name = "wasm-bindgen-backend"
version = "0.2.99"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79"
checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6"
dependencies = [
 "bumpalo",
 "log",


@@ 7251,9 7004,9 @@ dependencies = [

[[package]]
name = "wasm-bindgen-futures"
version = "0.4.49"
version = "0.4.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2"
checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61"
dependencies = [
 "cfg-if",
 "js-sys",


@@ 7264,9 7017,9 @@ dependencies = [

[[package]]
name = "wasm-bindgen-macro"
version = "0.2.99"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe"
checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407"
dependencies = [
 "quote",
 "wasm-bindgen-macro-support",


@@ 7274,9 7027,9 @@ dependencies = [

[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.99"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2"
checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de"
dependencies = [
 "proc-macro2",
 "quote",


@@ 7287,9 7040,12 @@ dependencies = [

[[package]]
name = "wasm-bindgen-shared"
version = "0.2.99"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6"
checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d"
dependencies = [
 "unicode-ident",
]

[[package]]
name = "wasm-pack"


@@ 7434,9 7190,9 @@ dependencies = [

[[package]]
name = "web-sys"
version = "0.3.76"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc"
checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2"
dependencies = [
 "js-sys",
 "wasm-bindgen",


@@ 8215,16 7971,6 @@ dependencies = [
]

[[package]]
name = "winreg"
version = "0.50.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
dependencies = [
 "cfg-if",
 "windows-sys 0.48.0",
]

[[package]]
name = "x11-dl"
version = "2.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"

M crates/client/Cargo.toml => crates/client/Cargo.toml +2 -1
@@ 34,7 34,8 @@ console_error_panic_hook = "0.1" # Give useful information in the panic response
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = ["Window", "Location", "WebSocket", "MessageEvent"] }
wasm-bindgen-futures = "0.4"
reqwest = "0.11"
ehttp = "0.5.0"
poll-promise = { version = "0.3.0", features = ["web"] }

# Native dependencies
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]

M crates/client/src/networking/mod.rs => crates/client/src/networking/mod.rs +5 -7
@@ 27,15 27,13 @@ pub fn process_packets(
                    if part.part_type == PartType::Hearty {
                        let mut player_query = world.query_filtered::<(&mut Translation, &mut Rotation), With<Player>>();
                        let mut camera = world.resource_mut::<Camera>();
                        /*camera.x = part.transform.x;
                        camera.y = part.transform.y;*/
                        camera.x = 0.0;
                        camera.y = 1.0;
                        camera.x = part.transform.x;
                        camera.y = part.transform.y;
                        tracing::info!("camera real {:?}", camera);
                        for (mut translation, mut rotation) in player_query.iter_mut(world) {
                            translation.x = 0.0;
                            translation.y = 1.0;
                            //rotation.radians = part.transform.rot;
                            translation.x = part.transform.x;
                            translation.y = part.transform.y;
                            rotation.radians = part.transform.rot;
                            tracing::info!("part real {:?}", translation);
                        }
                        tracing::info!("part {:?}", part.transform);

M crates/client/src/networking/ws_wasm.rs => crates/client/src/networking/ws_wasm.rs +3 -1
@@ 1,3 1,5 @@
use std::thread::yield_now;

use bevy_ecs::system::Resource;
//use crossbeam::channel::{unbounded, Receiver, Sender};
use futures::{channel::mpsc::{unbounded, UnboundedReceiver, UnboundedSender}, SinkExt};


@@ 64,7 66,7 @@ impl Ws {
    pub fn send_packet(&mut self, packet: Packet) {
        let socket = self.socket.0.clone();
        spawn_local(async move {
            while socket.ready_state() != 1 {}
            while socket.ready_state() != 1 { yield_now(); }
            socket.send_with_str(&serde_json::to_string(&packet).expect("Couldn't convert packet to json")).expect("Couldn't send packet to server");
        });
    }

M crates/client/src/rendering/assets_wasm.rs => crates/client/src/rendering/assets_wasm.rs +41 -50
@@ 1,8 1,9 @@
use std::{collections::HashMap, fmt::Display, sync::{Arc, Mutex}};
use std::{collections::HashMap, fmt::Display, sync::{Arc, Mutex}, time::Duration};

use bevy_ecs::system::Resource;
use futures::channel::oneshot::Receiver;
use image::EncodableLayout;
use poll_promise::Promise;
use resvg::{tiny_skia, usvg};
use wasm_bindgen_futures::spawn_local;



@@ 30,7 31,7 @@ pub struct ImgData {

#[derive(Resource)]
pub struct Assets {
    texture_receivers: Arc<Mutex<HashMap<String, Receiver<ImgData>>>>,
    texture_promises: Arc<Mutex<HashMap<String, Promise<ImgData>>>>,
    textures: Arc<Mutex<HashMap<String, ImgData>>>,
}



@@ 38,54 39,41 @@ impl Assets {
    pub fn new() -> Self {
        Assets {
            textures: Arc::new(Mutex::new(HashMap::new())),
            texture_receivers: Arc::new(Mutex::new(HashMap::new())),
            texture_promises: Arc::new(Mutex::new(HashMap::new())),
        }
    }
    pub fn get(&self, local_path: impl Into<String>) -> Option<ImgData> {
        let (tx, rx) = futures::channel::oneshot::channel();
        let local_path = local_path.into();
        tracing::info!("contains texture");
        let contains_texture = {
            self.textures.lock().unwrap().contains_key(&local_path)
        };
        let contains_texture_receiver = {
            self.texture_receivers.lock().unwrap().contains_key(&local_path)
        tracing::info!("contains texture promise");
        let contains_texture_promise = {
            self.texture_promises.lock().unwrap().contains_key(&local_path)
        };
        if !contains_texture && !contains_texture_receiver {
            let textures = self.textures.clone();
            {
                self.texture_receivers.lock().unwrap().insert(local_path.clone(), rx);
            }
            spawn_local(async move {
        if !contains_texture && !contains_texture_promise {
            tracing::info!("insert receiver");
            let local_path_clone = local_path.clone();
            let request_promise = poll_promise::Promise::spawn_local(async move {
                tracing::info!("in spawn local");
                let window = web_sys::window().unwrap();
                let resp = match reqwest::get(format!("{}/src/textures/{}", window.location().origin().unwrap(), local_path)).await {
                tracing::info!("after window");
                let request = ehttp::Request::get(format!("{}/src/textures/{}", window.location().origin().unwrap(), local_path_clone));
                let response = match ehttp::fetch_async(request).await {
                    Ok(resp) => resp,
                    Err(e) => {
                        if e.is_request() {
                            panic!("Error in request {}", e);
                        } else if e.is_body() {
                            panic!("Error in body {}", e);
                        } else if e.is_status() {
                            panic!("Bad status: {}", e.status().unwrap());
                        } else if e.is_decode() {
                            panic!("Couldn't decode response's body {}", e);
                        } else if e.is_redirect() {
                            panic!("Response caused redirect loop {}", e);
                        } else if e.is_builder() {
                            panic!("Error in builder {}", e);
                        }
                        panic!();
                        panic!("{}", e);
                    },
                };
                let bytes = match resp.bytes().await {
                    Ok(bytes) => bytes,
                    Err(e) => todo!(),
                }.to_vec();
                if local_path.ends_with(".svg") {
                tracing::info!("after response");
                tracing::info!("texture received");
                if local_path_clone.ends_with(".svg") {
                    let opt = usvg::Options {
                        default_size: usvg::Size::from_wh(20.0, 20.0).unwrap(),
                        ..Default::default()
                    };
                    let tree = usvg::Tree::from_data(&bytes, &opt).expect(&format!("Couldn't parse svg {}", local_path));
                    let tree = usvg::Tree::from_data(&response.bytes, &opt).expect(&format!("Couldn't parse svg {}", local_path_clone));
                    let tree_size = tree.size().to_int_size();
                    let size = usvg::Size::from_wh(100.0, 100.0).unwrap().to_int_size();
                    assert!(size.width() > 0 && size.height() > 0);


@@ 97,34 85,37 @@ impl Assets {
                        height: size.height(),
                    };
                    
                    {
                        textures.lock().unwrap().insert(local_path, data.clone());
                    }
                    tx.send(data).unwrap();
                } else if local_path.ends_with(".png") {
                    let img = image::load_from_memory(&bytes).unwrap();
                    data
                } else if local_path_clone.ends_with(".png") {
                    let img = image::load_from_memory(&response.bytes).unwrap();
                    let rgba = img.to_rgba8();
                    let data = ImgData {
                        bytes: rgba.as_bytes().to_vec(),
                        width: rgba.width(),
                        height: rgba.height(),
                    };
                    {
                        textures.lock().unwrap().insert(local_path, data.clone());
                    }
                    tx.send(data).unwrap();
                    data
                } else {
                    panic!("Unsupported sprite type");
                }
            });
            {
                self.texture_promises.lock().unwrap().insert(local_path.clone(), request_promise);
            }
            None
        } else if !contains_texture {
            let mut texture_receivers = self.texture_receivers.lock().unwrap();
            let rx = texture_receivers.get_mut(&local_path).unwrap();
            if let Ok(Some(texture)) = rx.try_recv() {
                self.texture_receivers.lock().unwrap().remove(&local_path);
                self.textures.lock().unwrap().insert(local_path, texture.clone());
                return Some(texture);
            tracing::info!("in contains texture");
            let mut texture_promises = self.texture_promises.lock().unwrap();
            tracing::info!("lock received");
            let promise = texture_promises.get_mut(&local_path).unwrap();
            tracing::info!("texture receiver gotten");
            let mut returned_value = None;
            if let Some(texture) = promise.ready() {
                self.textures.lock().unwrap().insert(local_path.clone(), texture.clone());
                returned_value = Some(texture.clone());
                texture_promises.remove(&local_path);
            }
            None
            return returned_value
        } else {
            self.textures.lock().unwrap().get(&local_path).cloned()
        }

M crates/client/src/rendering/renderer.rs => crates/client/src/rendering/renderer.rs +5 -6
@@ 298,12 298,12 @@ impl<T: UiRenderable> Renderer<T> {

        self.queue.write_buffer(&self.frame_uniform, 0, &frame_uniform);

        for (pos, shear, scale, tex, rot) in sprites_to_render {
            let tex = match self.textures.entry(tex.texture.clone()) {
        for (pos, shear, scale, sprite_tex, rot) in sprites_to_render {
            let tex = match self.textures.entry(sprite_tex.texture.clone()) {
                Entry::Occupied(entry) => entry.into_mut(),
                Entry::Vacant(entry) => {
                    let assets = self.world.get_resource::<Assets>().unwrap();
                    let b = match tex.texture.as_str() {
                    let b = match sprite_tex.texture.as_str() {
                        "f" => match assets.get("f.png") {
                            Some(b) => b,
                            None => continue,


@@ 368,15 368,14 @@ impl<T: UiRenderable> Renderer<T> {
                    };
                    entry.insert(texture::Texture::new(
                        b,
                        &tex.texture,
                        &sprite_tex.texture,
                        &self.device,
                        &self.queue,
                        &mut self.mip_generator,
                    ))
                }
            };

            info!("render: {:?}", pos);
            tracing::info!("{} {:?} {:?}", sprite_tex.texture, pos, tex.texture);
            let xy_matrix = pos.as_matrix();
            let shear_matrix = shear.as_matrix();
            let rot_matrix = rot.as_matrix();

M crates/client/src/rendering/texture.rs => crates/client/src/rendering/texture.rs +1 -1
@@ 69,7 69,7 @@ impl Texture {

        let tex = Self { texture, sampler };

        mip_generator.generate_mips(&tex, device, queue);
        //mip_generator.generate_mips(&tex, device, queue);

        tex
    }