diff --git a/samples/button.rb b/samples/button.rb index 3c257aa..6a9f713 100644 --- a/samples/button.rb +++ b/samples/button.rb @@ -15,9 +15,9 @@ rect.on_click do 0xFF0000 end -main_scene.add_element text -main_scene.add_element rect +main_scene << text +main_scene << rect -window.add_scene :main_scene, main_scene +window.scenes[:main_scene] = main_scene window.start :main_scene diff --git a/samples/main.rb b/samples/main.rb index 1f01b12..f692146 100644 --- a/samples/main.rb +++ b/samples/main.rb @@ -25,7 +25,7 @@ start_button.on_click do window.start :game_scene end -menu_scene.add_element start_button +menu_scene << start_button game_scene = Scene.new @@ -96,6 +96,7 @@ end # match is set to list of all capturing queries # for components returns an object that responds to .each with every ceomponents values # for entities it does similarly +# mouse state can be read in systems always query = tag(:enemy) & component(:health, true) & anti(name("Trap Preview", true)) # in the match name will return just the one entity @@ -182,7 +183,7 @@ world.shader :fog do |shader| z = 100 # shaders always appear above normal sprites but z is used to sort them relative to each other, so a shader with z 100 will appear above a shader with z 50, but both will appear above normal sprites end -window.add_scene :menu_scene, menu_scene -window.add_scene :game_scene, game_scene +window.scenes[:menu_scene] = menu_scene +window.scenes[:game_scene] = game_scene window.start :menu_scene # first scene to show when the game starts, stops the loading bg diff --git a/src/scene/scene.cc b/src/scene/scene.cc new file mode 100644 index 0000000..e69de29