1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00
OpenMW/apps/openmw/engine.hpp

167 lines
4.3 KiB
C++
Raw Normal View History

#ifndef ENGINE_H
#define ENGINE_H
#include <string>
#include <boost/filesystem.hpp>
#include <OgreFrameListener.h>
#include <openengine/ogre/renderer.hpp>
2011-02-19 17:59:40 +01:00
#include <openengine/bullet/physic.hpp>
2010-07-03 12:12:13 +02:00
#include <components/compiler/extensions.hpp>
#include <components/files/collections.hpp>
2010-07-04 10:43:34 +02:00
#include "mwworld/environment.hpp"
#include "mwworld/ptr.hpp"
2010-11-08 18:01:33 -05:00
#include <boost/timer.hpp>
#include <components/cfg/configurationmanager.hpp>
2010-07-04 10:43:34 +02:00
2010-07-02 17:21:27 +02:00
namespace Compiler
{
class Context;
}
namespace MWScript
{
class ScriptManager;
}
namespace MWSound
{
class SoundManager;
}
2010-07-03 15:41:20 +02:00
namespace MWWorld
{
class World;
2010-07-03 15:41:20 +02:00
}
namespace MWGui
{
class WindowManager;
}
namespace OEngine
{
namespace GUI
{
class MyGUIManager;
}
}
2010-07-03 15:41:20 +02:00
namespace OMW
{
/// \brief Main engine class, that brings together all the components of OpenMW
class Engine : private Ogre::FrameListener
{
std::string mEncoding;
boost::filesystem::path mDataDir;
boost::filesystem::path mResDir;
OEngine::Render::OgreRenderer mOgre;
OEngine::Physic::PhysicEngine* mPhysicEngine;
std::string mCellName;
std::string mMaster;
2011-02-18 17:46:24 +03:00
bool mShowFPS;
bool mDebug;
bool mVerboseScripts;
bool mNewGame;
2010-08-18 11:16:15 +02:00
bool mUseSound;
2010-10-06 14:52:53 +02:00
bool mCompileAll;
2010-12-30 14:50:35 +01:00
int total;
2010-07-04 10:43:34 +02:00
MWWorld::Environment mEnvironment;
MWScript::ScriptManager *mScriptManager;
2010-07-03 12:12:13 +02:00
Compiler::Extensions mExtensions;
2010-07-02 17:21:27 +02:00
Compiler::Context *mScriptContext;
OEngine::GUI::MyGUIManager *mGuiManager;
2011-01-05 22:18:21 +01:00
ESM::Region test;
boost::timer timer;
int focusFrameCounter;
static const int focusUpdateFrame = 10;
MWWorld::Ptr mIgnoreLocalPtr;
Files::Collections mFileCollections;
2011-05-05 19:56:16 +02:00
bool mFSStrict;
// not implemented
Engine (const Engine&);
Engine& operator= (const Engine&);
/// add resources directory
/// \note This function works recursively.
2010-12-30 14:50:35 +01:00
void addResourcesDirectory (const boost::filesystem::path& path);
/// Load all BSA files in data directory.
void loadBSA();
void executeLocalScripts();
virtual bool frameRenderingQueued (const Ogre::FrameEvent& evt);
/// Process pending commands
public:
Engine(Cfg::ConfigurationManager& configurationManager);
virtual ~Engine();
2011-05-05 19:56:16 +02:00
/// Enable strict filesystem mode (do not fold case)
///
/// \attention The strict mode must be specified before any path-related settings
/// are given to the engine.
void enableFSStrict(bool fsStrict);
2011-05-05 19:56:16 +02:00
/// Set data dirs
void setDataDirs(const Files::Collections::PathContainer& dataDirs);
/// Set resource dir
void setResourceDir(const boost::filesystem::path& parResDir);
/// Set start cell name (only interiors for now)
void setCell(const std::string& cellName);
/// Set master file (esm)
/// - If the given name does not have an extension, ".esm" is added automatically
/// - Currently OpenMW only supports one master at the same time.
void addMaster(const std::string& master);
2011-02-18 17:46:24 +03:00
/// Enable fps counter
void showFPS(bool showFps);
2011-02-18 17:46:24 +03:00
/// Enable debug mode:
/// - non-exclusive input
void setDebugMode(bool debugMode);
/// Enable or disable verbose script output
void setScriptsVerbosity(bool scriptsVerbosity);
/// Disable or enable all sounds
void setSoundUsage(bool soundUsage);
2010-08-18 11:16:15 +02:00
/// Start as a new game.
void setNewGame(bool newGame);
/// Initialise and enter main loop.
void go();
/// Activate the focussed object.
void activate();
2010-10-06 14:52:53 +02:00
/// Compile all scripts (excludign dialogue scripts) at startup?
void setCompileAll (bool all);
/// Font encoding
void setEncoding(const std::string& encoding);
private:
std::string getOgreFilesDir(const std::string& ogreFile);
Cfg::ConfigurationManager& mCfgMgr;
};
}
#endif /* ENGINE_H */