]> Dogcows Code - chaz/yoink/blob - src/moof/application.hh
e96198770c56b6c184d51c75fe0a829475c59938
[chaz/yoink] / src / moof / application.hh
1
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
4 *
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
7 *
8 *****************************************************************************/
9
10 #ifndef _MOOF_APPLICATION_HH_
11 #define _MOOF_APPLICATION_HH_
12
13 #include <moof/event.hh>
14 #include <moof/math.hh>
15 #include <moof/runloop.hh>
16 #include <moof/thread.hh>
17 #include <moof/timer.hh>
18
19
20 /**
21 * \file application.hh
22 * The main loop.
23 */
24
25 namespace moof {
26
27
28 // forward declarations
29 class settings;
30
31 class application : public runloop
32 {
33 public:
34
35 explicit application(settings& settings);
36 virtual ~application() {}
37
38 virtual void update(scalar t, scalar dt) = 0;
39 virtual void draw(scalar alpha) const = 0;
40 virtual void handle_event(const event& event) = 0;
41
42 private:
43
44 void dispatch_update(timer& timer, scalar t);
45 void dispatch_draw(timer& timer, scalar t);
46
47 scalar last_update_;
48 scalar last_draw_;
49 scalar accum_;
50 game_time game_time_;
51
52 timer update_timer_;
53 timer draw_timer_;
54
55 scalar timestep_;
56 scalar inverse_timestep_;
57 };
58
59
60 } // namespace moof
61
62 #endif // _MOOF_APPLICATION_HH_
63
This page took 0.034558 seconds and 4 git commands to generate.