| 1 | = Element2D = |
| 2 | An abstract !SuperClass, that knows how to be drawn onto a 2-dimensional screen. |
| 3 | |
| 4 | * __definition__: |
| 5 | {{{ |
| 6 | #!cpp |
| 7 | ... |
| 8 | #include "element_2d.h" |
| 9 | ... |
| 10 | //! A class that enables the |
| 11 | class Crosshair : public PNode, public Element2D, public EventListener { |
| 12 | ... |
| 13 | } |
| 14 | }}} |
| 15 | * __usage__: |
| 16 | {{{ |
| 17 | #!cpp |
| 18 | void setPosition2D(int xCoord, int yCoord); |
| 19 | void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; }; |
| 20 | void setLayer(E2D_LAYER layer); |
| 21 | void setVisibility(bool visible) { this->visible = visible; }; |
| 22 | void setBindNode(const PNode* bindNode) { this->bindNode = bindNode; }; |
| 23 | }}} |
| 24 | These functions are quite selfexplanatory. Important are two things: |
| 25 | 1. you set only a relative-position with setPosition2D |
| 26 | 2. when you set a bindNode, the 2D-element will follow the BindNode's Position, trying to approximate it. |