From c38d3697254002b05b26cce169d630750da6915d Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Mon, 6 Apr 2020 12:26:26 +0100 Subject: [PATCH] rearrange --- src/main.rs | 158 ++++++++++++++++++++++++++-------------------------- 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/src/main.rs b/src/main.rs index 683b724..23a21a9 100644 --- a/src/main.rs +++ b/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, } +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();