Class: Cursor2

Inherits:
Moon::DataModel::Metal
  • Object
show all
Includes:
Moon::Activatable, Moon::Eventable, Movable2
Defined in:
lib/moon/packages/twod/cursor2.rb

Overview

Generic 2D Cursor

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Movable2

#adjust_position, #backward, #forward, #left, #move, #move_distance, #moveto, #right

Methods included from Moon::Eventable

#allow_event?, #clear_events, #each_listener, #each_typed_listener, filter_from_options, #has_events?, #initialize_eventable, #off, #on, #ppd_ev, #trigger, #typing

Methods included from Moon::Activatable

#activate, #active?, #deactivate

Instance Attribute Details

#activeBoolean

Returns:


11
# File 'lib/moon/packages/twod/cursor2.rb', line 11

field :active, type: Boolean, default: true

#positionMoon::Vector2

Returns:


15
# File 'lib/moon/packages/twod/cursor2.rb', line 15

field :position, type: Moon::Vector2, default: proc{ |t| t.model.new }

Instance Method Details

#movable?Boolean

Returns:


22
23
24
# File 'lib/moon/packages/twod/cursor2.rb', line 22

def movable?
  active?
end

#pre_initializeObject


17
18
19
20
# File 'lib/moon/packages/twod/cursor2.rb', line 17

def pre_initialize
  super
  initialize_eventable
end