1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
mod contained;
mod linear;
use quicksilver::{
geom::{Rectangle, Vector},
graphics::Graphics,
Result,
};
pub use crate::{
contained::BasicAnimationContainer,
linear::{Linear, LinearConfig, SimpleLinearConfig},
};
pub trait BasicAnimation {
fn draw(&mut self, gfx: &mut Graphics, location: Rectangle) -> Result<()>;
fn contain(self, location: Rectangle) -> BasicAnimationContainer<Self>
where
Self: Sized,
{
BasicAnimationContainer {
location,
animation: self,
}
}
}
pub trait ContainedAnimation {
fn draw(&mut self, gfx: &mut Graphics) -> Result<()>;
fn set_location(&mut self, location: Vector);
fn set_size(&mut self, size: Vector);
fn get_draw_pos(&self) -> Rectangle;
fn get_position(&self) -> Vector;
fn get_size(&self) -> Vector;
}
pub trait EditableState<T> {
fn set_state(&mut self, new_state: T);
fn get_state(&self) -> &T;
}
pub trait Resetable {
fn reset(&mut self);
}