#include <imagetree.h>
Public Types | |
enum | { ALWAYS_INSIDE_BOX = 0x01, GET_ALL_HITS = 0x04 } |
Public Methods | |
KrImNode * | Root () |
Return the very base node of the tree. It is a KrImNode and never a more derived type. | |
void | AddNode (KrImNode *parent, KrImNode *addMe) |
Add a ImNode to the tree. More... | |
bool | DeleteNode (KrImNode *removeMe) |
Call this to delete a node and remove it from the tree. More... | |
KrImNode * | FindNodeById (int id) |
Find a ImNode by its id. | |
KrImNode * | FindNodeByName (const std::string &name) |
Find a ImNode by its name. | |
void | HitTest (int x, int y, int flags, GlDynArray< KrImage *> *outputArray, int *windowIndex) |
Given a point -- in screen coordinates -- determine what ImageNodes are under that point. More... | |
bool | CheckSiblingCollision (KrImNode *checkThis, GlDynArray< KrImage *> *outputArray, int window=0) |
Given a node, check if it collides with any of its own siblings. More... | |
bool | CheckChildCollision (KrImNode *checkThis, KrImNode *parent, GlDynArray< KrImage *> *outputArray, int window=0) |
Given a node "checkThis" and a parent, check if "checkThis" collides with any of the children of the parent. More... | |
bool | CheckAllCollision (KrImNode *checkThis, GlDynArray< KrImage *> *outputArray, int window=0) |
Given a node, check if it collides with anything in the Tree. More... | |
void | Walk () |
Flushes the cached state of the tree and makes it ready to draw. |
|
|
|
Add a ImNode to the tree. The parent can be specified; if not, the root will be used. The node added -- 'addMe' -- is handed over by ownership. It will be deleted when the tree is deleted or DeleteNode is called. Node children cannot directly be added. There is no KrImNode::AddChild function for instance; everything must be added through the tree. |
|
Given a node, check if it collides with anything in the Tree. Returns true if any collisions occur, and returns an array of everything collided with. See KrImage::CheckCollision for a discussion of collision issues. |
|
Given a node "checkThis" and a parent, check if "checkThis" collides with any of the children of the parent. There does not need to be any relationship between "checkThis" and "parent". Returns true if any collisions occur, and returns an array (outputArray) of all the KrImages collided with. See KrImage::CheckCollision for a discussion of collision issues. |
|
Given a node, check if it collides with any of its own siblings. Returns true if any collisions occur, and returns an array (outputArray) of all the KrImages collided with. See KrImage::CheckCollision for a discussion of collision issues. |
|
Call this to delete a node and remove it from the tree. @WARNING: DeleteNode( this ) can cause a crash. It's a temptingly useful thing, but in the case where parent objects hold on to pointers, those pointers go dangling. It's best to avoid DeleteNode( this ) usage. |
|
Given a point -- in screen coordinates -- determine what ImageNodes are under that point. Note that only images have bounds and are drawn, so only images can be hit. HitTest, by defualt, stops at the first non-transparent pixel it hits. There are flags to modify this behavior:
|