diff options
Diffstat (limited to 'games/rstnode/rst-client/src/state.rs')
-rw-r--r-- | games/rstnode/rst-client/src/state.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/games/rstnode/rst-client/src/state.rs b/games/rstnode/rst-client/src/state.rs index c55dc2faa6d6..6b7312f13d7f 100644 --- a/games/rstnode/rst-client/src/state.rs +++ b/games/rstnode/rst-client/src/state.rs @@ -1,7 +1,11 @@ //! Game client state handling use crate::{ - graphics::entities::{Coordinates, NodeRndr}, + assets::Assets, + graphics::{ + entities::{Coordinates, NodeRndr}, + Renderer, + }, GameSettings, }; use ggez::{event::EventHandler, graphics, Context, GameResult}; @@ -9,12 +13,18 @@ use rst_core::data::{Node, Owner, Upgrade}; use std::sync::Arc; pub struct ClientState { + assets: Assets, + settings: GameSettings, + + // Game state node: NodeRndr, } impl ClientState { - pub fn new(_settings: &GameSettings) -> Self { + pub fn new(settings: GameSettings, assets: Assets) -> Self { Self { + assets, + settings, node: NodeRndr { loc: Coordinates(250.0, 250.0), inner: Arc::new(Node { @@ -30,6 +40,10 @@ impl ClientState { }, } } + + pub fn assets(&self) -> &Assets { + &self.assets + } } impl EventHandler for ClientState { @@ -41,7 +55,7 @@ impl EventHandler for ClientState { graphics::clear(ctx, graphics::Color::from_rgb(15, 15, 15)); // Render the node - self.node.draw(ctx).unwrap(); + self.node.draw(&self, ctx).unwrap(); graphics::present(ctx) } |