attempt to move state to wasm

This commit is contained in:
2020-10-30 17:32:49 +00:00
parent 4d2330b8fd
commit 35af495f51
3 changed files with 38 additions and 13 deletions

View File

@@ -2,9 +2,35 @@ use bitsy_parser::game::Game;
use bitsy_parser::image::Image;
use bitsy_parser::tile::Tile;
use image::{GenericImageView, Pixel};
// use lazy_static::lazy_static;
// use std::sync::Mutex;
use wasm_bindgen::prelude::*;
const SD: u32 = 8;
//
// struct State {
// game: Option<Game>,
// image: Option<Image>,
// prefix: String,
// invert: bool,
// flip: bool,
// mirror: bool,
// rotate: bool,
// }
// lazy_static! {
// static ref STATE: Mutex<State> = Mutex::new(
// State {
// game: None,
// image: None,
// prefix: "".to_string(),
// invert: false,
// flip: false,
// mirror: false,
// rotate: false,
// }
// );
// }
#[wasm_bindgen]
pub fn load_default_game_data() -> String {
@@ -146,6 +172,9 @@ pub fn add_tiles(
}
game.dedupe_tiles();
let game = game;
game.to_string()
}