public mocks etc.

This commit is contained in:
Max Bradbury 2022-03-12 18:14:55 +00:00
parent c962748797
commit c3ee95e31a
1 changed files with 67 additions and 5 deletions

View File

@ -1,4 +1,4 @@
pub(crate) mod image { pub mod image {
use crate::image::Image; use crate::image::Image;
pub fn _bg() -> Image { pub fn _bg() -> Image {
@ -66,7 +66,7 @@ pub(crate) mod image {
} }
} }
pub(crate) mod palette { pub mod palette {
use crate::{Palette, Colour}; use crate::{Palette, Colour};
pub(crate) fn default() -> Palette { pub(crate) fn default() -> Palette {
@ -80,7 +80,7 @@ pub(crate) mod palette {
} }
} }
pub(crate) fn soup11() -> Palette { pub fn soup11() -> Palette {
Palette { Palette {
name: "soup11".into(), name: "soup11".into(),
colours: vec![ colours: vec![
@ -100,10 +100,10 @@ pub(crate) mod palette {
} }
} }
pub(crate) mod scenes { pub mod scenes {
use crate::Scene; use crate::Scene;
pub(crate) fn zero() -> Scene { pub fn zero() -> Scene {
Scene { Scene {
name: "zero".into(), name: "zero".into(),
background: vec![ background: vec![
@ -145,3 +145,65 @@ pub(crate) mod scenes {
} }
} }
} }
pub mod entities {
use crate::Entity;
pub fn bitsy_avatar() -> Entity {
Entity {
name: "".to_string(),
image: "avatar".to_string(),
tags: vec!["player".into()]
}
}
pub fn bitsy_cat() -> Entity {
Entity {
name: "cat".to_string(),
image: "cat".to_string(),
tags: vec![]
}
}
}
pub mod tiles {
use crate::Tile;
pub fn bitsy_block() -> Tile {
Tile {
name: "block".into(),
images: vec!["block".into()],
wall: false
}
}
}
pub mod game {
use crate::{Config, Game};
pub fn bitsy() -> Game {
Game {
config: Config {
name: Some("Write your game's title here".into()),
width: 16,
height: 16,
tick: 400,
starting_room: None,
version: (0, 1)
},
entities: vec![
crate::mock::entities::bitsy_avatar(),
crate::mock::entities::bitsy_cat(),
],
images: vec![],
palettes: vec![],
scenes: vec![
crate::mock::scenes::zero(),
],
tiles: vec![
crate::mock::tiles::bitsy_block(),
],
music: vec![]
}
}
}