Sha256: 0ab41d30f80428c1f40dd087a4bc41036f074d4cb0683df15204eaf228563114
Contents?: true
Size: 643 Bytes
Versions: 9
Compression:
Stored size: 643 Bytes
Contents
module Gosuplus class StateManager def initialize(window) @states = [] @index = 0 end def update @states[@index].update end def draw @states[@index].draw end def handle_input(key, type) @states[@index].handle_input(key, type) end def next @states[@index].on_exit @states[@index].on_load @index += 1 end def previous @states[@index].on_exit @states[@index].on_load @index -= 1 end def add(state) state.on_load unless @states.size > 0 @states << state end end end
Version data entries
9 entries across 9 versions & 1 rubygems