Container Class Reference

#include <Container.h>

Inheritance diagram for Container:
Entity Actor Stage UIContainer ParticleSystem

# Public Member Functions

void constructor (int16 internalId, const char *const name)
override void setDirection (const Vector3D *direction)
override void show ()
 Make this instance visible.
override void hide ()
 Make this instance invisible.
override void setTransparency (uint8 transparency)
override void setPosition (const Vector3D *position)
override void setRotation (const Rotation *rotation)
override void setScale (const Scale *scale)
void setNormalizedDirection (NormalizedDirection normalizedDirection)
NormalizedDirection getNormalizedDirection ()
void deleteMyself ()
int16 getInternalId ()
void setName (const char *const name)
const char * getName ()
void streamOut (bool streamOut)
Container getParent ()
void addChild (Container child)
void removeChild (Container child, bool deleteChild)
void purgeChildren ()
 Force the destruction of all children marked to be deleted.
bool getChildren (ClassPointer classPointer, VirtualList children)
Container getChildById (int16 id)
Container getChildByName (const char *childName, bool recursive)
Container getChildAtPosition (int16 position)
int32 getChildrenCount ()
Container getFirstAncestor ()
Container getRelativeByName (const char *relativeName)
void updateChildren ()
 Update the children of this container.
void invalidateTransformation ()
void transformChildren (uint8 invalidateTransformationFlag)
void propagateCommand (uint32 command,...)
bool propagateMessage (bool(*propagatedMessageHandler)(void *, va_list),...)
bool onPropagatedMessage (va_list args)
bool propagateString (bool(*propagatedMessageHandler)(void *, va_list),...)
bool onPropagatedString (va_list args)
void translate (const Vector3D *translation)
void rotate (const Rotation *rotation)
void scale (const Scale *scale)
const Vector3DgetLocalPosition ()
const RotationgetLocalRotation ()
const ScalegetLocalScale ()
virtual void setLocalPosition (const Vector3D *position)
virtual void setLocalRotation (const Rotation *rotation)
virtual void setLocalScale (const Scale *scale)
virtual void ready (bool recursive)
virtual void transform (const Transformation *environmentTransform, uint8 invalidateTransformationFlag)
virtual void update ()
 Update this instance's logic.
virtual void suspend ()
 Prepare to suspend this instance's logic.
virtual void resume ()
 Prepare to resume this instance's logic.
virtual void handleCommand (int32 command, va_list args)
virtual bool handlePropagatedMessage (int32 message)
virtual bool handlePropagatedString (const char *string)

# Protected Attributes

Container parent
 Container of which this one is a child.
VirtualList children
Transformation localTransformation
 3D local transformation
char * name
 Container's name.
int16 internalId
 Container's internal id, set by the engine.
bool deleteMe
 If true, the parent will delete this container when appropriate.
bool ready
bool dontStreamOut
bool hidden
 Flag to mark the container (and its children) as non visible.
int8 axisForSynchronizationWithBody
 Axises around which to rotate the container when syncronizing with body.

# Additional Inherited Members

- Private Member Functions inherited from Entity
void constructor ()
 Class' constructor.
override bool handleMessage (Telegram telegram)
void clearComponentLists (uint32 componentType)
Component addComponent (const ComponentSpec *componentSpec)
void removeComponent (Component component)
void addComponents (ComponentSpec **componentSpecs, uint32 componentType)
void removeComponents (uint32 componentType)
Component getComponentAtIndex (uint32 componentType, int16 componentIndex)
VirtualList getComponents (uint32 componentType)
bool getComponentsOfClass (ClassPointer classPointer, VirtualList components, uint32 componentType)
uint16 getComponentsCount (uint32 componentType)
void resetComponents ()
 Reset components.
void setVisible ()
 Set this instance's visibility flag up.
const TransformationgetTransformation ()
const Vector3DgetPosition ()
const RotationgetRotation ()
const ScalegetScale ()
Body getBody ()
bool isMoving ()
void stopAllMovement ()
 Stop all entity's movement.
void stopMovement (uint16 axis)
bool setVelocity (const Vector3D *velocity, bool checkIfCanMove)
const Vector3DgetVelocity ()
fixed_t getSpeed ()
fixed_t getMaximumSpeed ()
fixed_t getBounciness ()
fixed_t getFrictionCoefficient ()
void enableCollisions ()
 Enable collision detection on the entity's colliders.
void disableCollisions ()
 Disable collision detection on the entity's colliders.
void checkCollisions (bool activate)
void registerCollisions (bool activate)
void setCollidersLayers (uint32 layers)
uint32 getCollidersLayers ()
void setCollidersLayersToIgnore (uint32 layersToIgnore)
uint32 getCollidersLayersToIgnore ()
bool hasColliders ()
void showColliders ()
 Make the entity's colliders visible.
