1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-07 12:54:00 +00:00
OpenMW/apps/openmw/engine.hpp

162 lines
4.2 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 16:59:40 +00:00
#include <openengine/bullet/physic.hpp>
2010-07-03 10:12:13 +00:00
#include <components/compiler/extensions.hpp>
#include <components/files/collections.hpp>
2010-07-04 08:43:34 +00:00
#include "mwworld/environment.hpp"
#include "mwworld/ptr.hpp"
#include <components/cfg/configurationmanager.hpp>
2010-07-04 08:43:34 +00:00
2010-07-02 15:21:27 +00:00
namespace Compiler
{
class Context;
}
namespace MWScript
{
class ScriptManager;
}
namespace MWSound
{
class SoundManager;
}
2010-07-03 13:41:20 +00:00
namespace MWWorld
{
class World;
2010-07-03 13:41:20 +00:00
}
namespace MWGui
{
class WindowManager;
}
namespace OEngine
{
namespace GUI
{
class MyGUIManager;
}
}
2010-07-03 13:41:20 +00: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 14:46:24 +00:00
bool mShowFPS;
bool mDebug;
bool mVerboseScripts;
bool mNewGame;
2010-08-18 09:16:15 +00:00
bool mUseSound;
2010-10-06 12:52:53 +00:00
bool mCompileAll;
bool mReportFocus;
float mFocusTDiff;
std::string mFocusName;
2010-07-04 08:43:34 +00:00
MWWorld::Environment mEnvironment;
MWScript::ScriptManager *mScriptManager;
2010-07-03 10:12:13 +00:00
Compiler::Extensions mExtensions;
2010-07-02 15:21:27 +00:00
Compiler::Context *mScriptContext;
OEngine::GUI::MyGUIManager *mGuiManager;
Files::Collections mFileCollections;
2011-05-05 17:56:16 +00:00
bool mFSStrict;
// not implemented
Engine (const Engine&);
Engine& operator= (const Engine&);
/// add resources directory
/// \note This function works recursively.
2010-12-30 13:50:35 +00:00
void addResourcesDirectory (const boost::filesystem::path& path);
/// Load all BSA files in data directory.
void loadBSA();
void executeLocalScripts();
void updateFocusReport (float duration);
virtual bool frameRenderingQueued (const Ogre::FrameEvent& evt);
public:
Engine(Cfg::ConfigurationManager& configurationManager);
virtual ~Engine();
2011-05-05 17:56:16 +00: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 17:56:16 +00:00
/// Set data dirs
void setDataDirs(const Files::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 14:46:24 +00:00
/// Enable fps counter
void showFPS(bool showFps);
2011-02-18 14:46:24 +00: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 09:16:15 +00:00
/// Start as a new game.
void setNewGame(bool newGame);
/// Write name of focussed object to cout
void setReportFocus (bool report);
/// Initialise and enter main loop.
void go();
/// Activate the focussed object.
void activate();
2010-10-06 12:52:53 +00:00
/// Compile all scripts (excludign dialogue scripts) at startup?
void setCompileAll (bool all);
/// Font encoding
void setEncoding(const std::string& encoding);
private:
Cfg::ConfigurationManager& mCfgMgr;
};
}
#endif /* ENGINE_H */