@@ -86,18 +86,15 @@ pub fn setup(
8686
8787 let script_path = bevy_mod_scripting_lua:: lua_path!( "game_of_life" ) ;
8888
89- commands. spawn ( Camera2dBundle :: default ( ) ) ;
89+ commands. spawn ( Camera2d ) ;
9090 commands
91- . spawn ( SpriteBundle {
92- texture : assets. add ( image) ,
93- sprite : Sprite {
94- custom_size : Some ( Vec2 :: new (
95- settings. display_grid_dimensions . 0 as f32 ,
96- settings. display_grid_dimensions . 1 as f32 ,
97- ) ) ,
98- color : Color :: srgb ( 1.0 , 0.388 , 0.278 ) , // TOMATO
99- ..Default :: default ( )
100- } ,
91+ . spawn ( Sprite {
92+ image : assets. add ( image) ,
93+ custom_size : Some ( Vec2 :: new (
94+ settings. display_grid_dimensions . 0 as f32 ,
95+ settings. display_grid_dimensions . 1 as f32 ,
96+ ) ) ,
97+ color : Color :: srgb ( 1.0 , 0.388 , 0.278 ) , // TOMATO
10198 ..Default :: default ( )
10299 } )
103100 . insert ( LifeState {
@@ -156,11 +153,11 @@ pub fn sync_window_size(
156153/// Runs after LifeState components are updated, updates their rendered representation
157154pub fn update_rendered_state (
158155 mut assets : ResMut < Assets < Image > > ,
159- query : Query < ( & LifeState , & Handle < Image > ) > ,
156+ query : Query < ( & LifeState , & Sprite ) > ,
160157) {
161158 for ( new_state, old_rendered_state) in query. iter ( ) {
162159 let old_rendered_state = assets
163- . get_mut ( old_rendered_state)
160+ . get_mut ( & old_rendered_state. image )
164161 . expect ( "World is not setup correctly" ) ;
165162
166163 old_rendered_state. data = new_state. cells . clone ( ) ;
0 commit comments