Class CanvasNode¶
- Defined in File canvas_node.h
Page Contents
Inheritance Relationships¶
Base Type¶
public simple2dengine::Node
(Class Node)
Derived Types¶
public simple2dengine::SpriteNode
(Class SpriteNode)public simple2dengine::TextNode
(Class TextNode)
Class Documentation¶
-
class
CanvasNode
: public simple2dengine::Node¶ Canvas node. Used for drawing, transforming, positioning.
Subclassed by simple2dengine::SpriteNode, simple2dengine::TextNode
Public Functions
Add child to canvas node tree.
- Return
- true if successfully add a node, otherwise return false.
- Parameters
child
: will be added to node tree.
-
void
setPosition
(const sf::Vector2f &position)¶ Set position of Node.
- Parameters
position
: x and y coordinates relative to its parent.
-
void
move
(const sf::Vector2f &position)¶ Move Node on specified coordinates.
- Parameters
position
: x and y coordinate relative to its parent.
-
const sf::Vector2f &
getPosition
() const¶ Get position of Node relative to parent.
- Return
- const Vector2f& x and y coordinate relative to parent.
-
const sf::Vector2f &
getGlobalPosition
() const¶ Get global position of Node.
- Return
- const Vector2f& x and y coordinate relative to window (global position).
-
void
setVisible
(bool isVisible)¶ Set visibility of Node. If parent is invisible, curent Node will be invisible too.
- Parameters
isVisible
: visibility of Node.
-
bool
isVisibleInTree
() const¶ Check if Node or it parents are visible or not. If someone of Node or its parents is invisible - return value will be false.
- Return
- bool visibility of Node or it parents.
-
virtual void
updateTransform
()¶ Update Canvas node transform to correctly draw it.