aboutsummaryrefslogtreecommitdiff
path: root/games/rstnode/rst-client
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2021-02-07 00:47:06 +0100
committerKatharina Fey <kookie@spacekookie.de>2021-02-07 00:47:06 +0100
commitf5b36ff6b99256030201c878608a07d163b4c802 (patch)
treeb07cb8c699d2e384de728df5ae1e0fdcd4a29f30 /games/rstnode/rst-client
parenta6a1949914fb2074fb5fec9c75b075eac369541f (diff)
rstnode: add basic node assets
Diffstat (limited to '')
-rw-r--r--games/rstnode/rst-client/Cargo.toml4
-rw-r--r--games/rstnode/rst-client/src/assets.rs44
-rw-r--r--games/rstnode/rst-client/src/graphics/entities/mod.rs2
-rw-r--r--games/rstnode/rst-client/src/main.rs13
-rw-r--r--games/rstnode/rst-client/src/settings.rs2
5 files changed, 55 insertions, 10 deletions
diff --git a/games/rstnode/rst-client/Cargo.toml b/games/rstnode/rst-client/Cargo.toml
index eae6672cd51d..929f7550bbef 100644
--- a/games/rstnode/rst-client/Cargo.toml
+++ b/games/rstnode/rst-client/Cargo.toml
@@ -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 \ No newline at end of file
+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"] } \ No newline at end of file
diff --git a/games/rstnode/rst-client/src/assets.rs b/games/rstnode/rst-client/src/assets.rs
new file mode 100644
index 000000000000..7e368b8d4c16
--- /dev/null
+++ b/games/rstnode/rst-client/src/assets.rs
@@ -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) -> () {
+
+}
diff --git a/games/rstnode/rst-client/src/graphics/entities/mod.rs b/games/rstnode/rst-client/src/graphics/entities/mod.rs
index 168f40d2aeee..d3536d4f5fc2 100644
--- a/games/rstnode/rst-client/src/graphics/entities/mod.rs
+++ b/games/rstnode/rst-client/src/graphics/entities/mod.rs
@@ -32,7 +32,7 @@ impl EventHandler for NodeRndr {
ctx,
DrawMode::fill(),
Point2::from(&self.loc),
- 35.0,
+ 128.0,
0.1,
graphics::WHITE,
).unwrap();
diff --git a/games/rstnode/rst-client/src/main.rs b/games/rstnode/rst-client/src/main.rs
index 9de33fce81c6..57a686a19d74 100644
--- a/games/rstnode/rst-client/src/main.rs
+++ b/games/rstnode/rst-client/src/main.rs
@@ -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);
}
diff --git a/games/rstnode/rst-client/src/settings.rs b/games/rstnode/rst-client/src/settings.rs
index 971e8e6f50b7..a339c4106da5 100644
--- a/games/rstnode/rst-client/src/settings.rs
+++ b/games/rstnode/rst-client/src/settings.rs
@@ -10,7 +10,7 @@ pub fn default() -> GameSettings {
window_mode: WindowMode::Windowed,
},
graphics: GraphicsSettings {
- samples: Samples(0),
+ samples: Samples(16),
vsync: true,
},
}