]>
Dogcows Code - chaz/yoink/blob - src/Moof/Core.hh
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
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.
10 **************************************************************************/
12 #ifndef _MOOF_CORE_HH_
13 #define _MOOF_CORE_HH_
17 #include <boost/shared_ptr.hpp>
19 #include <Moof/Dispatch.hh>
20 #include <Moof/Error.hh>
21 #include <Moof/Layer.hh>
28 * The core is essentially a stack of layers. While running, it updates
29 * each layer from the bottom up every timestep. It also draws each layer
30 * from the bottom up, adhering to the maximum frame-rate. Events are sent
31 * to each layer from the top down until a layer signals the event was
32 * handled. The core is also responsible for firing timers on time. The
33 * core will continue running as long as there are layers on the stack.
42 // loads settings: rngseed, timestep, framerate, showfps
47 void push(LayerP layer
); // push a layer onto the top
48 LayerP
pop(); // pop the top layer
49 LayerP
pop(Layer
* layer
); // pops a specific layer and layers above it
50 void clear(); // remove all layers (the core will stop)
52 int getSize() const; // get the size of the stack
54 // set this machine in motion
57 Dispatch::Handler
addHandler(const std::string
& event
,
58 const Dispatch::Function
& callback
);
59 Dispatch::Handler
addHandler(const std::string
& event
,
60 const Dispatch::Function
& callback
,
61 Dispatch::Handler handler
);
63 void dispatch(const std::string
& event
,
64 const Dispatch::Message
* message
= 0);
69 boost::shared_ptr
<Impl
> mImpl
;
76 * Some classes and subsystems require certain backend libraries to be
77 * initialized. This is the mechanism to accomplish that. Classes which
78 * rely on any backend libraries just need to instantiate this class as a
79 * member. Backend cleanup will occur automagically when there are no more
90 static bool isInitialized();
91 static const Error
& getError();
97 #endif // _MOOF_CORE_HH_
This page took 0.038207 seconds and 5 git commands to generate.