Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 1 (modified by landauf, 17 years ago) (diff)

Element2D

An abstract SuperClass, that knows how to be drawn onto a 2-dimensional screen.

  • definition:
    ...
    #include "element_2d.h"
    ...
    //! A class that enables the
    class Crosshair : public PNode, public Element2D, public EventListener {
    ...
    }
    
  • usage:
        void setPosition2D(int xCoord, int yCoord);
        void setAlignment(E2D_ALIGNMENT alignment) { this->alignment = alignment; };
        void setLayer(E2D_LAYER layer);
        void setVisibility(bool visible) { this->visible = visible; };
        void setBindNode(const PNode* bindNode) { this->bindNode = bindNode; };
    
    These functions are quite selfexplanatory. Important are two things:
    1. you set only a relative-position with setPosition2D
    2. when you set a bindNode, the 2D-element will follow the BindNode's Position, trying to approximate it.