Last change
on this file since 434 was
434,
checked in by landauf, 16 years ago
|
added a config-file-parser and a makro ( SetConfigValue(variable, defaultvalue) ) to get user-modified values from the config-file (or to write the defaultvalue into it if the variable isn't yet in the file).
|
File size:
783 bytes
|
Rev | Line | |
---|
[375] | 1 | #ifndef _Tickable_H__ |
---|
| 2 | #define _Tickable_H__ |
---|
| 3 | |
---|
| 4 | #include "../core/IdentifierIncludes.h" |
---|
[434] | 5 | #include "OgreFrameListener.h" |
---|
[375] | 6 | |
---|
| 7 | namespace orxonox |
---|
| 8 | { |
---|
| 9 | class TickFrameListener; |
---|
| 10 | |
---|
| 11 | class Tickable : virtual public OrxonoxClass |
---|
| 12 | { |
---|
| 13 | public: |
---|
| 14 | virtual void tick(float dt) = 0; |
---|
| 15 | |
---|
| 16 | protected: |
---|
| 17 | Tickable() { RegisterRootObject(Tickable); } |
---|
| 18 | }; |
---|
| 19 | |
---|
| 20 | class TickFrameListener : public Ogre::FrameListener |
---|
| 21 | { |
---|
| 22 | private: |
---|
| 23 | bool frameStarted(const Ogre::FrameEvent &evt) |
---|
| 24 | { |
---|
| 25 | for (Iterator<Tickable> it = ObjectList<Tickable>::start(); it; ++it) |
---|
| 26 | it->tick(evt.timeSinceLastFrame); |
---|
| 27 | |
---|
| 28 | return FrameListener::frameStarted(evt); |
---|
| 29 | } |
---|
| 30 | }; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.