Compare commits
12 Commits
52728e601b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c444cb35d | |||
| a2c92b1e12 | |||
| 57b841ac3d | |||
| 3bbf51e5f8 | |||
| 7af54d938b | |||
| f224fe1e27 | |||
| e6fda7266e | |||
| f223e51195 | |||
| d72a4df55e | |||
| 0f23b878b2 | |||
| 23b99b8ea7 | |||
| c8b6c772ab |
@@ -1,19 +1,19 @@
|
||||
[package]
|
||||
name = "pixsy"
|
||||
version = "0.72.7"
|
||||
version = "0.710.0"
|
||||
description = "convert images to Bitsy rooms"
|
||||
authors = ["Max Bradbury <max@tinybird.info>"]
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
repository = "https://tinybird.dev/max/image-to-bitsy"
|
||||
repository = "https://tinybird.dev/max/pixsy"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
[dependencies]
|
||||
base64 = "^0.12.3"
|
||||
bitsy-parser = "^0.72.5"
|
||||
bitsy-parser = "^0.710.0"
|
||||
image = "^0.23.7"
|
||||
json = "^0.12.4"
|
||||
lazy_static = "^1.4.0"
|
||||
wasm-bindgen = "=0.2.64" # newer versions are bugged...
|
||||
wasm-bindgen = "^0.2.78"
|
||||
|
||||
@@ -22,6 +22,11 @@ button {
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
|
||||
&.half {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
&.pagination:not(.normal) {
|
||||
position: absolute;
|
||||
bottom: 5vmin;
|
||||
|
||||
30
index.pug
30
index.pug
@@ -8,11 +8,9 @@ html(lang="en-gb")
|
||||
script(src="includes/croppie.min.js")
|
||||
body
|
||||
header
|
||||
h1
|
||||
| pixsy
|
||||
//img(alt="pixsy" src="includes/pixsy.png")
|
||||
h1 pixsy
|
||||
p.
|
||||
version 0.72.7
|
||||
version 0.710.0
|
||||
|
|
||||
#[a(href="http://tinybird.info/image-to-bitsy/old/" target="_blank") old version]
|
||||
|
|
||||
@@ -22,16 +20,21 @@ html(lang="en-gb")
|
||||
.pages
|
||||
.page#start
|
||||
p.
|
||||
#[b pixsy] is a tool for #[a(href="http://bitsy.org/") Bitsy Game Maker]
|
||||
#[b pixsy] is a tool for #[a(href="https://bitsy.org/") Bitsy Game Maker]
|
||||
that allows you to generate a room from an image and add it to your game.
|
||||
p this version is compatible with Bitsy version 7.2 and earlier.
|
||||
p.
|
||||
this version is tested to be compatible with Bitsy version 7.10 and earlier.
|
||||
later versions may also work fine, but make sure you have a backup of your game data.
|
||||
p.
|
||||
#[b pixsy] does not currently work via the Itch desktop program.
|
||||
some users are also currently reporting problems.
|
||||
if pixsy does not work for you, please try the
|
||||
#[a(href="http://tinybird.info/image-to-bitsy/old/") old version] instead.
|
||||
p.
|
||||
instructions can be found on the
|
||||
if your image is already the correct size for a bitsy room (128×128),
|
||||
simply leave the zoom slider at the default setting.
|
||||
you can draw your room in a pixel-art program and import it here.
|
||||
p.
|
||||
full instructions can be found on the
|
||||
#[a(href="https://ruin.itch.io/pixsy/") itch.io page] -
|
||||
scroll down to "how to use".
|
||||
|
||||
@@ -92,21 +95,22 @@ html(lang="en-gb")
|
||||
input#colour-foreground(type="color" value="#ffffff")
|
||||
|
||||
label
|
||||
input#dither(type="checkbox" checked=true)
|
||||
input#dither(type="checkbox")
|
||||
| dither
|
||||
p (approximates a greyscale effect)
|
||||
br
|
||||
|
||||
button.pagination.prev#back-to-image previous
|
||||
button.pagination.next#room-next add room
|
||||
.page.download
|
||||
h2 done!
|
||||
|
||||
p#added
|
||||
|
||||
h2 download
|
||||
|
||||
textarea#output(autocomplete="off")
|
||||
br
|
||||
|
||||
button#download download
|
||||
button#clipboard.half copy to clipboard
|
||||
button#download.half download
|
||||
|
||||
button.pagination.prev#add add another image
|
||||
button.pagination.start#reset start again
|
||||
|
||||
22
script.js
22
script.js
@@ -24,6 +24,18 @@ function download(filename, text) {
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
|
||||
function copyToClipboard() {
|
||||
const button = el("clipboard");
|
||||
|
||||
el("output").select();
|
||||
document.execCommand("copy");
|
||||
button.innerText = "copied!";
|
||||
|
||||
setTimeout(() => {
|
||||
button.innerText = "copy to clipboard";
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
function el(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
@@ -64,6 +76,7 @@ async function run() {
|
||||
|
||||
const buttonAddImage = el("add");
|
||||
const buttonBackToImage = el("back-to-image");
|
||||
const buttonCopyToClipboard = el("clipboard")
|
||||
const buttonDownload = el("download");
|
||||
const buttonGameDataProceed = el("game-data-next");
|
||||
const buttonImageProceed = el("image-next");
|
||||
@@ -126,14 +139,12 @@ async function run() {
|
||||
el("game").addEventListener("change", function() {
|
||||
readFile(this, function (e) {
|
||||
textareaGameDataInput.value = e.target.result;
|
||||
console.log(load_game(e.target.result));
|
||||
checkGameData();
|
||||
}, "text");
|
||||
});
|
||||
|
||||
function setPaletteDropdown() {
|
||||
const palettes = JSON.parse(get_palettes());
|
||||
console.debug(palettes);
|
||||
|
||||
selectPalette.innerHTML = "";
|
||||
|
||||
@@ -153,7 +164,9 @@ async function run() {
|
||||
}
|
||||
|
||||
function checkGameData() {
|
||||
if (textareaGameDataInput.value.length > 0) {
|
||||
let result = load_game(textareaGameDataInput.value)
|
||||
|
||||
if (result === "Loaded game") {
|
||||
buttonGameDataProceed.removeAttribute("disabled");
|
||||
setPaletteDropdown();
|
||||
} else {
|
||||
@@ -241,6 +254,9 @@ async function run() {
|
||||
download("output.bitsy", textareaGameDataOutput.value);
|
||||
}
|
||||
|
||||
buttonCopyToClipboard.addEventListener("click", copyToClipboard);
|
||||
buttonCopyToClipboard.addEventListener("touchend", copyToClipboard);
|
||||
|
||||
buttonDownload.addEventListener("click", handleDownload);
|
||||
buttonDownload.addEventListener("touchend", handleDownload);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ lazy_static! {
|
||||
image: None,
|
||||
room_name: None,
|
||||
palette: SelectedPalette::None,
|
||||
dither: true,
|
||||
dither: false,
|
||||
brightness: 0,
|
||||
}
|
||||
);
|
||||
@@ -199,7 +199,7 @@ fn palette_from(bg: &bitsy_parser::Colour, fg: &bitsy_parser::Colour) -> bitsy_p
|
||||
}
|
||||
|
||||
fn render_preview(state: &State) -> DynamicImage {
|
||||
let mut buffer = state.image.as_ref().unwrap().clone().into_rgba();
|
||||
let mut buffer = state.image.as_ref().unwrap().clone().into_rgba8();
|
||||
|
||||
let palette = match &state.palette {
|
||||
SelectedPalette::None => bitsy_parser::mock::game_default().palettes[0].clone(),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Write your game's title here
|
||||
|
||||
# BITSY VERSION 7.2
|
||||
# BITSY VERSION 7.5
|
||||
|
||||
! ROOM_FORMAT 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user