X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Fapplication.hh;fp=src%2Fmoof%2Fapplication.hh;h=671011f140ba8b5258cef440b7d4c47a3623146f;hp=0000000000000000000000000000000000000000;hb=d6990468d297a6cbee98e4d0d33ab37e1b2352c9;hpb=1d4aa0d34b0410c7bc60a24bad7abb55eacc850a diff --git a/src/moof/application.hh b/src/moof/application.hh new file mode 100644 index 0000000..671011f --- /dev/null +++ b/src/moof/application.hh @@ -0,0 +1,65 @@ + +/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +**] All rights reserved. +* +* vi:ts=4 sw=4 tw=75 +* +* Distributable under the terms and conditions of the 2-clause BSD license; +* see the file COPYING for a complete text of the license. +* +**************************************************************************/ + +#ifndef _MOOF_APPLICATION_HH_ +#define _MOOF_APPLICATION_HH_ + +/** + * \file application.hh + * The main loop. + */ + +#include + +#include +#include +#include +#include + + +namespace moof { + + +class settings; + +class application : public runloop +{ +public: + + application(settings& settings); + virtual ~application() {} + + virtual void update(scalar t, scalar dt) = 0; + virtual void draw(scalar alpha) const = 0; + virtual void handle_event(const event& event) = 0; + + +private: + + void dispatch_update(timer& timer, scalar t); + void dispatch_draw(timer& timer, scalar t); + + scalar next_update_; + scalar total_time_; + + timer update_timer_; + timer draw_timer_; + + + scalar timestep_; + scalar inverse_timestep_; +}; + + +} // namespace moof + +#endif // _MOOF_APPLICATION_HH_ +