void hideColliders ()
 Make the entity's colliders invisible.
virtual void createComponents (ComponentSpec **componentSpecs)
virtual void destroyComponents ()
 Destroy the components that attach to this container.
virtual void addedComponent (Component component)
virtual void removedComponent (Component component)
virtual void calculateSize ()
 Configure the entity's size.
virtual fixed_t getRadius ()
virtual const Vector3DgetDirection ()
virtual bool applyForce (const Vector3D *force, bool checkIfCanMove)
virtual bool canMoveTowards (Vector3D direction)
virtual bool isSensibleToCollidingObjectBouncinessOnCollision (Entity collidingEntity)
virtual bool isSensibleToCollidingObjectFrictionOnCollision (Entity collidingEntity)
virtual bool isSubjectToGravity (Vector3D gravity)
virtual bool collisionStarts (const CollisionInformation *collisionInformation)
virtual void collisionPersists (const CollisionInformation *collisionInformation)
virtual void collisionEnds (const CollisionInformation *collisionInformation)
virtual uint32 getInGameType ()
- Private Attributes inherited from Entity
VirtualListcomponents
 Linked list of attached components.
Transformation transformation
 3D transformation
Body body
bool isVisible
 Flag used for streaming purposes.

# Detailed Description

Class Container

Inherits from Entity

Adds parenting cababilities to spatial objects.

Definition at line 41 of file Container.h.

# Member Function Documentation

# addChild()

void Container::addChild ( Container child)

Add a container as a child.

Parameters
childContainer to be added as a child

Definition at line 406 of file Container.c.

# constructor()

void Container::constructor ( int16 internalId,
const char *const name )

Class' constructor

Parameters
internalIdID to keep track internally of the new instance
nameName to assign to the new instance

Definition at line 35 of file Container.c.

# deleteMyself()

void Container::deleteMyself ( )

Delete this container when appropriate. Containers must not be deleted nor created directly by the client code

Definition at line 334 of file Container.c.

# getChildAtPosition()

Container Container::getChildAtPosition ( int16 position)

Retrieve the child at the provided position in the linked list of children.

Parameters
positionPosition in the linked list of children
Returns
The child container at the provided position if any

Definition at line 614 of file Container.c.

# getChildById()

Container Container::getChildById ( int16 id)

Retrieve a child of this container whose internal ID equals the provided one.

Parameters
idInternal ID to look for
Returns
Child container whose ID matches the provided one

Definition at line 573 of file Container.c.

# getChildByName()

Container Container::getChildByName ( const char * childName,
bool recursive )

Find a child with the provided name.

Parameters
childNameName to look for
recursiveIf true, the seach extends to grand children, grand grand children, etc.
Returns
The first child container whose name equals the provided one

Definition at line 593 of file Container.c.

# getChildren()

bool Container::getChildren ( ClassPointer classPointer,
VirtualList children )

Retrieve the linked list of children that are instances of the provided class.

Parameters
classPointerPointer to the class to use as search criteria. Usage: typeofclass(ClassName)
childrenLinked list to be filled with the children that meed the search criteria (it is externally allocated and must be externally deleted)
Returns
True if one or more children met the search criteria; false otherwise

Definition at line 551 of file Container.c.

# getChildrenCount()

int32 Container::getChildrenCount ( )

Retrieve the amount of children of this container.

Returns
Amount of children of this container

Definition at line 626 of file Container.c.

# getFirstAncestor()

Container Container::getFirstAncestor ( )

Retrieve the first ancestor.

Returns
The first ancestor of the container.

Definition at line 633 of file Container.c.

# getInternalId()

int16 Container::getInternalId ( )

Retrieve the container's internal id used by the engine to keep track of it.

Returns
Container's internal id

Definition at line 378 of file Container.c.

# getLocalPosition()

const Vector3D * Container::getLocalPosition ( )

Retrieve the local position.

Returns
Pointer to the local transformation's position

Definition at line 871 of file Container.c.

# getLocalRotation()

const Rotation * Container::getLocalRotation ( )

Retrieve the local rotation.

Returns
Pointer to the local transformation's rotation

Definition at line 878 of file Container.c.

# getLocalScale()

const Scale * Container::getLocalScale ( )

Retrieve the local scale.

Returns
Pointer to the local transformation's scale

Definition at line 885 of file Container.c.

# getName()

const char * Container::getName ( )

Retrive the container's name.

Returns
Pointer to the container's name

Definition at line 385 of file Container.c.

# getNormalizedDirection()

NormalizedDirection Container::getNormalizedDirection ( )

Retrieve the normalized direction towards where the container faces.

