Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

TimerAgent Class Reference

Inheritance diagram for TimerAgent:

Inheritance graph
[legend]
Collaboration diagram for TimerAgent:

Collaboration graph
[legend]

Detailed Description

Delay and framerame.

Definition at line 12 of file TimerAgent.h.

Public Member Functions

Uint32 getDeltaTime () const
int getCycles () const

Protected Member Functions

virtual void own_init ()
virtual void own_update ()
 Sleep fixed number miliseconds.


Member Function Documentation

int TimerAgent::getCycles  )  const [inline]
 

Definition at line 27 of file TimerAgent.h.

00027 { return m_count; }

Uint32 TimerAgent::getDeltaTime  )  const [inline]
 

Definition at line 26 of file TimerAgent.h.

00026 { return m_deltaTime; }

void TimerAgent::own_init  )  [protected, virtual]
 

Reimplemented from BaseAgent.

Definition at line 15 of file TimerAgent.cpp.

00016 {
00017     m_timeinterval = OptionAgent::agent()->getAsInt("timeinterval", 100);
00018     m_lastTime = SDL_GetTicks();
00019     m_nextTime = m_lastTime;
00020     m_deltaTime = 1;
00021     m_count = 0;
00022 }

void TimerAgent::own_update  )  [protected, virtual]
 

Sleep fixed number miliseconds.

Reimplemented from BaseAgent.

Definition at line 42 of file TimerAgent.cpp.

00043 {
00044     m_count++;
00045 
00046     Uint32 now = SDL_GetTicks();
00047     if (now < m_nextTime) {
00048         SDL_Delay(m_nextTime - now);
00049     }
00050 
00051     now = SDL_GetTicks();
00052     //NOTE: every cycle have fixed time interval
00053     m_nextTime = now + getTimeInterval();
00054 
00055     m_deltaTime = now - m_lastTime;
00056     m_lastTime = now;
00057 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:57:03 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2