2020-04-12 12:41:27 +00:00
|
|
|
pub mod avatar;
|
2020-04-12 11:22:20 +00:00
|
|
|
pub mod colour;
|
2020-04-12 12:26:33 +00:00
|
|
|
pub mod dialogue;
|
2020-04-12 12:52:36 +00:00
|
|
|
pub mod ending;
|
2020-04-12 12:49:19 +00:00
|
|
|
pub mod exit;
|
2020-04-12 13:38:07 +00:00
|
|
|
pub mod game;
|
2020-04-12 11:35:39 +00:00
|
|
|
pub mod palette;
|
2020-04-12 11:48:07 +00:00
|
|
|
pub mod image;
|
2020-04-12 12:46:55 +00:00
|
|
|
pub mod item;
|
2020-04-12 12:50:07 +00:00
|
|
|
pub mod mock;
|
2020-04-12 12:21:27 +00:00
|
|
|
pub mod position;
|
2020-04-12 13:28:11 +00:00
|
|
|
pub mod room;
|
2020-04-12 12:35:17 +00:00
|
|
|
pub mod sprite;
|
2020-04-12 11:53:11 +00:00
|
|
|
pub mod tile;
|
2020-04-12 13:20:53 +00:00
|
|
|
pub mod variable;
|
2020-04-12 11:22:20 +00:00
|
|
|
|
2020-04-12 12:41:27 +00:00
|
|
|
use avatar::Avatar;
|
2020-04-12 11:35:39 +00:00
|
|
|
use colour::Colour;
|
2020-04-12 12:26:33 +00:00
|
|
|
use dialogue::Dialogue;
|
2020-04-12 12:52:36 +00:00
|
|
|
use ending::Ending;
|
2020-04-12 12:49:19 +00:00
|
|
|
use exit::Exit;
|
2020-04-12 13:38:07 +00:00
|
|
|
use game::Game;
|
2020-04-12 11:35:39 +00:00
|
|
|
use palette::Palette;
|
2020-04-12 11:48:07 +00:00
|
|
|
use image::Image;
|
2020-04-12 12:46:55 +00:00
|
|
|
use item::Item;
|
2020-04-12 12:21:27 +00:00
|
|
|
use position::Position;
|
2020-04-12 13:28:11 +00:00
|
|
|
use room::Room;
|
2020-04-12 12:35:17 +00:00
|
|
|
use sprite::Sprite;
|
2020-04-12 11:53:11 +00:00
|
|
|
use tile::Tile;
|
2020-04-12 13:20:53 +00:00
|
|
|
use variable::Variable;
|
2020-04-05 17:58:04 +00:00
|
|
|
|
2020-04-10 15:27:23 +00:00
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
2020-04-12 11:53:11 +00:00
|
|
|
pub struct Instance {
|
2020-04-10 15:27:23 +00:00
|
|
|
position: Position,
|
2020-04-12 12:52:36 +00:00
|
|
|
id: String, // item / ending.rs id
|
2020-04-10 15:27:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
2020-04-12 11:53:11 +00:00
|
|
|
pub struct ExitInstance {
|
2020-04-10 15:27:23 +00:00
|
|
|
position: Position,
|
|
|
|
exit: Exit,
|
|
|
|
}
|
|
|
|
|
2020-04-12 10:22:14 +00:00
|
|
|
pub trait AnimationFrames {
|
|
|
|
fn to_string(&self) -> String;
|
|
|
|
}
|
|
|
|
|
|
|
|
impl AnimationFrames for Vec<Image> {
|
|
|
|
#[inline]
|
|
|
|
fn to_string(&self) -> String {
|
|
|
|
let mut string = String::new();
|
|
|
|
let last_frame = self.len() - 1;
|
2020-04-06 06:23:20 +00:00
|
|
|
|
2020-04-12 10:22:14 +00:00
|
|
|
for (i, frame) in self.into_iter().enumerate() {
|
|
|
|
string.push_str(&frame.to_string());
|
2020-04-06 06:23:20 +00:00
|
|
|
|
2020-04-12 10:22:14 +00:00
|
|
|
if i < last_frame {
|
|
|
|
string.push_str(&"\n>\n".to_string());
|
|
|
|
}
|
2020-04-06 06:23:20 +00:00
|
|
|
}
|
|
|
|
|
2020-04-12 10:22:14 +00:00
|
|
|
string
|
|
|
|
}
|
2020-04-06 06:23:20 +00:00
|
|
|
}
|