mirror of
https://github.com/cyberarm/cyberarm_engine.git
synced 2026-11-04 16:33:52 +00:00
Refactored Container to be an Element, removed button_up/button_down passing to elements, moved Gui out of GameState and into GuiState, added scaffolding for events (Publish/Subscribe pattern). Element input is broken ATM.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
module CyberarmEngine
|
||||
class GameState
|
||||
include Common
|
||||
include DSL
|
||||
|
||||
attr_accessor :options, :global_pause
|
||||
attr_reader :game_objects, :containers
|
||||
@@ -11,10 +10,6 @@ module CyberarmEngine
|
||||
@game_objects = []
|
||||
@global_pause = false
|
||||
|
||||
@root_container = Stack.new(x: 0, y: 0, width: $window.width, height: $window.height)
|
||||
@game_objects << @root_container
|
||||
@containers = [@root_container]
|
||||
|
||||
setup
|
||||
end
|
||||
|
||||
@@ -34,6 +29,12 @@ module CyberarmEngine
|
||||
@game_objects = nil
|
||||
end
|
||||
|
||||
def down_up(id)
|
||||
@game_objects.each do |o|
|
||||
o.button_down(id)
|
||||
end
|
||||
end
|
||||
|
||||
def button_up(id)
|
||||
@game_objects.each do |o|
|
||||
o.button_up(id)
|
||||
|
||||
Reference in New Issue
Block a user