Skip to content
Snippets Groups Projects
Commit 2d5e4e8b authored by John Mitchell's avatar John Mitchell
Browse files

Fixed issue where wasm fails to build.

parent 41c63963
No related branches found
No related tags found
No related merge requests found
use bevy::{
asset::{AssetLoader, FileAssetIo, LoadContext, LoadedAsset},
asset::{AssetLoader, LoadContext, LoadedAsset},
render::render_resource::{Extent3d, TextureFormat},
utils::{BoxedFuture, HashMap},
};
#[cfg(not(target_family = "wasm"))]
use bevy::asset::FileAssetIo;
use image::{EncodableLayout, RgbaImage};
use nanoserde::DeJson;
......@@ -26,10 +30,12 @@ impl AssetLoader for TTFLoader {
load_context: &'a mut LoadContext,
) -> BoxedFuture<'a, Result<(), anyhow::Error>> {
Box::pin(async move {
#[cfg(not(target_family = "wasm"))]
let asset_io = load_context
.asset_io()
.downcast_ref::<FileAssetIo>()
.unwrap();
let kttf: KTTF =
nanoserde::DeJson::deserialize_json(std::str::from_utf8(bytes).unwrap()).unwrap();
......@@ -179,6 +185,7 @@ impl AssetLoader for TTFLoader {
}
let image_bytes = if cache_image.is_err() {
#[cfg(not(target_family = "wasm"))]
image_builder
.save(asset_io.root_path().join(cache_path))
.unwrap();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment