diff options
Diffstat (limited to 'games/rstnode/rst-client/src/state.rs')
-rw-r--r-- | games/rstnode/rst-client/src/state.rs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/games/rstnode/rst-client/src/state.rs b/games/rstnode/rst-client/src/state.rs index 6b7312f13d7f..b1b5e89f3d13 100644 --- a/games/rstnode/rst-client/src/state.rs +++ b/games/rstnode/rst-client/src/state.rs @@ -6,15 +6,17 @@ use crate::{ entities::{Coordinates, NodeRndr}, Renderer, }, + input::InputHandle, GameSettings, }; use ggez::{event::EventHandler, graphics, Context, GameResult}; -use rst_core::data::{Node, Owner, Upgrade}; +use rst_core::data::{Color, Level, Node, Owner, Player, Upgrade}; use std::sync::Arc; pub struct ClientState { assets: Assets, settings: GameSettings, + input: InputHandle, // Game state node: NodeRndr, @@ -25,14 +27,20 @@ impl ClientState { Self { assets, settings, + input: InputHandle::new(), node: NodeRndr { - loc: Coordinates(250.0, 250.0), + loc: Coordinates(512.0, 512.0), inner: Arc::new(Node { id: 0, health: 100.into(), max_health: 100.into(), - owner: Owner::Neutral, - type_: Upgrade::Base, + owner: Owner::Player(Player { + id: 0, + name: "kookie".into(), + color: Color::blue(), + money: 1000.into(), + }), + type_: Upgrade::Relay(Level::One), links: 0, link_states: vec![], buffer: vec![], @@ -47,7 +55,8 @@ impl ClientState { } impl EventHandler for ClientState { - fn update(&mut self, _ctx: &mut Context) -> GameResult<()> { + fn update(&mut self, ctx: &mut Context) -> GameResult<()> { + self.input.update(ctx)?; Ok(()) } |