Returns
Container's facing direction with is components normalized

Definition at line 307 of file Container.c.

# getParent()

Container Container::getParent ( )

Retrieve this container's parent container.

Returns
Parent container

Definition at line 399 of file Container.c.

# getRelativeByName()

Container Container::getRelativeByName ( const char * relativeName)

Find a relative in the whole hierarchy of containers with the provided name.

Parameters
relativeNameName to look for
Returns
The first container whose name equals the provided one

Definition at line 647 of file Container.c.

# handleCommand()

void Container::handleCommand ( int32 command,
va_list args )
virtual

Default command handler.

Parameters
commandPropagated command
argsVariable arguments list depending on the command to handle

Reimplemented in Actor.

Definition at line 1056 of file Container.c.

# handlePropagatedMessage()

bool Container::handlePropagatedMessage ( int32 message)
virtual

Default interger message handler for propagateMessage

Parameters
messagePropagated integer message
Returns
True if the propagation must stop; false if the propagation must reach other containers

Definition at line 1061 of file Container.c.

# handlePropagatedString()

bool Container::handlePropagatedString ( const char * string)
virtual

Default string handler for propagateString

Parameters
stringPropagated string
Returns
True if the propagation must stop; false if the propagation must reach other containers

Reimplemented in Actor.

Definition at line 1068 of file Container.c.

# hide()

void Container::hide ( )
virtual

Make this instance invisible.

Reimplemented from Entity.

Reimplemented in ParticleSystem.

Definition at line 151 of file Container.c.

# invalidateTransformation()

void Container::invalidateTransformation ( )

Invalidate the transformation to force it to be recomputed in the next game cycle.

Definition at line 701 of file Container.c.

# onPropagatedMessage()

bool Container::onPropagatedMessage ( va_list args)

Generic integer message propagator

Parameters
argsVariable list of propagated arguments

Definition at line 797 of file Container.c.

# onPropagatedString()

bool Container::onPropagatedString ( va_list args)

Generic string propagator

Parameters
argsVariable list of propagated arguments

Definition at line 819 of file Container.c.

# propagateCommand()

void Container::propagateCommand ( uint32 command,
... )

Propagate a command to the container's children.

Parameters
commandMethod that handles the message
...Variable arguments list depending on the command
Returns
The result that the provided message handler returns

Definition at line 758 of file Container.c.

# propagateMessage()

bool Container::propagateMessage ( bool(* propagatedMessageHandler )(void *, va_list),
... )

Propagate an integer message through the whole parenting hierarchy (children, grand children, etc.).

Parameters
propagatedMessageHandlerMethod that handles the message
...Variable arguments list depending on the message
Returns
The result that the provided message handler returns

Definition at line 783 of file Container.c.

# propagateString()

bool Container::propagateString ( bool(* propagatedMessageHandler )(void *, va_list),
... )

Propagate a string through the whole parenting hierarchy (children, grand children, etc.).

Parameters
propagatedMessageHandlerMethod that handles the string
...Variable arguments list depending on the string
Returns
The result that the provided string handler returns

Definition at line 805 of file Container.c.

# purgeChildren()

void Container::purgeChildren ( )

Force the destruction of all children marked to be deleted.

Definition at line 507 of file Container.c.

# ready()

virtual void Container::ready ( bool recursive)
virtual

Make the container ready to start operating once it has been completely intialized.

Parameters
recursiveIf true, the ready call is propagated to its children, grand children, etc.

Reimplemented in Actor.

# removeChild()

void Container::removeChild ( Container child,
bool deleteChild )

Reomve a child container for this container's children list.

Parameters
childContainer to be remove as a child
deleteChildIf true, the child will be deleted in the next game cycle

Definition at line 460 of file Container.c.

# resume()

void Container::resume ( )
virtual

Prepare to resume this instance's logic.

Reimplemented in Actor, ParticleSystem, and Stage.

Definition at line 1030 of file Container.c.

# rotate()

void Container::rotate ( const Rotation * rotation)

Rotate the container.

Parameters
rotationRotation to be added to the container's rotation

Definition at line 850 of file Container.c.

# scale()

void Container::scale ( const Scale * scale)

Scale the container.

Parameters
scaleScale to be applied to the container's scale

Definition at line 862 of file Container.c.

# setDirection()

void Container::setDirection ( const Vector3D * direction)
virtual

Set the direction towards which the object must move.

Parameters
directionPointer to a direction vector

Reimplemented from Entity.

Definition at line 210 of file Container.c.

# setLocalPosition()

void Container::setLocalPosition ( const Vector3D * position)
virtual

Set the local position.

Parameters
positionNew local position

Definition at line 892 of file Container.c.

