Class: MG::Scene
Overview
designed to be subclassed.
Instance Attribute Summary collapse
-
#gravity ⇒ Point
The gravity of the scene’s physics world.
Attributes inherited from Node
#alpha, #anchor_point, #color, #name, #position, #rotation, #scale, #size, #z_index
Constructors collapse
-
#initialize ⇒ Scene
constructor
The default initializer.
Update Loop collapse
-
#start_update ⇒ self
Starts the update loop.
-
#stop_update ⇒ self
Stops the update loop.
-
#update(delta) ⇒ self
The update loop method.
Events collapse
-
#on_accelerate {|Events::Acceleration| ... } ⇒ self
Starts listening for accelerometer events on the receiver.
-
#on_contact_begin {|Events::PhysicsContact| ... } ⇒ self
Starts listening for contact begin events from the physics engine.
-
#on_touch_begin {|Events::Touch| ... } ⇒ self
Starts listening for touch begin events on the receiver.
-
#on_touch_cancel {|Events::Touch| ... } ⇒ self
Starts listening for touch cancel events on the receiver.
-
#on_touch_end {|Events::Touch| ... } ⇒ self
Starts listening for touch end events on the receiver.
-
#on_touch_move {|Events::Touch| ... } ⇒ self
Starts listening for touch move events on the receiver.
Instance Method Summary collapse
-
#background_color=(color) ⇒ Object
Set background color for scene.
-
#debug_physics=(value) ⇒ Object
Set to draw the debug line.
-
#debug_physics? ⇒ Boolean
Whether the physics engine should draw debug lines.
Methods inherited from Node
#add, #children, #clear, #delete, #delete_from_parent, #intersects?, #number_of_running_actions, #parent, #run_action, #schedule, #schedule_once, #stop_action, #stop_all_actions, #unschedule, #visible=, #visible?
Constructor Details
#initialize ⇒ Scene
The default initializer. Subclasses can construct the scene interface in this method, as well as providing an implementation for #update, then run the update loop by calling #start_update.
578 |
# File 'doc/API_reference.rb', line 578 def initialize; end |
Instance Attribute Details
#gravity ⇒ Point
Returns the gravity of the scene’s physics world.
643 644 645 |
# File 'doc/API_reference.rb', line 643 def gravity @gravity end |
Instance Method Details
#background_color=(color) ⇒ Object
Set background color for scene.
654 |
# File 'doc/API_reference.rb', line 654 def background_color=(color); end |
#debug_physics=(value) ⇒ Object
Set to draw the debug line.
650 |
# File 'doc/API_reference.rb', line 650 def debug_physics=(value); end |
#debug_physics? ⇒ Boolean
Returns whether the physics engine should draw debug lines.
646 |
# File 'doc/API_reference.rb', line 646 def debug_physics?; end |
#on_accelerate {|Events::Acceleration| ... } ⇒ self
Starts listening for accelerometer events on the receiver.
631 |
# File 'doc/API_reference.rb', line 631 def on_accelerate; end |
#on_contact_begin {|Events::PhysicsContact| ... } ⇒ self
Starts listening for contact begin events from the physics engine.
637 |
# File 'doc/API_reference.rb', line 637 def on_contact_begin; end |
#on_touch_begin {|Events::Touch| ... } ⇒ self
Starts listening for touch begin events on the receiver.
607 |
# File 'doc/API_reference.rb', line 607 def on_touch_begin; end |
#on_touch_cancel {|Events::Touch| ... } ⇒ self
Starts listening for touch cancel events on the receiver.
625 |
# File 'doc/API_reference.rb', line 625 def on_touch_cancel; end |
#on_touch_end {|Events::Touch| ... } ⇒ self
Starts listening for touch end events on the receiver.
613 |
# File 'doc/API_reference.rb', line 613 def on_touch_end; end |
#on_touch_move {|Events::Touch| ... } ⇒ self
Starts listening for touch move events on the receiver.
619 |
# File 'doc/API_reference.rb', line 619 def on_touch_move; end |
#start_update ⇒ self
Starts the update loop. The #update
method will be called on this object for every frame.
586 |
# File 'doc/API_reference.rb', line 586 def start_update; end |
#stop_update ⇒ self
Stops the update loop. The #update
method will no longer be called on this object.
591 |
# File 'doc/API_reference.rb', line 591 def stop_update; end |
#update(delta) ⇒ self
The update loop method. Subclasses can provide a custom implementation of this method. The default implementation is empty.
598 |
# File 'doc/API_reference.rb', line 598 def update(delta); end |