Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Version 2 (modified by landauf, 16 years ago) (diff)

Element2D

This is an archived page!
This page is very old and the content is not up to date.
Not everything (if any) which is written here will be in the final game!

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.