Dragonfly 4.20
A text-based game engine
Public Member Functions | Private Attributes | List of all members
df::SceneGraph Class Reference

Public Member Functions

int insertObject (Object *p_o)
 
int removeObject (Object *p_o)
 
ObjectList activeObjects () const
 
ObjectList solidObjects () const
 
ObjectList visibleObjects (int altitude) const
 
ObjectList objectsOfType (std::string type)
 
ObjectList inactiveObjects () const
 
int updateAltitude (Object *p_o, int new_alt)
 
int updateSolidness (Object *p_o, Solidness new_solidness)
 
int updateVisible (Object *p_vo, bool new_visible)
 
int updateActive (Object *p_o, bool new_active)
 
int updatePosition (Object *p_o, Vector new_position)
 
int updateType (Object *p_o, std::string new_type)
 
ObjectList getCollisions (Object *p_o, Vector where) const
 
GridgetGrid ()
 
int startUp ()
 
void shutDown ()
 

Private Attributes

ObjectList m_active_objects
 
ObjectList m_solid_objects
 
ObjectList m_visible_objects [MAX_ALTITUDE+1]
 
ObjectList m_inactive_objects
 
std::map< std::string, ObjectListm_type
 
Grid m_grid
 

Member Function Documentation

◆ activeObjects()

ObjectList df::SceneGraph::activeObjects ( ) const

Return all active Objects. Empty list if none.

◆ getCollisions()

ObjectList df::SceneGraph::getCollisions ( Object p_o,
Vector  where 
) const

Return list of solid Objects collided with at position 'where'.

Does not consider if p_o is solid or not.

◆ getGrid()

Grid * df::SceneGraph::getGrid ( )

Get Grid.

◆ inactiveObjects()

ObjectList df::SceneGraph::inactiveObjects ( ) const

Return all inactive Objects. Empty list if none.

◆ insertObject()

int df::SceneGraph::insertObject ( Object p_o)

Insert Object into SceneGraph.

Return 0 if ok, else -1.

◆ objectsOfType()

ObjectList df::SceneGraph::objectsOfType ( std::string  type)

Return list of Objects matching type.

List is empty if none found.

◆ removeObject()

int df::SceneGraph::removeObject ( Object p_o)

Remove Object from SceneGraph.

Return 0 if ok, else -1.

◆ shutDown()

void df::SceneGraph::shutDown ( )

Shutdown Scenegraph (delete Quadtree, clear Grid).

◆ solidObjects()

ObjectList df::SceneGraph::solidObjects ( ) const

Return all active, solid Objects. Empty list if none.

◆ startUp()

int df::SceneGraph::startUp ( )

Startup Scenegraph (create Grid).

Return 0 if ok, else -1.

◆ updateActive()

int df::SceneGraph::updateActive ( Object p_o,
bool  new_active 
)

Re-position Object in SceneGraph to new activeness.

Return 0 if ok, else -1.

◆ updateAltitude()

int df::SceneGraph::updateAltitude ( Object p_o,
int  new_alt 
)

Re-position Object in SceneGraph to new altitude.

Return 0 if ok, else -1.

◆ updatePosition()

int df::SceneGraph::updatePosition ( Object p_o,
Vector  new_position 
)

Set position of Object in SceneGraph.

Return 0 if ok, else -1.

◆ updateSolidness()

int df::SceneGraph::updateSolidness ( Object p_o,
Solidness  new_solidness 
)

Re-position Object in SceneGraph to new solidness.

Return 0 if ok, else -1.

◆ updateType()

int df::SceneGraph::updateType ( Object p_o,
std::string  new_type 
)

Re-position Object in SceneGraph to new type.

Return 0 if ok, else -1.

◆ updateVisible()

int df::SceneGraph::updateVisible ( Object p_vo,
bool  new_visible 
)

Re-position Object in SceneGraph to new visibility.

Return 0 if ok, else -1.

◆ visibleObjects()

ObjectList df::SceneGraph::visibleObjects ( int  altitude) const

Return all active, visible Objects at altitude. Empty list if none.

Member Data Documentation

◆ m_active_objects

ObjectList df::SceneGraph::m_active_objects
private

All active Objects.

◆ m_grid

Grid df::SceneGraph::m_grid
private

Grid for collision detection.

◆ m_inactive_objects

ObjectList df::SceneGraph::m_inactive_objects
private

All inactive Objects.

◆ m_solid_objects

ObjectList df::SceneGraph::m_solid_objects
private

Solid Objects.

◆ m_type

std::map<std::string, ObjectList> df::SceneGraph::m_type
private

Map of type:Object.

◆ m_visible_objects

ObjectList df::SceneGraph::m_visible_objects[MAX_ALTITUDE+1]
private

Visible Objects.