Class: ActorView
- Defined in:
- lib/gamebox/core/actor_view.rb,
lib/gamebox/core/deprecated.rb
Instance Attribute Summary collapse
-
#layer ⇒ Object
Returns the value of attribute layer.
-
#parallax ⇒ Object
Returns the value of attribute parallax.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ ActorView
constructor
A new instance of ActorView.
- #register ⇒ Object
- #screen_height ⇒ Object
- #screen_width ⇒ Object
- #unregister ⇒ Object
Constructor Details
#initialize ⇒ ActorView
Returns a new instance of ActorView.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/gamebox/core/actor_view.rb', line 7 def initialize @layer = actor.do_or_do_not(:layer) || 0 @parallax = actor.do_or_do_not(:parallax) || 1 # TODO clean up the show/hide here make nice with visible behavior? actor.when :remove_me do unregister end actor.when :hide_me do unregister end actor.when :show_me do register end end |
Instance Attribute Details
#layer ⇒ Object
Returns the value of attribute layer.
6 7 8 |
# File 'lib/gamebox/core/actor_view.rb', line 6 def layer @layer end |
#parallax ⇒ Object
Returns the value of attribute parallax.
6 7 8 |
# File 'lib/gamebox/core/actor_view.rb', line 6 def parallax @parallax end |
Class Method Details
.define(actor_view_type, &blk) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/gamebox/core/actor_view.rb', line 35 def define(actor_view_type, &blk) @definitions ||= {} definition = ActorViewDefinition.new definition.source = caller.detect{|c|!c.match /core/} definition.instance_eval &blk if block_given? @definitions[actor_view_type] = definition end |
.definitions ⇒ Object
43 44 45 |
# File 'lib/gamebox/core/actor_view.rb', line 43 def definitions @definitions ||= {} end |
Instance Method Details
#register ⇒ Object
18 19 20 |
# File 'lib/gamebox/core/actor_view.rb', line 18 def register renderer.register_drawable self end |
#screen_height ⇒ Object
30 31 32 |
# File 'lib/gamebox/core/actor_view.rb', line 30 def screen_height @screen_height ||= wrapped_screen.height end |
#screen_width ⇒ Object
26 27 28 |
# File 'lib/gamebox/core/actor_view.rb', line 26 def screen_width @screen_width ||= wrapped_screen.width end |
#unregister ⇒ Object
22 23 24 |
# File 'lib/gamebox/core/actor_view.rb', line 22 def unregister renderer.unregister_drawable self end |