|
|
|
@ -3,9 +3,10 @@ |
|
|
|
|
//! Generally the naming convention should be: `{type}Rndr`
|
|
|
|
|
//! (`Renderer`, but shorter).
|
|
|
|
|
|
|
|
|
|
use crate::color; |
|
|
|
|
use super::prelude::*; |
|
|
|
|
|
|
|
|
|
use rst_core::data::Node; |
|
|
|
|
use rst_core::data::{Owner, Node, Color}; |
|
|
|
|
use std::sync::Arc; |
|
|
|
|
|
|
|
|
|
/// A set of universal X/Y coordinates
|
|
|
|
@ -29,23 +30,19 @@ impl Renderer for NodeRndr { |
|
|
|
|
|
|
|
|
|
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))?; |
|
|
|
|
|
|
|
|
|
frame.draw( |
|
|
|
|
ctx, |
|
|
|
|
DrawParam::new().dest([256.0, 256.0]).color(graphics::RED), |
|
|
|
|
)?; |
|
|
|
|
|
|
|
|
|
let circ = Mesh::new_circle( |
|
|
|
|
ctx, |
|
|
|
|
DrawMode::fill(), |
|
|
|
|
Point2::from(&self.loc), |
|
|
|
|
64.0, |
|
|
|
|
0.1, |
|
|
|
|
graphics::WHITE, |
|
|
|
|
) |
|
|
|
|
.unwrap(); |
|
|
|
|
|
|
|
|
|
circ.draw(ctx, DrawParam::new()).unwrap(); |
|
|
|
|
Ok(()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|