@@ -8,20 +8,27 @@ use game::MoveInfo;
88use input:: { KeyCode , SpecialKey } ;
99use combat:: { Weapon , Boomerang } ;
1010
11- pub trait GameState < ' a > {
11+ pub trait GameState {
1212 fn new ( ) -> Self ;
13- fn new_with_weapon ( Box < Weapon + ' a > ) -> Self ;
13+ fn new_with_weapon ( Box < Weapon + ' static > ) -> Self ;
1414
1515 fn enter ( & self , & mut Windows ) { }
1616 fn exit ( & self ) { }
1717
1818 fn update ( & mut self , maps : & mut Maps , windows : & mut Windows , Rc < RefCell < MoveInfo > > ) ;
19- fn render < ' r > ( & mut self , renderer : & mut Box < RenderingComponent > , maps : & mut Maps , windows : & ' r mut Windows < ' r > ) {
19+ fn render ( & mut self , renderer : & mut Box < RenderingComponent > , maps : & mut Maps , windows : & mut Windows ) {
2020 renderer. before_render_new_frame ( ) ;
21- let mut all_windows = windows. all_windows ( ) ;
22- for window in all_windows. iter_mut ( ) {
23- renderer. attach_window ( * window) ;
24- }
21+ let ref mut stats = windows. stats ;
22+ renderer. attach_window ( stats) ;
23+
24+ let ref mut input = windows. input ;
25+ renderer. attach_window ( input) ;
26+
27+ let ref mut messages = windows. messages ;
28+ renderer. attach_window ( messages) ;
29+
30+ let ref mut map = windows. map ;
31+ renderer. attach_window ( map) ;
2532 maps. render ( renderer) ;
2633 renderer. after_render_new_frame ( ) ;
2734 }
@@ -31,12 +38,12 @@ pub trait GameState<'a> {
3138
3239pub struct MovementGameState ;
3340
34- impl < ' a > GameState < ' a > for MovementGameState {
41+ impl GameState for MovementGameState {
3542 fn new ( ) -> MovementGameState {
3643 MovementGameState
3744 }
3845
39- fn new_with_weapon ( _: Box < Weapon + ' a > ) -> MovementGameState {
46+ fn new_with_weapon ( _: Box < Weapon > ) -> MovementGameState {
4047 MovementGameState
4148 }
4249
@@ -69,21 +76,21 @@ impl<'a> GameState<'a> for MovementGameState {
6976 }
7077}
7178
72- pub struct AttackInputGameState < ' a > {
79+ pub struct AttackInputGameState {
7380 should_update_state : bool ,
74- pub weapon : Box < Weapon + ' a >
81+ pub weapon : Box < Weapon + ' static >
7582}
7683
77- impl < ' a > GameState < ' a > for AttackInputGameState < ' a > {
78- fn new ( ) -> AttackInputGameState < ' a > {
84+ impl GameState for AttackInputGameState {
85+ fn new ( ) -> AttackInputGameState {
7986 let weapon : Box < Boomerang > = box Weapon :: new ( ) ;
8087 AttackInputGameState {
8188 should_update_state : false ,
8289 weapon : weapon
8390 }
8491 }
8592
86- fn new_with_weapon ( weapon : Box < Weapon + ' a > ) -> AttackInputGameState < ' a > {
93+ fn new_with_weapon ( weapon : Box < Weapon + ' static > ) -> AttackInputGameState {
8794 AttackInputGameState {
8895 should_update_state : false ,
8996 weapon : weapon
0 commit comments