Skip to main content

embed/
embed.rs

1use std::collections::HashMap;
2use gasm_host::{assets::Assets, gfx::Gfx, host::{Game, Host}, net::Net, storage::Storage};
3
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5    let host = Host::new(Assets::new(), HashMap::new(), None, Gfx::null(), Net::new(false), Storage::memory());
6    let mut game = Game::load(&std::fs::read("game.wasm")?, host)?;
7    for _ in 0..600 {
8        game.frame()?;                    // call at game.host().frame_rate Hz
9    }
10    let h = game.host();
11    println!("{}x{}, video hash {:08x}", h.width, h.height, h.video_hash.0);
12    Ok(())
13}
14