@@ -13,7 +13,7 @@ use crate::entity::{EntityId, EntityStats, SpawnCommand};
1313use crate :: player:: Player ;
1414use crate :: projectile:: { Projectile , ProjectileStats , ProjectileType } ;
1515use crate :: roto_script:: { GameConstants , RotoScriptManager } ;
16- use crate :: visual_config:: GameVisualConfig ;
16+ use crate :: visual_config:: { Assets , GameVisualConfig } ;
1717
1818#[ derive( Clone , Copy , Debug , PartialEq ) ]
1919pub enum GameStateEnum {
@@ -46,10 +46,11 @@ pub struct GameState {
4646 pub enemies_to_despawn : HashSet < EntityId > ,
4747 pub projectiles_to_despawn : HashSet < EntityId > ,
4848 pub message_from_elf : Option < String > ,
49+ pub assets : Assets ,
4950}
5051
5152impl GameState {
52- pub fn new ( ) -> Self {
53+ pub fn new ( assets : Assets ) -> Self {
5354 let mut roto_manager = RotoScriptManager :: new ( ) ;
5455
5556 // Try to fetch player stats from Roto, fallback to defaults if it fails
@@ -123,6 +124,7 @@ I will summon magic to to beat the evil!.
123124 enemies_to_despawn : HashSet :: new ( ) ,
124125 projectiles_to_despawn : HashSet :: new ( ) ,
125126 message_from_elf : Some ( tmp. to_owned ( ) ) ,
127+ assets,
126128 }
127129 }
128130
@@ -589,7 +591,7 @@ Just save the file and Press Return here!
589591
590592pub fn draw_elf_message ( gs : & GameState ) -> bool {
591593 if let Some ( msg) = & gs. message_from_elf {
592- let texture = & gs. visual_config . char_tex . as_ref ( ) . unwrap ( ) ;
594+ let texture = & gs. assets . char_tex . as_ref ( ) . unwrap ( ) ;
593595
594596 let mut params = DrawTextureParams :: default ( ) ;
595597 let ( w, h, s) = ( texture. width ( ) , texture. height ( ) , 0.33 ) ;
0 commit comments