rstnode: add basic node assets

wip/yesman
Katharina Fey 3 years ago
parent a6a1949914
commit f5b36ff6b9
Signed by: kookie
GPG Key ID: 90734A9E619C8A6C
  1. 773
      games/rstnode/Cargo.lock
  2. 76
      games/rstnode/assets/raw/frame_l.svg
  3. 76
      games/rstnode/assets/raw/frame_m.svg
  4. 76
      games/rstnode/assets/raw/frame_s.svg
  5. 76
      games/rstnode/assets/raw/frame_xl.svg
  6. 109
      games/rstnode/assets/raw/relay1.svg
  7. 4
      games/rstnode/rst-client/Cargo.toml
  8. 44
      games/rstnode/rst-client/src/assets.rs
  9. 2
      games/rstnode/rst-client/src/graphics/entities/mod.rs
  10. 13
      games/rstnode/rst-client/src/main.rs
  11. 2
      games/rstnode/rst-client/src/settings.rs
  12. 11
      games/rstnode/shell.nix

File diff suppressed because it is too large Load Diff

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512"
height="512"
viewBox="0 0 135.46666 135.46667"
version="1.1"
id="svg8"
sodipodi:docname="frame_l.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.3267698"
inkscape:cx="246.52088"
inkscape:cy="257.15002"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
units="px"
inkscape:window-width="2554"
inkscape:window-height="1388"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<ellipse
style="fill:none;stroke:#000000;stroke-width:11.1125;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="circle933"
cx="67.73333"
cy="67.73333"
rx="61.07827"
ry="61.078381" />
<path
style="fill:none;stroke:#cccccc;stroke-width:8.46667;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="ellipse945"
sodipodi:type="arc"
sodipodi:cx="67.73333"
sodipodi:cy="67.73333"
sodipodi:rx="61.07827"
sodipodi:ry="61.078381"
sodipodi:start="5.2835838"
sodipodi:end="1.4966888"
sodipodi:arc-type="arc"
d="M 100.75454,16.350799 A 61.07827,61.078381 0 0 1 126.93477,82.758161 61.07827,61.078381 0 0 1 72.255547,128.64407"
sodipodi:open="true" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512"
height="512"
viewBox="0 0 135.46666 135.46667"
version="1.1"
id="svg8"
sodipodi:docname="frame_m.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.3267698"
inkscape:cx="246.52088"
inkscape:cy="257.15002"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
units="px"
inkscape:window-width="2554"
inkscape:window-height="1388"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<ellipse
style="fill:none;stroke:#000000;stroke-width:11.1125;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="circle933"
cx="67.73333"
cy="67.73333"
rx="61.07827"
ry="61.078381" />
<path
style="fill:none;stroke:#cccccc;stroke-width:8.46667;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="ellipse945"
sodipodi:type="arc"
sodipodi:cx="67.73333"
sodipodi:cy="67.73333"
sodipodi:rx="61.07827"
sodipodi:ry="61.078381"
sodipodi:start="6.2489931"
sodipodi:end="1.4966888"
sodipodi:arc-type="arc"
d="M 128.7759,65.645332 A 61.07827,61.078381 0 0 1 72.255547,128.64407"
sodipodi:open="true" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512"
height="512"
viewBox="0 0 135.46666 135.46667"
version="1.1"
id="svg8"
sodipodi:docname="frame_s.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.3267698"
inkscape:cx="246.52088"
inkscape:cy="257.15002"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
units="px"
inkscape:window-width="2554"
inkscape:window-height="1388"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<ellipse
style="fill:none;stroke:#000000;stroke-width:11.1125;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="circle933"
cx="67.73333"
cy="67.73333"
rx="61.07827"
ry="61.078381" />
<path
style="fill:none;stroke:#cccccc;stroke-width:8.46667;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="ellipse945"
sodipodi:type="arc"
sodipodi:cx="67.73333"
sodipodi:cy="67.73333"
sodipodi:rx="61.07827"
sodipodi:ry="61.078381"
sodipodi:start="0.39474561"
sodipodi:end="1.4966888"
sodipodi:arc-type="arc"
d="M 124.11434,91.222449 A 61.07827,61.078381 0 0 1 72.255547,128.64407"
sodipodi:open="true" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512"
height="512"
viewBox="0 0 135.46666 135.46667"
version="1.1"
id="svg8"
sodipodi:docname="frame_xl.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.3267698"
inkscape:cx="246.52088"
inkscape:cy="257.15002"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
units="px"
inkscape:window-width="2554"
inkscape:window-height="1388"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<ellipse
style="fill:none;stroke:#000000;stroke-width:11.1125;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="circle933"
cx="67.73333"
cy="67.73333"
rx="61.07827"
ry="61.078381" />
<path
style="fill:none;stroke:#cccccc;stroke-width:8.46667;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="ellipse945"
sodipodi:type="arc"
sodipodi:cx="67.73333"
sodipodi:cy="67.73333"
sodipodi:rx="61.07827"
sodipodi:ry="61.078381"
sodipodi:start="4.0266183"
sodipodi:end="1.4966888"
sodipodi:arc-type="arc"
d="m 29.054315,20.462864 a 61.07827,61.078381 0 0 1 71.397515,-4.305348 61.07827,61.078381 0 0 1 26.52686,66.42652 61.07827,61.078381 0 0 1 -54.723143,46.060034"
sodipodi:open="true" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="512"
height="512"
viewBox="0 0 135.46666 135.46667"
version="1.1"
id="svg8"
sodipodi:docname="relay1.svg"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.8763359"
inkscape:cx="226.84426"
inkscape:cy="273.81262"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
units="px"
inkscape:window-width="2554"
inkscape:window-height="1388"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<ellipse
style="fill:none;stroke:#000000;stroke-width:3.175;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path833"
cx="67.730774"
cy="67.73304"
rx="14.483187"
ry="14.484928" />
<circle
style="fill:none;stroke:#000000;stroke-width:3.175;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="circle837"
cx="94.823639"
cy="96.083992"
r="5.6934419" />
<circle
style="fill:none;stroke:#000000;stroke-width:3.175;stroke-linecap:square;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="circle839"
cx="33.886948"
cy="80.112755"
r="5.12497" />
<path
style="fill:none;stroke:#000000;stroke-width:1.5875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 77.78737,77.876784 91.153059,91.39555"
id="path841"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#000000;stroke-width:1.5875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 52.933416,67.707417 -36.737044,0.05126"
id="path845" />
<path
style="fill:none;stroke:#000000;stroke-width:1.5875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 36.344868,75.712364 40.528795,67.71347 31.626796,50.039468"
id="path857"
sodipodi:nodetypes="ccc" />
<path
style="fill:none;stroke:#000000;stroke-width:1.5875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 30.92191,84.930862 -5.328755,9.229672"
id="path861" />
<path
style="fill:none;stroke:#000000;stroke-width:1.5875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 91.238049,98.742621 -7.61307,6.303659 -0.30885,10.26027"
id="path863" />
<path
style="fill:none;stroke:#000000;stroke-width:1.5875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 98.29999,93.455052 7.50417,-6.432903 10.16386,1.43681"
id="path865" />
<path
style="fill:none;stroke:#000000;stroke-width:1.5875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 77.071486,56.45746 91.037363,41.025903 88.122718,23.063615"
id="path867" />
<path
style="fill:none;stroke:#000000;stroke-width:1.5875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 77.071486,56.45746 91.022435,41.012405 109.18663,42.108369"
id="path869" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

