attempt to move state to wasm
This commit is contained in:
29
src/lib.rs
29
src/lib.rs
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user