00001 /*************************************************************************** 00002 * * 00003 * (c) Art Tevs, MPI Informatik Saarbruecken * 00004 * mailto: <tevs@mpi-sb.mpg.de> * 00005 * * 00006 * This program is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 2 of the License, or * 00009 * (at your option) any later version. * 00010 * * 00011 ***************************************************************************/ 00012 00013 00014 #ifndef _NR_I_TIMESOURCE_VIRTUAL_H_ 00015 #define _NR_I_TIMESOURCE_VIRTUAL_H_ 00016 00017 //---------------------------------------------------------------------------------- 00018 // Includes 00019 //---------------------------------------------------------------------------------- 00020 #include "Prerequisities.h" 00021 #include "TimeSource.h" 00022 00023 namespace nrEngine{ 00024 00025 00026 //! Timesource ticking certain time steps 00027 /** 00028 * Virtual time source does tick in fix steps. 00029 * You can use it to force clock ticking on fix steps 00030 * and not based on system time. 00031 * 00032 * \ingroup time 00033 **/ 00034 class _NRExport TimeSourceVirtual : public TimeSource { 00035 public: 00036 00037 /** 00038 **/ 00039 TimeSourceVirtual(float64 timeStep); 00040 00041 /** 00042 **/ 00043 ~TimeSourceVirtual(); 00044 00045 /** 00046 * Return the time based on fixed ticks. Each calling of this function 00047 * will increase the internal time counter. So the clock does call this method only 00048 * once per frame. 00049 **/ 00050 float64 getTime(); 00051 00052 /** 00053 * Reset the time source. This will force the time source to coutn from 0. 00054 * Specify the startValue parameter to set the starting value of the time counter 00055 **/ 00056 void reset(float64 startValue); 00057 00058 00059 void notifyNextFrame(); 00060 00061 protected: 00062 00063 //! Fix time step 00064 float64 _timeStep; 00065 00066 }; 00067 00068 }; // end namespace 00069 00070 #endif