aboutsummaryrefslogtreecommitdiff
path: root/games/rstnode/rst-client/src/graphics/entities/mod.rs
diff options
context:
space:
mode:
authorKatharina Fey <kookie@spacekookie.de>2021-02-14 00:06:14 +0100
committerKatharina Fey <kookie@spacekookie.de>2021-02-14 00:06:14 +0100
commiteffbdeed66e8de8e769b8ac069926ad1a9110e62 (patch)
treee4522354e53266204aa9962caccde55d8c815092 /games/rstnode/rst-client/src/graphics/entities/mod.rs
parent5dab336049dbc6817e9ff212998690f59f6bbfa8 (diff)
rstnode: refactoring server and client components into rst-coreHEADmaster
* Add an inbox/ outbox system to server components * Define a data flow from Request -> computation -> Update * Create simple handlers to call server or client code for requests
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(())
+ }
+}