OpenMW
apps/openmw/engine.hpp
Go to the documentation of this file.
00001 #ifndef ENGINE_H
00002 #define ENGINE_H
00003 
00004 #include <OgreFrameListener.h>
00005 
00006 #include <components/compiler/extensions.hpp>
00007 #include <components/files/collections.hpp>
00008 #include <components/translation/translation.hpp>
00009 #include <components/settings/settings.hpp>
00010 
00011 #include "mwbase/environment.hpp"
00012 
00013 #include "mwworld/ptr.hpp"
00014 
00015 namespace Compiler
00016 {
00017     class Context;
00018 }
00019 
00020 namespace MWScript
00021 {
00022     class ScriptManager;
00023 }
00024 
00025 namespace MWSound
00026 {
00027     class SoundManager;
00028 }
00029 
00030 namespace MWWorld
00031 {
00032     class World;
00033 }
00034 
00035 namespace MWGui
00036 {
00037     class WindowManager;
00038 }
00039 
00040 namespace OEngine
00041 {
00042   namespace GUI
00043   {
00044     class MyGUIManager;
00045   }
00046 
00047   namespace Render
00048   {
00049     class OgreRenderer;
00050   }
00051 }
00052 
00053 namespace Files
00054 {
00055     struct ConfigurationManager;
00056 }
00057 
00058 namespace OMW
00059 {
00061     class Engine : private Ogre::FrameListener
00062     {
00063             MWBase::Environment mEnvironment;
00064             ToUTF8::FromType mEncoding;
00065             ToUTF8::Utf8Encoder* mEncoder;
00066             Files::PathContainer mDataDirs;
00067             std::vector<std::string> mArchives;
00068             boost::filesystem::path mResDir;
00069             OEngine::Render::OgreRenderer *mOgre;
00070             std::string mCellName;
00071             std::vector<std::string> mContentFiles;
00072             int mFpsLevel;
00073             bool mVerboseScripts;
00074             bool mNewGame;
00075             bool mUseSound;
00076             bool mCompileAll;
00077             std::string mFocusName;
00078             std::map<std::string,std::string> mFallbackMap;
00079             bool mScriptConsoleMode;
00080             std::string mStartupScript;
00081             int mActivationDistanceOverride;
00082             // Grab mouse?
00083             bool mGrab;
00084 
00085             Compiler::Extensions mExtensions;
00086             Compiler::Context *mScriptContext;
00087 
00088             Files::Collections mFileCollections;
00089             bool mFSStrict;
00090             Translation::Storage mTranslationDataStorage;
00091 
00092             // not implemented
00093             Engine (const Engine&);
00094             Engine& operator= (const Engine&);
00095 
00098             void addResourcesDirectory (const boost::filesystem::path& path);
00099 
00101             void addZipResource (const boost::filesystem::path& path);
00102 
00104             void loadBSA();
00105 
00106             void executeLocalScripts();
00107 
00108             virtual bool frameRenderingQueued (const Ogre::FrameEvent& evt);
00109             virtual bool frameStarted (const Ogre::FrameEvent& evt);
00110 
00112             std::string loadSettings (Settings::Manager & settings);
00113 
00115             void prepareEngine (Settings::Manager & settings);
00116 
00117         public:
00118             Engine(Files::ConfigurationManager& configurationManager);
00119             virtual ~Engine();
00120 
00125             void enableFSStrict(bool fsStrict);
00126 
00128             void setDataDirs(const Files::PathContainer& dataDirs);
00129 
00131             void addArchive(const std::string& archive);
00132 
00134             void setResourceDir(const boost::filesystem::path& parResDir);
00135 
00137             void setCell(const std::string& cellName);
00138 
00143             void addContentFile(const std::string& file);
00144 
00146             void showFPS(int level);
00147 
00149             void setScriptsVerbosity(bool scriptsVerbosity);
00150 
00152             void setSoundUsage(bool soundUsage);
00153 
00155             void setNewGame(bool newGame);
00156 
00157             void setGrabMouse(bool grab) { mGrab = grab; }
00158 
00160             void go();
00161 
00163             void activate();
00164 
00166             void screenshot();
00167 
00169             void setCompileAll (bool all);
00170 
00172             void setEncoding(const ToUTF8::FromType& encoding);
00173 
00174             void setFallbackValues(std::map<std::string,std::string> map);
00175 
00177             void setScriptConsoleMode (bool enabled);
00178 
00180             void setStartupScript (const std::string& path);
00181 
00183             void setActivationDistanceOverride (int distance);
00184 
00185         private:
00186             Files::ConfigurationManager& mCfgMgr;
00187     };
00188 }
00189 
00190 #endif /* ENGINE_H */