diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/irrlicht-1.8/source/Irrlicht/CTimer.h | 216 |
1 files changed, 108 insertions, 108 deletions
diff --git a/libraries/irrlicht-1.8/source/Irrlicht/CTimer.h b/libraries/irrlicht-1.8/source/Irrlicht/CTimer.h index 8d8b8b8..2fb6a1a 100644 --- a/libraries/irrlicht-1.8/source/Irrlicht/CTimer.h +++ b/libraries/irrlicht-1.8/source/Irrlicht/CTimer.h | |||
@@ -1,108 +1,108 @@ | |||
1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt | 1 | // Copyright (C) 2002-2012 Nikolaus Gebhardt |
2 | // This file is part of the "Irrlicht Engine". | 2 | // This file is part of the "Irrlicht Engine". |
3 | // For conditions of distribution and use, see copyright notice in irrlicht.h | 3 | // For conditions of distribution and use, see copyright notice in irrlicht.h |
4 | 4 | ||
5 | #ifndef __C_IRR_C_TIMER_H_INCLUDED__ | 5 | #ifndef __C_IRR_C_TIMER_H_INCLUDED__ |
6 | #define __C_IRR_C_TIMER_H_INCLUDED__ | 6 | #define __C_IRR_C_TIMER_H_INCLUDED__ |
7 | 7 | ||
8 | #include "ITimer.h" | 8 | #include "ITimer.h" |
9 | #include "os.h" | 9 | #include "os.h" |
10 | 10 | ||
11 | namespace irr | 11 | namespace irr |
12 | { | 12 | { |
13 | //! Device independent implementation of the timer | 13 | //! Device independent implementation of the timer |
14 | class CTimer : public ITimer | 14 | class CTimer : public ITimer |
15 | { | 15 | { |
16 | public: | 16 | public: |
17 | 17 | ||
18 | CTimer(bool usePerformanceTimer=true) | 18 | CTimer(bool usePerformanceTimer=true) |
19 | { | 19 | { |
20 | os::Timer::initTimer(usePerformanceTimer); | 20 | os::Timer::initTimer(usePerformanceTimer); |
21 | } | 21 | } |
22 | 22 | ||
23 | //! Returns current real time in milliseconds of the system. | 23 | //! Returns current real time in milliseconds of the system. |
24 | /** This value does not start with 0 when the application starts. | 24 | /** This value does not start with 0 when the application starts. |
25 | For example in one implementation the value returned could be the | 25 | For example in one implementation the value returned could be the |
26 | amount of milliseconds which have elapsed since the system was started. */ | 26 | amount of milliseconds which have elapsed since the system was started. */ |
27 | virtual u32 getRealTime() const | 27 | virtual u32 getRealTime() const |
28 | { | 28 | { |
29 | return os::Timer::getRealTime(); | 29 | return os::Timer::getRealTime(); |
30 | } | 30 | } |
31 | 31 | ||
32 | //! Get current time and date in calendar form | 32 | //! Get current time and date in calendar form |
33 | virtual RealTimeDate getRealTimeAndDate() const | 33 | virtual RealTimeDate getRealTimeAndDate() const |
34 | { | 34 | { |
35 | return os::Timer::getRealTimeAndDate(); | 35 | return os::Timer::getRealTimeAndDate(); |
36 | } | 36 | } |
37 | 37 | ||
38 | //! Returns current virtual time in milliseconds. | 38 | //! Returns current virtual time in milliseconds. |
39 | /** This value starts with 0 and can be manipulated using setTime(), stopTimer(), | 39 | /** This value starts with 0 and can be manipulated using setTime(), stopTimer(), |
40 | startTimer(), etc. This value depends on the set speed of the timer if the timer | 40 | startTimer(), etc. This value depends on the set speed of the timer if the timer |
41 | is stopped, etc. If you need the system time, use getRealTime() */ | 41 | is stopped, etc. If you need the system time, use getRealTime() */ |
42 | virtual u32 getTime() const | 42 | virtual u32 getTime() const |
43 | { | 43 | { |
44 | return os::Timer::getTime(); | 44 | return os::Timer::getTime(); |
45 | } | 45 | } |
46 | 46 | ||
47 | //! sets current virtual time | 47 | //! sets current virtual time |
48 | virtual void setTime(u32 time) | 48 | virtual void setTime(u32 time) |
49 | { | 49 | { |
50 | os::Timer::setTime(time); | 50 | os::Timer::setTime(time); |
51 | } | 51 | } |
52 | 52 | ||
53 | //! Stops the game timer. | 53 | //! Stops the game timer. |
54 | /** The timer is reference counted, which means everything which calls | 54 | /** The timer is reference counted, which means everything which calls |
55 | stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop | 55 | stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop |
56 | corretly again. */ | 56 | corretly again. */ |
57 | virtual void stop() | 57 | virtual void stop() |
58 | { | 58 | { |
59 | os::Timer::stopTimer(); | 59 | os::Timer::stopTimer(); |
60 | } | 60 | } |
61 | 61 | ||
62 | //! Starts the game timer. | 62 | //! Starts the game timer. |
63 | /** The timer is reference counted, which means everything which calls | 63 | /** The timer is reference counted, which means everything which calls |
64 | stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop | 64 | stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop |
65 | corretly again. */ | 65 | corretly again. */ |
66 | virtual void start() | 66 | virtual void start() |
67 | { | 67 | { |
68 | os::Timer::startTimer(); | 68 | os::Timer::startTimer(); |
69 | } | 69 | } |
70 | 70 | ||
71 | //! Sets the speed of the timer | 71 | //! Sets the speed of the timer |
72 | /** The speed is the factor with which the time is running faster or slower then the | 72 | /** The speed is the factor with which the time is running faster or slower then the |
73 | real system time. */ | 73 | real system time. */ |
74 | virtual void setSpeed(f32 speed = 1.0f) | 74 | virtual void setSpeed(f32 speed = 1.0f) |
75 | { | 75 | { |
76 | os::Timer::setSpeed(speed); | 76 | os::Timer::setSpeed(speed); |
77 | } | 77 | } |
78 | 78 | ||
79 | //! Returns current speed of the timer | 79 | //! Returns current speed of the timer |
80 | /** The speed is the factor with which the time is running faster or slower then the | 80 | /** The speed is the factor with which the time is running faster or slower then the |
81 | real system time. */ | 81 | real system time. */ |
82 | virtual f32 getSpeed() const | 82 | virtual f32 getSpeed() const |
83 | { | 83 | { |
84 | return os::Timer::getSpeed(); | 84 | return os::Timer::getSpeed(); |
85 | } | 85 | } |
86 | 86 | ||
87 | //! Returns if game timer is currently stopped | 87 | //! Returns if game timer is currently stopped |
88 | virtual bool isStopped() const | 88 | virtual bool isStopped() const |
89 | { | 89 | { |
90 | bool ret = os::Timer::isStopped(); | 90 | bool ret = os::Timer::isStopped(); |
91 | _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; | 91 | _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX; |
92 | return ret; | 92 | return ret; |
93 | } | 93 | } |
94 | 94 | ||
95 | //! Advances the virtual time | 95 | //! Advances the virtual time |
96 | /** Makes the virtual timer update the time value based on the real time. This is | 96 | /** Makes the virtual timer update the time value based on the real time. This is |
97 | called automaticly when calling IrrlichtDevice::run(), but you can call it manually | 97 | called automaticly when calling IrrlichtDevice::run(), but you can call it manually |
98 | if you don't use this method. */ | 98 | if you don't use this method. */ |
99 | virtual void tick() | 99 | virtual void tick() |
100 | { | 100 | { |
101 | os::Timer::tick(); | 101 | os::Timer::tick(); |
102 | } | 102 | } |
103 | }; | 103 | }; |
104 | 104 | ||
105 | } // end namespace | 105 | } // end namespace |
106 | 106 | ||
107 | #endif | 107 | #endif |
108 | 108 | ||