lib/cyberarm_engine/window.rb in cyberarm_engine-0.17.1 vs lib/cyberarm_engine/window.rb in cyberarm_engine-0.18.0

- old
+ new

@@ -75,14 +75,16 @@ options = { setup: true }.merge(options) if klass.instance_of?(klass.class) && defined?(klass.options) @states << klass klass.setup if options[:setup] + klass.post_setup if options[:setup] else @states << klass.new(options) if child_of?(klass, GameState) @states << klass.new if child_of?(klass, Element::Container) current_state.setup if current_state.instance_of?(klass) && options[:setup] + current_state.post_setup if current_state.instance_of?(klass) && options[:setup] end end private def child_of?(input, klass) input.ancestors.detect { |c| c == klass } @@ -91,16 +93,20 @@ def current_state @states.last end def previous_state - if @states.size > 1 && state = @states[@states.size - 2] + if @states.size > 1 && (state = @states[@states.size - 2]) state end end def pop_state @states.pop + end + + def shift_state + @states.shift end # Sourced from https://gist.github.com/ippa/662583 def draw_circle(cx, cy, r, z = 9999, color = Gosu::Color::GREEN, step = 10) 0.step(360, step) do |a1|