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