2020-04-11 15:08:57 +00:00
|
|
|
# bitsy-parser
|
2020-04-05 17:58:04 +00:00
|
|
|
|
2020-04-18 16:00:03 +00:00
|
|
|
![Rust](https://github.com/synth-ruiner/bitsy-parser/workflows/Rust/badge.svg)
|
2020-04-18 16:05:37 +00:00
|
|
|
![](https://img.shields.io/badge/license-MIT-blueviolet.svg)
|
|
|
|
[![Crates.io](https://img.shields.io/crates/v/bitsy-parser.svg)](https://crates.io/crates/bitsy-parser)
|
2020-04-18 16:00:03 +00:00
|
|
|
|
2020-04-05 17:58:04 +00:00
|
|
|
a library for parsing Bitsy game data.
|
|
|
|
|
2020-04-30 21:18:43 +00:00
|
|
|
the version number follows Bitsy itself, so version 0.70.* targets Bitsy 7.0.
|
2020-04-12 13:48:43 +00:00
|
|
|
|
2020-04-12 16:13:08 +00:00
|
|
|
## how to use
|
|
|
|
|
2020-04-13 18:28:22 +00:00
|
|
|
a simple example program:
|
|
|
|
|
2020-04-12 16:13:08 +00:00
|
|
|
```rust
|
|
|
|
extern crate bitsy_parser;
|
|
|
|
use bitsy_parser::game::Game;
|
2020-06-18 18:55:28 +00:00
|
|
|
use std::{env, fs};
|
2020-04-12 16:13:08 +00:00
|
|
|
|
2020-07-01 15:23:28 +00:00
|
|
|
const SYNTAX_ERROR: &str = "No input path specified. Usage: `bitsy-validate filepath`";
|
2020-04-12 16:13:08 +00:00
|
|
|
|
2020-07-01 15:23:28 +00:00
|
|
|
fn main() {
|
|
|
|
let input = env::args().nth(1).expect(SYNTAX_ERROR);
|
|
|
|
Game::from(fs::read_to_string(input).unwrap()).unwrap();
|
2020-06-18 18:55:28 +00:00
|
|
|
println!("OK!");
|
2020-04-12 16:13:08 +00:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
some more practical uses would be things like:
|
|
|
|
|
|
|
|
* remove duplicate tiles
|
|
|
|
* merge two Bitsy games together
|
|
|
|
* programmatically create Bitsy games
|
|
|
|
* a Bitsy game editor
|
|
|
|
|
2020-04-05 17:58:04 +00:00
|
|
|
## todo
|
|
|
|
|
2020-06-24 11:39:26 +00:00
|
|
|
* implement Result return types on ::from functions so that we can handle errors
|
2020-06-27 18:28:17 +00:00
|
|
|
* replace Image with Vec<u8> or something. seems like a pointless abstraction.
|
2020-06-18 16:48:25 +00:00
|
|
|
* replace game avatar with helper functions to get and set the sprite with an ID of A
|
2020-07-01 14:25:12 +00:00
|
|
|
* implement PartialEq for sprites, items etc. for deduplication
|
|
|
|
* global dedupe function and dedupe functions for sprites, items etc.
|
2020-06-27 18:28:17 +00:00
|
|
|
* tests for merge function
|
2020-06-28 08:11:33 +00:00
|
|
|
* all sprites from the merged game get placed in their respective game's Room 0
|
2020-06-27 18:28:17 +00:00
|
|
|
* exits in merged rooms do not work - the on-screen position is correct, but the room ID is wrong
|
|
|
|
* add update function (i.e. migrate an old game version to the current one) - would this work?
|
2020-04-13 23:41:28 +00:00
|
|
|
|
2020-04-05 18:04:17 +00:00
|
|
|
### tidy up
|
|
|
|
|
2020-04-12 13:38:07 +00:00
|
|
|
* refactor the more shonky bits to idiomatic rust
|