]> Dogcows Code - chaz/yoink/blob - src/moof/application.hh
5c808670bde984ce524873d45b8e6d7fe0ddeece
[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 /**
14 * \file application.hh
15 * The main loop.
16 */
17
18 #include <boost/noncopyable.hpp>
19
20 #include <moof/event.hh>
21 #include <moof/math.hh>
22 #include <moof/runloop.hh>
23 #include <moof/timer.hh>
24
25
26 namespace moof {
27
28
29 // forward declarations
30 class settings;
31
32 class application : public runloop
33 {
34 public:
35
36 explicit application(settings& settings);
37 virtual ~application() {}
38
39 virtual void update(scalar t, scalar dt) = 0;
40 virtual void draw(scalar alpha) const = 0;
41 virtual void handle_event(const event& event) = 0;
42
43 private:
44
45 void dispatch_update(timer& timer, scalar t);
46 void dispatch_draw(timer& timer, scalar t);
47
48 scalar last_update_;
49 scalar last_draw_;
50 scalar accum_;
51 game_time game_time_;
52
53 timer update_timer_;
54 timer draw_timer_;
55
56 scalar timestep_;
57 scalar inverse_timestep_;
58 };
59
60
61 } // namespace moof
62
63 #endif // _MOOF_APPLICATION_HH_
64
This page took 0.034905 seconds and 3 git commands to generate.