Class: StageDefinition

Inherits:
Object show all
Defined in:
lib/gamebox/core/stage_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#curtain_down_block ⇒ Object

Returns the value of attribute curtain_down_block.



2
3
4
# File 'lib/gamebox/core/stage_definition.rb', line 2

def curtain_down_block
  @curtain_down_block
end

#curtain_up_block ⇒ Object

Returns the value of attribute curtain_up_block.



2
3
4
# File 'lib/gamebox/core/stage_definition.rb', line 2

def curtain_up_block
  @curtain_up_block
end

#helpers_block ⇒ Object

Returns the value of attribute helpers_block.



2
3
4
# File 'lib/gamebox/core/stage_definition.rb', line 2

def helpers_block
  @helpers_block
end

#renderer ⇒ Object

Returns the value of attribute renderer.



2
3
4
# File 'lib/gamebox/core/stage_definition.rb', line 2

def renderer
  @renderer
end

#required_injections ⇒ Object

Returns the value of attribute required_injections.



2
3
4
# File 'lib/gamebox/core/stage_definition.rb', line 2

def required_injections
  @required_injections
end

#source ⇒ Object

Returns the value of attribute source.



2
3
4
# File 'lib/gamebox/core/stage_definition.rb', line 2

def source
  @source
end

Instance Method Details

#curtain_down(&curtain_down_block) ⇒ Object

Define a block of code to run when your stage has been shutdown

define_stage :main_menu do curtain_down do @info = load_some_info end end



33
34
35
# File 'lib/gamebox/core/stage_definition.rb', line 33

def curtain_down(&curtain_down_block)
  @curtain_down_block = curtain_down_block
end

#curtain_up(&curtain_up_block) ⇒ Object

Define a block of code to run when your stage is and ready to play

define_stage :main_menu do curtain_up do @info = load_some_info end end



22
23
24
# File 'lib/gamebox/core/stage_definition.rb', line 22

def curtain_up(&curtain_up_block)
  @curtain_up_block = curtain_up_block
end

#helpers(&helpers_block) ⇒ Object

Define any helper methods / include modules here These will be available for curtain_up / update / draw to use.

define_stage :main_menu do helpers do include MinMaxHelpers def calculate_thinger ... end end end



58
59
60
# File 'lib/gamebox/core/stage_definition.rb', line 58

def helpers(&helpers_block)
  @helpers_block = helpers_block
end

#render_with(render_class_name) ⇒ Object

Replaces the default renderer with your own.

define_stage :main_menu do render_with :my_render ... end



43
44
45
# File 'lib/gamebox/core/stage_definition.rb', line 43

def render_with(render_class_name)
  @renderer = render_class_name
end

#requires(*injections_needed) ⇒ Object

Required objects that you need for your specific stage The objects will be created for you.

define_stage :main_menu do requires :magic_thinger end



11
12
13
# File 'lib/gamebox/core/stage_definition.rb', line 11

def requires(*injections_needed)
  @required_injections = injections_needed
end