Class: MG::Node
- Inherits:
-
Object
- Object
- MG::Node
- Defined in:
- doc/API_reference.rb
Overview
instantiate this class directly but use a subclass instead.
Properties collapse
-
#alpha ⇒ Float
The opacity (alpha) level of the node, as a Float from the
0.0
to1.0
range. -
#anchor_point ⇒ Point
The anchor point of the node, as a set of percentage coordinates.
-
#color ⇒ Color
The color of the node.
-
#name ⇒ String
A name to easily identify the node in the graph.
-
#position ⇒ Point
The [x, y] position of the node in its parent’s coordinate system.
-
#rotation ⇒ Float
Returns the rotation of the node in degrees.
-
#scale ⇒ Float
Returns the scaling factor of the node, which multiplies its width, height and depth.
-
#size ⇒ Size
The content size of the node.
-
#visible? ⇒ Boolean
Whether the node should be visible.
-
#z_index ⇒ Integer
The local z-order index of the receiver in the scene graph, which will determine its priority when rendering the scene.
Miscellaneous collapse
-
#intersects?(node) ⇒ Boolean
Whether the receiver’s bounding box intersects with the given node’s bounding box.
-
#run_action(action) ⇒ Node
Run the provided action on the receiver node.
-
#stop_action(action) ⇒ Node
Stop the provided action.
-
#stop_all_actions ⇒ Node
Stop all actions running on the node.
Container collapse
-
#add(node, zpos = 0) ⇒ Node
Adds a child node to the receiver with a local z-order.
-
#children ⇒ Array<Node>
An array of
Node
objects that have been added to the receiver. -
#clear(cleanup = true) ⇒ Node
Removes all children nodes from the receiver.
-
#delete(node, cleanup = true) ⇒ Node
Removes the given child node from the receiver.
-
#delete_from_parent(cleanup = true) ⇒ Node
Removes the receiver node from its parent.
-
#parent ⇒ Node
The parent node, or
nil
if there isn’t one.
Instance Attribute Details
#alpha ⇒ Float
Returns the opacity (alpha) level of the node, as a Float from the 0.0
to 1.0
range.
694 695 696 |
# File 'doc/API_reference.rb', line 694 def alpha @alpha end |
#anchor_point ⇒ Point
The anchor point of the node, as a set of percentage coordinates. The anchor point represents where the node will be attached to its parent, and is normalized as a percentage. [0, 0] means the bottom-left corner, and [1, 1] the top-right corner. You can also use values lower than 0
and higher than 1
. The default anchor point value is [0.5, 0.5], which means the center of the parent.
679 680 681 |
# File 'doc/API_reference.rb', line 679 def anchor_point @anchor_point end |
#color ⇒ Color
Returns the color of the node.
701 702 703 |
# File 'doc/API_reference.rb', line 701 def color @color end |
#name ⇒ String
Returns a name to easily identify the node in the graph.
715 716 717 |
# File 'doc/API_reference.rb', line 715 def name @name end |
#position ⇒ Point
Returns the [x, y] position of the node in its parent’s coordinate system.
683 684 685 |
# File 'doc/API_reference.rb', line 683 def position @position end |
#rotation ⇒ Float
Returns the rotation of the node in degrees. 0 is the default angle. Positive values rotate node clockwise, and negative values for anti-clockwise
707 708 709 |
# File 'doc/API_reference.rb', line 707 def rotation @rotation end |
#scale ⇒ Float
Returns the scaling factor of the node, which multiplies its width, height and depth.
712 713 714 |
# File 'doc/API_reference.rb', line 712 def scale @scale end |
#size ⇒ Size
Returns the content size of the node.
686 687 688 |
# File 'doc/API_reference.rb', line 686 def size @size end |
#visible? ⇒ Boolean
Returns whether the node should be visible. The default value is true.
690 691 692 |
# File 'doc/API_reference.rb', line 690
def visible?
@visible?
end
|
#z_index ⇒ Integer
Returns the local z-order index of the receiver in the scene graph, which will determine its priority when rendering the scene.
698 699 700 |
# File 'doc/API_reference.rb', line 698 def z_index @z_index end |
Instance Method Details
#add(node, zpos = 0) ⇒ Node
Adds a child node to the receiver with a local z-order.
745 |
# File 'doc/API_reference.rb', line 745 def add(node, zpos=0); end |
#children ⇒ Array<Node>
Returns an array of Node
objects that have been added to the receiver.
764 |
# File 'doc/API_reference.rb', line 764 def children; end |
#clear(cleanup = true) ⇒ Node
Removes all children nodes from the receiver.
751 |
# File 'doc/API_reference.rb', line 751 def clear(cleanup=true); end |
#delete(node, cleanup = true) ⇒ Node
Removes the given child node from the receiver.
757 |
# File 'doc/API_reference.rb', line 757 def delete(node, cleanup=true); end |
#delete_from_parent(cleanup = true) ⇒ Node
Removes the receiver node from its parent. Same as:
node.parent.delete(node, cleanup)
772 |
# File 'doc/API_reference.rb', line 772 def delete_from_parent(cleanup=true); end |
#intersects?(node) ⇒ Boolean
Returns whether the receiver’s bounding box intersects with the given node’s bounding box.
736 |
# File 'doc/API_reference.rb', line 736 def intersects?(node); end |
#parent ⇒ Node
Returns the parent node, or nil
if there isn’t one.
760 |
# File 'doc/API_reference.rb', line 760 def parent; end |
#run_action(action) ⇒ Node
Run the provided action on the receiver node.
722 |
# File 'doc/API_reference.rb', line 722 def run_action(action); end |
#stop_action(action) ⇒ Node
Stop the provided action
731 |
# File 'doc/API_reference.rb', line 731 def stop_action(action); end |
#stop_all_actions ⇒ Node
Stop all actions running on the node
726 |
# File 'doc/API_reference.rb', line 726 def stop_all_actions(); end |