]> Dogcows Code - chaz/yoink/blob - src/moof/application.hh
494e98ded4ef8910cccaa4b6115cfd2e17b701dd
[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 next_update_;
51 scalar last_update_;
52 scalar total_time_;
53 scalar accum_;
54
55 timer update_timer_;
56 timer draw_timer_;
57
58
59 scalar timestep_;
60 scalar inverse_timestep_;
61 };
62
63
64 } // namespace moof
65
66 #endif // _MOOF_APPLICATION_HH_
67
This page took 0.030421 seconds and 3 git commands to generate.