aboutsummaryrefslogtreecommitdiff
path: root/games/rstnode/rst-client
diff options
context:
space:
mode:
Diffstat (limited to 'games/rstnode/rst-client')
-rw-r--r--games/rstnode/rst-client/src/assets.rs23
-rw-r--r--games/rstnode/rst-client/src/graphics/entities/mod.rs2
-rw-r--r--games/rstnode/rst-client/src/state/mod.rs6
3 files changed, 7 insertions, 24 deletions
diff --git a/games/rstnode/rst-client/src/assets.rs b/games/rstnode/rst-client/src/assets.rs
index 76556213fc70..80f58ee585ce 100644
--- a/games/rstnode/rst-client/src/assets.rs
+++ b/games/rstnode/rst-client/src/assets.rs
@@ -12,29 +12,14 @@ use std::{
};
use tempfile::tempdir;
-pub type Result<T> = std::result::Result<T, LoadError>;
-
-#[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())
- }
-}
+pub use rst_core::loader::Uri;
-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())
- }
-}
+pub type Result<T> = std::result::Result<T, LoadError>;
/// Asset loader
#[derive(Debug)]
pub struct Assets {
- inner: BTreeMap<URI, Image>,
+ inner: BTreeMap<Uri, Image>,
}
impl Assets {
@@ -44,7 +29,7 @@ impl Assets {
}
}
- pub fn find<U: Into<URI>>(&self, u: U) -> Option<Image> {
+ pub fn find<U: Into<Uri>>(&self, u: U) -> Option<Image> {
self.inner.get(&u.into()).map(|i| i.clone())
}
diff --git a/games/rstnode/rst-client/src/graphics/entities/mod.rs b/games/rstnode/rst-client/src/graphics/entities/mod.rs
index db675f816fbf..bb28fdd808d0 100644
--- a/games/rstnode/rst-client/src/graphics/entities/mod.rs
+++ b/games/rstnode/rst-client/src/graphics/entities/mod.rs
@@ -19,7 +19,6 @@ impl<'a> From<&'a Coordinates> for Point2<f32> {
}
pub struct NodeRndr {
- pub loc: Coordinates,
pub inner: Arc<Node>,
}
@@ -44,7 +43,6 @@ impl Renderer for NodeRndr {
}
pub struct LinkRndr {
- pub loc: Coordinates,
pub inner: Arc<Link>,
}
diff --git a/games/rstnode/rst-client/src/state/mod.rs b/games/rstnode/rst-client/src/state/mod.rs
index 45e69eee10bb..cd030dcd5595 100644
--- a/games/rstnode/rst-client/src/state/mod.rs
+++ b/games/rstnode/rst-client/src/state/mod.rs
@@ -17,7 +17,7 @@ use crate::{
};
use ggez::{event::EventHandler, graphics, Context, GameResult};
use rst_core::{
- data::{Color, Level, Link, Node, Owner, Player, Upgrade},
+ data::{Color, Level, Link, Node, Owner, Player, Position, Upgrade},
io::Io,
};
use std::sync::Arc;
@@ -51,9 +51,9 @@ impl ClientState {
vp: Viewport::new(),
input: InputHandle::new(),
node1: NodeRndr {
- loc: Coordinates(512.0, 512.0),
inner: Arc::new(Node {
id: 0,
+ pos: Position { x: 512.0, y: 512.0 },
health: 100.into(),
max_health: 100.into(),
owner: Owner::Player(Player {
@@ -70,9 +70,9 @@ impl ClientState {
}),
},
node2: NodeRndr {
- loc: Coordinates(128.0, 128.0),
inner: Arc::new(Node {
id: 0,
+ pos: Position { x: 128.0, y: 128.0 },
health: 100.into(),
max_health: 100.into(),
owner: Owner::Neutral,