1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Fabian 'x3n' Landau |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _UpdateListener_H__ |
---|
30 | #define _UpdateListener_H__ |
---|
31 | |
---|
32 | #include "core/CorePrereqs.h" |
---|
33 | |
---|
34 | #include "core/object/Listable.h" |
---|
35 | |
---|
36 | namespace orxonox |
---|
37 | { |
---|
38 | /** |
---|
39 | * Inherit from UpdateListener if you need to receive calls before or after the game is ticked. All classes inheriting from UpdateListener |
---|
40 | * need to be strictly independent of each other and may not rely on a specific order in which all UpdateListeners are called. |
---|
41 | * |
---|
42 | * If you do have such a dependency between two UpdateListeners, e.g. A::preUpdate() always needs to be called before B::preUpdate(), then |
---|
43 | * you need to create a third class C (which inherits from UpdateListener) with the following implementation: |
---|
44 | * void C::preUpdate() |
---|
45 | * { |
---|
46 | * A::preUpdate(); |
---|
47 | * B::preUpdate(); |
---|
48 | * } |
---|
49 | * This is the only way to ensure that A gets called before B. In this example, only C inherits from UpdateListener, while A and B do not. |
---|
50 | * Instead they receive the update from C. |
---|
51 | */ |
---|
52 | class _CoreExport UpdateListener : virtual public Listable |
---|
53 | { |
---|
54 | public: |
---|
55 | UpdateListener(); |
---|
56 | |
---|
57 | /// Gets called by Core before the framework is ticked. |
---|
58 | virtual void preUpdate(const Clock& time) = 0; |
---|
59 | /// Gets called by Core after the framework was ticked (but before graphics are drawn). |
---|
60 | virtual void postUpdate(const Clock& time) = 0; |
---|
61 | }; |
---|
62 | } |
---|
63 | |
---|
64 | #endif /* _UpdateListener_H__ */ |
---|