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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use crate::{Glyph, GlyphTint, Point};
#[derive(Debug)]
pub struct Positioned(pub Point);
impl Into<Point> for Positioned {
fn into(self) -> Point {
self.0
}
}
impl Into<Positioned> for Point {
fn into(self) -> Positioned {
Positioned(self)
}
}
impl Positioned {
pub fn at(x: i16, y: i16) -> Self {
Positioned((x, y).into())
}
pub fn new(p: impl Into<Point>) -> Self {
Positioned(p.into())
}
pub fn update(&mut self, p: impl Into<Point>) {
self.0 = p.into();
}
pub fn get(&self) -> Point {
self.0
}
}
pub struct Visible(pub Glyph);
impl Visible {
pub fn new(g: Glyph) -> Self {
Visible(g)
}
pub fn get(&self) -> Glyph {
self.0
}
}
impl Into<Glyph> for Visible {
fn into(self) -> Glyph {
self.0
}
}
impl Into<Option<char>> for Visible {
fn into(self) -> Option<char> {
self.0.symbol
}
}
impl Into<GlyphTint> for Visible {
fn into(self) -> GlyphTint {
self.0.tint
}
}
pub struct PlayerTag;