diff --git a/Cargo.toml b/Cargo.toml index 8b8d373..754d1e4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,27 +1,19 @@ [package] name = "tilesy" -version = "0.1.0" +version = "0.72.0" description = "a tilesheet importer for the Bitsy game engine" authors = ["Max Bradbury "] edition = "2018" license = "MIT" +repository = "https://tinybird.dev/max/tilesy" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] -crate-type = ["cdylib", "rlib"] +crate-type = ["cdylib"] [dependencies] "base64" = "^0.12.3" "bitsy-parser" = "^0.72.0" "image" = "^0.23.7" +"lazy_static" = "^1.4.0" "wasm-bindgen" = "^0.2.64" - -[dependencies.web-sys] -version = "^0.3.4" -features = [ - 'Document', - 'Element', - 'HtmlElement', - 'Node', - 'Window', -] diff --git a/script.js b/script.js index 1a4e514..cac69c5 100644 --- a/script.js +++ b/script.js @@ -1,4 +1,8 @@ -import init, {load_default_game_data, add_tiles} from './pkg/bitsy_tiles.js'; +import init, {load_default_game_data, add_tiles} from './pkg/tilesy.js'; + +// if (typeof WebAssembly !== "object") { +// document.getElementById("start").innerText = "Sorry - your browser does not support WebAssembly"; +// } // stolen from https://ourcodeworld.com/articles/read/189/how-to-create-a-file-and-generate-a-download-with-javascript-in-the-browser-without-a-server function download(filename, text) { diff --git a/src/lib.rs b/src/lib.rs index a7316bf..f8dd11c 100644 --- a/src/lib.rs +++ b/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, +// image: Option, +// prefix: String, +// invert: bool, +// flip: bool, +// mirror: bool, +// rotate: bool, +// } + +// lazy_static! { +// static ref STATE: Mutex = 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() }