blob: 7e368b8d4c16caae4975293e36ab15acb7c4b2dd (
plain)
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
|
use ggez::graphics::Image;
use std::{collections::BTreeMap, path::Path};
/// Construct a `node` prefixed URI
pub fn node(tt: &str) -> URI {
("node/".to_owned() + tt).into()
}
#[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd)]
pub struct URI(String, String);
impl From<&'static str> for URI {
fn from(s: &'static str) -> Self {
let mut v: Vec<_> = s.split("/").collect();
Self(v.remove(0).into(), v.remove(0).into())
}
}
impl From<String> for URI {
fn from(s: String) -> Self {
let mut v: Vec<_> = s.split("/").collect();
Self(v.remove(0).into(), v.remove(0).into())
}
}
/// Asset loader
pub struct Assets {
inner: BTreeMap<URI, Image>,
}
impl Assets {
pub fn load(p: &Path) -> Self {
Self {
inner: Default::default(),
}
}
}
/// A utility function to take an SVG and render it to a raster image
/// according to a render spec
fn load_svg(p: &Path) -> () {
}
|