# setLocalRotation()

void Container::setLocalRotation ( const Rotation * rotation)
virtual

Set the local rotation.

Parameters
rotationNew local rotation

Definition at line 933 of file Container.c.

# setLocalScale()

void Container::setLocalScale ( const Scale * scale)
virtual

Set the local scale.

Parameters
scaleNew local scale

Definition at line 955 of file Container.c.

# setName()

void Container::setName ( const char *const name)

Set the container's name.

Parameters
nameName to assign to the instance

Definition at line 351 of file Container.c.

# setNormalizedDirection()

void Container::setNormalizedDirection ( NormalizedDirection normalizedDirection)

Set the normalized direction towards where the container faces.

Parameters
normalizedDirectionNew facing direction with is components normalized

Definition at line 271 of file Container.c.

# setPosition()

void Container::setPosition ( const Vector3D * position)
virtual

Set the container's position.

Parameters
position3D vector defining the object's new position

Reimplemented from Entity.

Definition at line 177 of file Container.c.

# setRotation()

void Container::setRotation ( const Rotation * rotation)
virtual

Set the container's rotation.

Parameters
rotationRotation

Reimplemented from Entity.

Definition at line 188 of file Container.c.

# setScale()

void Container::setScale ( const Scale * scale)
virtual

Set the container's scale.

Parameters
scaleScale

Reimplemented from Entity.

Definition at line 199 of file Container.c.

# setTransparency()

void Container::setTransparency ( uint8 transparency)
virtual

Set this instance's transparency effects.

Parameters
transparencyTransparecy effect (__TRANSPARENCY_NONE, __EVEN or __ODD)

Reimplemented from Entity.

Reimplemented in ParticleSystem.

Definition at line 165 of file Container.c.

# show()

void Container::show ( )
virtual

Make this instance visible.

Reimplemented from Entity.

Reimplemented in ParticleSystem.

Definition at line 135 of file Container.c.

# streamOut()

void Container::streamOut ( bool streamOut)

Set the streaming effects on this container.

Parameters
streamOutIf false, this container won't be streamed out when outside of the camera's reach

Definition at line 392 of file Container.c.

# suspend()

void Container::suspend ( )
virtual

Prepare to suspend this instance's logic.

Reimplemented in Actor, ParticleSystem, and Stage.

Definition at line 1011 of file Container.c.

# transform()

void Container::transform ( const Transformation * environmentTransform,
uint8 invalidateTransformationFlag )
virtual

Compute the container's global transformation.

Parameters
environmentTransformReference environment for the local transformation
invalidateTransformationFlagFlag that determines which transfomation's components must be recomputed

Reimplemented in UIContainer.

Definition at line 997 of file Container.c.

# transformChildren()

void Container::transformChildren ( uint8 invalidateTransformationFlag)

Apply the transformations to this container's children.

Parameters
invalidateTransformationFlagFlag that determines which transfomation's components must be recomputed

Force non virtual call

Definition at line 718 of file Container.c.

# translate()

void Container::translate ( const Vector3D * translation)

Displace the container.

Parameters
translationDisplacement to be added to the container's position

Definition at line 827 of file Container.c.

# update()

void Container::update ( )
virtual

Update this instance's logic.

Reimplemented in ParticleSystem.

Definition at line 1004 of file Container.c.

# updateChildren()

void Container::updateChildren ( )

Update the children of this container.

Definition at line 656 of file Container.c.

# Member Data Documentation

# axisForSynchronizationWithBody

int8 Container::axisForSynchronizationWithBody
protected

Axises around which to rotate the container when syncronizing with body.

Definition at line 75 of file Container.h.

# children

VirtualList Container::children
protected

Linked list of child containers The VB's CPU doesn't have data cache, so there is not a good reason to loose generality

Definition at line 51 of file Container.h.

# deleteMe

bool Container::deleteMe
protected

If true, the parent will delete this container when appropriate.

Definition at line 63 of file Container.h.

# dontStreamOut

bool Container::dontStreamOut
protected

Definition at line 69 of file Container.h.

# hidden

bool Container::hidden
protected

Flag to mark the container (and its children) as non visible.

Definition at line 72 of file Container.h.

# internalId

int16 Container::internalId
protected

Container's internal id, set by the engine.

Definition at line 60 of file Container.h.

# localTransformation

Transformation Container::localTransformation
protected

3D local transformation

Definition at line 54 of file Container.h.

# name

char* Container::name
protected

Container's name.

Definition at line 57 of file Container.h.

# parent

Container Container::parent
protected

Container of which this one is a child.

Definition at line 46 of file Container.h.

# ready

void Container::ready
protected

Definition at line 66 of file Container.h.


The documentation for this class was generated from the following files: