+++ /dev/null
-
-/*] 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_CORE_HH_
-#define _MOOF_CORE_HH_
-
-#include <string>
-
-#include <boost/shared_ptr.hpp>
-
-#include <Moof/Dispatch.hh>
-#include <Moof/Error.hh>
-#include <Moof/Layer.hh>
-
-
-namespace Mf {
-
-
-/**
- * The core is essentially a stack of layers. While running, it updates
- * each layer from the bottom up every timestep. It also draws each layer
- * from the bottom up, adhering to the maximum frame-rate. Events are sent
- * to each layer from the top down until a layer signals the event was
- * handled. The core is also responsible for firing timers on time. The
- * core will continue running as long as there are layers on the stack.
- */
-
-class Core
-{
-public:
-
- Core();
-
- // loads settings: rngseed, timestep, framerate, showfps
- void init();
-
- int getFps() const;
-
- void push(LayerP layer); // push a layer onto the top
- LayerP pop(); // pop the top layer
- LayerP pop(Layer* layer); // pops a specific layer and layers above it
- void clear(); // remove all layers (the core will stop)
-
- int getSize() const; // get the size of the stack
-
- // set this machine in motion
- void run();
-
- Dispatch::Handler addHandler(const std::string& event,
- const Dispatch::Function& callback);
- Dispatch::Handler addHandler(const std::string& event,
- const Dispatch::Function& callback,
- Dispatch::Handler handler);
-
- void dispatch(const std::string& event,
- const Dispatch::Message* message = 0);
-
-private:
-
- class Impl;
- boost::shared_ptr<Impl> mImpl;
-};
-
-extern Core core;
-
-
-/*
- * Some classes and subsystems require certain backend libraries to be
- * initialized. This is the mechanism to accomplish that. Classes which
- * rely on any backend libraries just need to instantiate this class as a
- * member. Backend cleanup will occur automagically when there are no more
- * instances.
- */
-
-class Backend
-{
-public:
-
- Backend();
- ~Backend();
-
- static bool isInitialized();
- static const Error& getError();
-};
-
-
-} // namespace Mf
-
-#endif // _MOOF_CORE_HH_
-