The idea is that a Node can have child nodes, which on their turn can have even more child nodes an so on.
The interface of the Node class:
namespace sfge
{
class Node
{
public:
Node(const std::string& name = "Node");
virtual ~Node();
std::string getName();
void draw(sf::RenderTarget& target);
void update(sf::Time delta);
void addNode(Node* node);
void removeNode(Node* node);
Node* getParent();
void setParent(Node* parentnode);
protected:
virtual void onDraw(sf::RenderTarget& target){}
virtual void onUpdate(sf::Time delta){}
Node* parent;
std::vector<Node*> children;
std::string name;
};
}
When the draw function is called, the Node draws itself as well as all his children. Same holds for the update function. onDraw and onUpdate draw and update the current node.
ConvexCollidable has been changed to CollidableNode (derives from Node) and the AABB classes have been removed.
Geen opmerkingen:
Een reactie posten