Last change
on this file since 384 was
384,
checked in by landauf, 17 years ago
|
copied changed files from objecthierarchy-branch
|
File size:
770 bytes
|
Line | |
---|
1 | #ifndef _Tickable_H__ |
---|
2 | #define _Tickable_H__ |
---|
3 | |
---|
4 | #include "../core/IdentifierIncludes.h" |
---|
5 | #include "Ogre.h" |
---|
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.