aboutsummaryrefslogtreecommitdiff
path: root/games/rstnode/rst-client/src/graphics/entities/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'games/rstnode/rst-client/src/graphics/entities/mod.rs')
-rw-r--r--games/rstnode/rst-client/src/graphics/entities/mod.rs35
1 files changed, 28 insertions, 7 deletions
diff --git a/games/rstnode/rst-client/src/graphics/entities/mod.rs b/games/rstnode/rst-client/src/graphics/entities/mod.rs
index a3289f6f412d..db675f816fbf 100644
--- a/games/rstnode/rst-client/src/graphics/entities/mod.rs
+++ b/games/rstnode/rst-client/src/graphics/entities/mod.rs
@@ -3,10 +3,10 @@
//! Generally the naming convention should be: `{type}Rndr`
//! (`Renderer`, but shorter).
-use crate::color;
use super::prelude::*;
+use crate::color;
-use rst_core::data::{Owner, Node, Color};
+use rst_core::data::{Color, Link, Node, Owner};
use std::sync::Arc;
/// A set of universal X/Y coordinates
@@ -24,10 +24,6 @@ pub struct NodeRndr {
}
impl Renderer for NodeRndr {
- fn update(&mut self, _: &mut ClientState, _: &mut Context) -> GameResult<()> {
- Ok(())
- }
-
fn draw(&self, s: &ClientState, ctx: &mut Context) -> GameResult<()> {
let frame = s.assets().find("frame/frame_s").unwrap();
let icon = s.assets().find("relay/relay1").unwrap();
@@ -39,10 +35,35 @@ impl Renderer for NodeRndr {
Owner::Player(ref p) => color::to(p.color),
Owner::Neutral => color::to(Color::white()),
};
-
+
frame.draw(ctx, DrawParam::new().dest([x, y]).color(color))?;
icon.draw(ctx, DrawParam::new().dest([x, y]).color(color))?;
Ok(())
}
}
+
+pub struct LinkRndr {
+ pub loc: Coordinates,
+ pub inner: Arc<Link>,
+}
+
+impl Renderer for LinkRndr {
+ fn draw(&self, s: &ClientState, ctx: &mut Context) -> GameResult<()> {
+ // let frame = s.assets().find("frame/frame_s").unwrap();
+ // let icon = s.assets().find("relay/relay1").unwrap();
+
+ // let x = self.loc.0 - frame.width() as f32;
+ // let y = self.loc.1 - frame.height() as f32;
+
+ // let color = match self.inner.owner {
+ // Owner::Player(ref p) => color::to(p.color),
+ // Owner::Neutral => color::to(Color::white()),
+ // };
+
+ // frame.draw(ctx, DrawParam::new().dest([x, y]).color(color))?;
+ // icon.draw(ctx, DrawParam::new().dest([x, y]).color(color))?;
+
+ Ok(())
+ }
+}