rearrange
This commit is contained in:
parent
ad43f73027
commit
c38d369725
158
src/main.rs
158
src/main.rs
|
@ -4,85 +4,6 @@ use std::fmt;
|
|||
const IMAGE_DIMENSION_SD: usize = 8;
|
||||
const IMAGE_DIMENSION_HD: usize = 16;
|
||||
|
||||
fn test_image_chequers_1() -> Image {
|
||||
Image {
|
||||
pixels: vec![
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
fn test_image_chequers_2() -> Image {
|
||||
Image {
|
||||
pixels: vec![
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
fn test_sprite() -> Sprite {
|
||||
Sprite {
|
||||
id: "a".to_string(),
|
||||
name: Some("hatch".to_string()),
|
||||
animation_frames: vec![
|
||||
Image {
|
||||
pixels: vec![
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,1,1,1,1,0,0,0,
|
||||
0,1,0,0,1,0,0,0,
|
||||
0,0,1,1,1,1,0,0,
|
||||
0,0,1,1,1,1,0,0,
|
||||
0,1,0,1,1,1,1,0,
|
||||
0,1,0,1,1,1,1,0,
|
||||
0,1,1,0,1,1,1,1,
|
||||
]
|
||||
}
|
||||
],
|
||||
dialogue: Some("SPR_0".to_string()),
|
||||
position: Position {
|
||||
room: "4".to_string(),
|
||||
x: 9,
|
||||
y: 7
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn test_item() -> Item {
|
||||
Item {
|
||||
id: "6".to_string(),
|
||||
animation_frames: vec![
|
||||
Image {
|
||||
pixels: vec![
|
||||
0,1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,1,0,0,
|
||||
0,0,1,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,1,0,
|
||||
]
|
||||
}
|
||||
],
|
||||
name: Some("door".to_string()),
|
||||
dialogue: Some("ITM_2".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
struct Colour {
|
||||
red: u8,
|
||||
|
@ -179,6 +100,85 @@ struct Game {
|
|||
palettes: Vec<Palette>,
|
||||
}
|
||||
|
||||
fn test_image_chequers_1() -> Image {
|
||||
Image {
|
||||
pixels: vec![
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
fn test_image_chequers_2() -> Image {
|
||||
Image {
|
||||
pixels: vec![
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
0,1,0,1,0,1,0,1,
|
||||
1,0,1,0,1,0,1,0,
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
fn test_sprite() -> Sprite {
|
||||
Sprite {
|
||||
id: "a".to_string(),
|
||||
name: Some("hatch".to_string()),
|
||||
animation_frames: vec![
|
||||
Image {
|
||||
pixels: vec![
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,1,1,1,1,0,0,0,
|
||||
0,1,0,0,1,0,0,0,
|
||||
0,0,1,1,1,1,0,0,
|
||||
0,0,1,1,1,1,0,0,
|
||||
0,1,0,1,1,1,1,0,
|
||||
0,1,0,1,1,1,1,0,
|
||||
0,1,1,0,1,1,1,1,
|
||||
]
|
||||
}
|
||||
],
|
||||
dialogue: Some("SPR_0".to_string()),
|
||||
room: "4".to_string(),
|
||||
position: Position {
|
||||
x: 9,
|
||||
y: 7
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn test_item() -> Item {
|
||||
Item {
|
||||
id: "6".to_string(),
|
||||
animation_frames: vec![
|
||||
Image {
|
||||
pixels: vec![
|
||||
0,1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,1,0,0,
|
||||
0,0,1,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,1,0,
|
||||
]
|
||||
}
|
||||
],
|
||||
name: Some("door".to_string()),
|
||||
dialogue: Some("ITM_2".to_string())
|
||||
}
|
||||
}
|
||||
|
||||
fn image_from_string(string: String) -> Image {
|
||||
let string = string.replace("\n", "");
|
||||
let pixels: Vec<&str> = string.split("").collect();
|
||||
|
|
Loading…
Reference in New Issue