@ -11,4 +11,6 @@ rst-core = { path = "../rst-core" }
clap = "2.0"
ggez = "0.6.0-rc0"
mint = "0.5" # Required because ggez is trash
mint = "0.5" # Required because ggez is trash
librsvg = { git = "https://gitlab.gnome.org/GNOME/librsvg.git", rev = "d34f570f" }
cairo-rs = { version="0.8.0", features=["v1_16", "png", "svg"] }

@ -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) -> () {
}

@ -32,7 +32,7 @@ impl EventHandler for NodeRndr {
ctx,
DrawMode::fill(),
Point2::from(&self.loc),
35.0,
128.0,
0.1,
graphics::WHITE,
).unwrap();

@ -1,3 +1,6 @@
//! RST Node game client
mod assets;
mod cli;
mod constants;
mod ctx;
@ -6,17 +9,13 @@ mod settings;
mod state;
mod window;
pub(crate) use settings::*;
#[allow(unused)]
pub(crate) use settings::{GameSettings, GraphicsSettings, WindowSettings};
pub(crate) use state::*;
fn main() {
let settings = default();
let settings = settings::default();
let state = ClientState::new(&settings);
window::run(&settings, state)
// let my_game = GameState::new(&mut ctx);
// // Run!
// event::run(ctx, eloop, my_game);
}

@ -10,7 +10,7 @@ pub fn default() -> GameSettings {
window_mode: WindowMode::Windowed,
},
graphics: GraphicsSettings {
samples: Samples(0),
samples: Samples(16),
vsync: true,
},
}

@ -4,8 +4,17 @@ mkShell rec {
name = "rstnode-shell";
buildInputs = with pkgs; [
rustc cargo clangStdenv rust-analyzer rustfmt
alsaLib pkg-config libudev
# ggez dependencies
pkg-config alsaLib libudev
# librsvg dependencies
glib cairo pango gdk-pixbuf libxml2
] ++ (with pkgs.xlibs; [
# General opengl dependencies
libGL
libGLU
libGL_driver

Loading…
Cancel
Save