Refactored dimentional_size to split out space_available_width/height, initial implementation of verticial and horizontal container alignment

This commit is contained in:
2022-06-12 16:03:23 -05:00
parent 705138f7ad
commit ab9f9e8e7a
4 changed files with 46 additions and 17 deletions

View File

@@ -8,8 +8,11 @@ module CyberarmEngine
window.current_state
end
def previous_state
window.previous_state
def previous_state(state = nil)
raise "Only available for CyberarmEngine::GameState and subclasses" unless is_a?(CyberarmEngine::GameState) || state.is_a?(CyberarmEngine::GameState)
i = window.states.index(state || self)
window.states[i - 1] unless (i - 1).negative?
end
def pop_state