Torque2D Reference
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Functions | Variables
Sim Namespace Reference

Functions

 ImplementNamedSet (ActiveActionMapSet) ImplementNamedSet(GhostAlwaysSet) ImplementNamedSet(BehaviorSet) ImplementNamedSet(AchievementSet)
 
 DeclareNamedSet (ActiveActionMapSet) DeclareNamedSet(GhostAlwaysSet) DeclareNamedSet(BehaviorSet) DeclareNamedSet(AchievementSet) DeclareNamedGroup(ActionMapGroup) DeclareNamedGroup(ClientGroup) DeclareNamedGroup(GuiGroup) DeclareNamedGroup(GuiDataGroup) DeclareNamedGroup(TCPGroup) DeclareNamedGroup(ClientConnectionGroup) DeclareNamedGroup(ChunkFileGroup)
 
void init ()
 
void shutdown ()
 
SimDataBlockGroupgetDataBlockGroup ()
 
SimGroupgetRootGroup ()
 
SimObjectfindObject (SimObjectId)
 
SimObjectfindObject (const char *name)
 
template<class T >
bool findObject (SimObjectId id, T *&t)
 
template<class T >
bool findObject (const char *pObjectName, T *&t)
 
void advanceToTime (SimTime time)
 
void advanceTime (SimTime delta)
 
SimTime getCurrentTime ()
 
SimTime getTargetTime ()
 
U32 postEvent (SimObject *, SimEvent *, U32 targetTime)
 a target time of 0 on an event means current event More...
 
U32 postEvent (SimObjectId iD, SimEvent *evt, U32 targetTime)
 
U32 postEvent (const char *objectName, SimEvent *evt, U32 targetTime)
 
U32 postCurrentEvent (SimObject *obj, SimEvent *evt)
 
U32 postCurrentEvent (SimObjectId obj, SimEvent *evt)
 
U32 postCurrentEvent (const char *obj, SimEvent *evt)
 
void cancelEvent (U32 eventId)
 
bool isEventPending (U32 eventId)
 
U32 getEventTimeLeft (U32 eventId)
 
U32 getTimeSinceStart (U32 eventId)
 
U32 getScheduleDuration (U32 eventId)
 
bool saveObject (SimObject *obj, Stream *stream)
 
SimObjectloadObjectStream (Stream *stream)
 
bool saveObject (SimObject *obj, const char *filename)
 
SimObjectloadObjectStream (const char *filename)
 
void initEventQueue ()
 
void shutdownEventQueue ()
 
void cancelPendingEvents (SimObject *obj)
 
void initRoot ()
 
void shutdownRoot ()
 

Variables

SimIdDictionarygIdDictionary
 
SimTime gCurrentTime
 
SimTime gTargetTime
 
void * gEventQueueMutex
 
SimEventgEventQueue
 
U32 gEventSequence
 
SimGroupgRootGroup = NULL
 
SimManagerNameDictionarygNameDictionary
 
U32 gNextObjectId
 
SimDataBlockGroupgDataBlockGroup
 

Function Documentation

void advanceTime ( SimTime  delta)
void advanceToTime ( SimTime  time)
void cancelEvent ( U32  eventSequence)

cancel a previously scheduled event.

Parameters
eventSequenceThe numeric ID of a previously scheduled event.
Returns
No return value.
See Also
getEventTimeLeft, getScheduleDuration, getTimeSinceStart, isEventPending, schedule, obj.schedule
void cancelPendingEvents ( SimObject obj)
Sim::DeclareNamedSet ( ActiveActionMapSet  )
SimObject * findObject ( SimObjectId  id)
inline
SimObject * findObject ( const char *  name)
inline
bool Sim::findObject ( SimObjectId  id,
T *&  t 
)
inline
bool Sim::findObject ( const char *  pObjectName,
T *&  t 
)
inline
U32 getCurrentTime ( )

get the time, in ticks, that has elapsed since the engine started executing.

Returns
the time in ticks since the engine was started.
See Also
getRealTime
SimDataBlockGroup * getDataBlockGroup ( )
U32 getEventTimeLeft ( U32  eventSequence)

determines how much time remains until the event specified by eventID occurs.

Parameters
eventIDThe numeric ID of a previously scheduled event.
Returns
a non-zero integer value equal to the milliseconds until the event specified by eventID will occur. However, if eventID is invalid, or the event has passed, this function will return zero.
See Also
cancel, getScheduleDuration, getTimeSinceStart, isEventPending, schedule, SimObject::schedule
SimGroup * getRootGroup ( )
U32 getScheduleDuration ( U32  eventSequence)

Determines how long the event associated with eventID was scheduled for.

Parameters
eventIDThe numeric ID of a previously scheduled event.
Returns
a non-zero integer value equal to the milliseconds used in the schedule call that created this event. However, if eventID is invalid, this function will return zero.
See Also
cancel, getEventTimeLeft, getTimeSinceStart, isEventPending, schedule, SimObject::schedule
U32 getTargetTime ( )
U32 getTimeSinceStart ( U32  eventSequence)

Determines how much time has passed since the event specified by eventID was scheduled.

Parameters
eventIDThe numeric ID of a previously scheduled event.
Returns
a non-zero integer value equal to the milliseconds that have passed since this event was scheduled. However, if eventID is invalid, or the event has passed, this function will return zero.
See Also
cancel, getEventTimeLeft, getScheduleDuration, isEventPending, schedule, SimObject::schedule
Sim::ImplementNamedSet ( ActiveActionMapSet  )
void init ( )
void Sim::initEventQueue ( )
void Sim::initRoot ( )
bool isEventPending ( U32  eventSequence)

see if the event associated with eventID is still pending.

When an event passes, the eventID is removed from the event queue, becoming invalid, so there is no discernable difference between a completed event and a bad event ID.

Parameters
eventIDThe numeric ID of a previously scheduled event.
Returns
true if this event is still outstanding and false if it has passed or eventID is invalid.
See Also
cancel, getEventTimeLeft, getScheduleDuration, getTimeSinceStart, schedule, obj.schedule
SimObject * loadObjectStream ( Stream stream)
SimObject * loadObjectStream ( const char *  filename)
U32 Sim::postCurrentEvent ( SimObject obj,
SimEvent evt 
)
inline
U32 Sim::postCurrentEvent ( SimObjectId  obj,
SimEvent evt 
)
inline
U32 Sim::postCurrentEvent ( const char *  obj,
SimEvent evt 
)
inline
U32 postEvent ( SimObject destObject,
SimEvent event,
U32  targetTime 
)

a target time of 0 on an event means current event

U32 Sim::postEvent ( SimObjectId  iD,
SimEvent evt,
U32  targetTime 
)
inline
U32 Sim::postEvent ( const char *  objectName,
SimEvent evt,
U32  targetTime 
)
inline
bool saveObject ( SimObject obj,
Stream stream 
)
bool saveObject ( SimObject obj,
const char *  filename 
)
void shutdown ( )
void Sim::shutdownEventQueue ( )
void Sim::shutdownRoot ( )

Variable Documentation

SimTime gCurrentTime
SimDataBlockGroup* gDataBlockGroup
SimEvent* gEventQueue
void* gEventQueueMutex
U32 gEventSequence
SimIdDictionary * gIdDictionary
SimManagerNameDictionary * gNameDictionary
U32 gNextObjectId
SimGroup* gRootGroup = NULL
SimTime gTargetTime