diff options
Diffstat (limited to 'crates/throwshade')
| -rw-r--r-- | crates/throwshade/src/lib.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/throwshade/src/lib.rs b/crates/throwshade/src/lib.rs index f6ee8a6..ab1c9bf 100644 --- a/crates/throwshade/src/lib.rs +++ b/crates/throwshade/src/lib.rs @@ -41,7 +41,7 @@ cfg_if::cfg_if! { throwshade: ThrowShade, } impl Game { - pub async fn new(_ctx: &context::Context) -> Self { + pub fn new(_ctx: &context::Context) -> Self { Self { throwshade: ThrowShade::new(), } @@ -65,18 +65,20 @@ cfg_if::cfg_if! { use wasm_bindgen::prelude::*; #[wasm_bindgen] - pub async fn main_js() { - teleia::run(1920, 1080, teleia::Options::NORESIZE, Game::new).await; + pub fn main_js() { + teleia::run(1920, 1080, teleia::Options::NORESIZE, Game::new); } #[wasm_bindgen] - pub async fn set_shader(s: &str) { + pub async fn set_shader(s: &str) -> Result<(), String> { contextualize(|ctx, st, g: &mut Game| { log::info!("set shader: {}", s); if let Err(e) = g.throwshade.set(ctx, st, &s) { log::warn!("error compiling shader: {}", e); g.throwshade.shader = None; + return Err(format!("{}", e)); } - }); + Ok(()) + }) } } } |
