parent
a6a1949914
commit
f5b36ff6b9
File diff suppressed because it is too large
Load Diff
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 4.4 KiB |
@ -0,0 +1,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) -> () { |
||||
|
||||
} |
Loading…
Reference in new issue