source: nrEngine/include/ITimeObserver.h @ 23

Revision 23, 2.4 KB checked in by art, 14 years ago (diff)
Line 
1/***************************************************************************
2 *                                                                         *
3 *   (c) Art Tevs, MPI Informatik Saarbruecken                             *
4 *       mailto: <tevs@mpi-sb.mpg.de>                                      *
5 *                                                                         *
6 *   This program is free software; you can redistribute it and/or modify  *
7 *   it under the terms of the GNU General Public License as published by  *
8 *   the Free Software Foundation; either version 2 of the License, or     *
9 *   (at your option) any later version.                                   *
10 *                                                                         *
11 ***************************************************************************/
12
13
14#ifndef _NR_I_TIMEOBSERVER_H_
15#define _NR_I_TIMEOBSERVER_H_
16
17
18//----------------------------------------------------------------------------------
19// Includes
20//----------------------------------------------------------------------------------
21#include "Prerequisities.h"
22
23namespace nrEngine{
24
25        //! Interface for every kind of objects used to observe the ticking of the clock       
26        /**
27        * ITimeObserver is an object which observers our global clock. Each time clock ticks
28        * (this is not every second, but every frame) observer will be notified about
29        * this and can do his work. Good example for such an observer is a timer, which
30        * is updated every frame and provide time for parts of your application.
31        * This also can be an alarm-clock which wait until certain time point and then fires.
32        *
33        * \ingroup time
34        **/
35        class _NRExport ITimeObserver {
36        public:
37               
38                // Clock class is a friend, so he has full access
39                friend class Clock;
40               
41                // constructor & destructor
42                ITimeObserver(){_observerID = 0;}
43                virtual ~ITimeObserver(){}
44               
45                /**
46                * Clock should notify me every frame.
47                **/
48                virtual void notifyTimeObserver() = 0;
49               
50                /**
51                * Returns the observer id given us by the clock.
52                * You will need this id if you want to delete observer
53                * from the clock's list of observers
54                **/
55                int32 getObserverID(){return _observerID; }
56               
57                /**
58                 * Call this method to reset an observer.
59                 * Each observer should know how to reset himself
60                 * @param resetToTime reset the observer to this starting time
61                 **/
62                virtual void resetObserver(float64 resetToTime = 0.0f) = 0;
63               
64        private:
65                int32 _observerID;
66               
67        };
68       
69}; // end namespace
70
71#endif
Note: See TracBrowser for help on using the repository browser.