1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-05 15:55:45 +00:00
OpenMW/apps/openmw/engine.hpp

204 lines
5.6 KiB
C++
Raw Normal View History

#ifndef ENGINE_H
#define ENGINE_H
#include <OgreFrameListener.h>
2010-07-03 10:12:13 +00:00
#include <components/compiler/extensions.hpp>
#include <components/files/collections.hpp>
#include <components/translation/translation.hpp>
#include <components/settings/settings.hpp>
#include <components/nifcache/nifcache.hpp>
#include "mwbase/environment.hpp"
#include "mwworld/ptr.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;
}
2011-10-09 11:12:44 +00:00
namespace Render
{
class OgreRenderer;
}
}
namespace Files
{
struct ConfigurationManager;
}
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
{
MWBase::Environment mEnvironment;
2012-12-23 19:23:24 +00:00
ToUTF8::FromType mEncoding;
ToUTF8::Utf8Encoder* mEncoder;
Files::PathContainer mDataDirs;
std::vector<std::string> mArchives;
boost::filesystem::path mResDir;
OEngine::Render::OgreRenderer *mOgre;
std::string mCellName;
std::vector<std::string> mContentFiles;
int mFpsLevel;
bool mVerboseScripts;
2013-11-16 10:33:20 +00:00
bool mSkipMenu;
2010-08-18 09:16:15 +00:00
bool mUseSound;
2010-10-06 12:52:53 +00:00
bool mCompileAll;
2014-02-02 13:09:59 +00:00
int mWarningsMode;
std::string mFocusName;
std::map<std::string,std::string> mFallbackMap;
bool mScriptConsoleMode;
2012-07-30 10:37:46 +00:00
std::string mStartupScript;
int mActivationDistanceOverride;
// Grab mouse?
bool mGrab;
2014-08-11 18:37:29 +00:00
bool mExportFonts;
2010-07-03 10:12:13 +00:00
Compiler::Extensions mExtensions;
2010-07-02 15:21:27 +00:00
Compiler::Context *mScriptContext;
2012-03-05 15:56:14 +00:00
Files::Collections mFileCollections;
2011-05-05 17:56:16 +00:00
bool mFSStrict;
Translation::Storage mTranslationDataStorage;
2014-07-21 07:34:10 +00:00
std::vector<std::string> mScriptBlacklist;
bool mScriptBlacklistUse;
Nif::Cache mNifCache;
// not implemented
Engine (const Engine&);
Engine& operator= (const Engine&);
/// add resources directory
/// \note This function works recursively.
void addResourcesDirectory (const boost::filesystem::path& path);
2012-05-09 00:16:10 +00:00
/// add a .zip resource
void addZipResource (const boost::filesystem::path& path);
void executeLocalScripts();
virtual bool frameRenderingQueued (const Ogre::FrameEvent& evt);
virtual bool frameStarted (const Ogre::FrameEvent& evt);
/// Load settings from various files, returns the path to the user settings file
std::string loadSettings (Settings::Manager & settings);
/// Prepare engine for game play
void prepareEngine (Settings::Manager & settings);
public:
Engine(Files::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);
/// Add BSA archive
void addArchive(const std::string& archive);
/// Set resource dir
void setResourceDir(const boost::filesystem::path& parResDir);
/// Set start cell name (only interiors for now)
void setCell(const std::string& cellName);
/**
* @brief addContentFile - Adds content file (ie. esm/esp, or omwgame/omwaddon) to the content files container.
* @param file - filename (extension is required)
*/
void addContentFile(const std::string& file);
2011-02-18 14:46:24 +00:00
/// Enable fps counter
void showFPS(int level);
2011-02-18 14:46:24 +00:00
/// 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
2013-11-16 10:33:20 +00:00
void setSkipMenu (bool skipMenu);
void setGrabMouse(bool grab) { mGrab = grab; }
/// Initialise and enter main loop.
void go();
/// Activate the focussed object.
void activate();
2010-10-06 12:52:53 +00:00
/// Write screenshot to file.
void screenshot();
2010-10-06 12:52:53 +00:00
/// Compile all scripts (excludign dialogue scripts) at startup?
void setCompileAll (bool all);
/// Font encoding
2012-12-23 19:23:24 +00:00
void setEncoding(const ToUTF8::FromType& encoding);
void setFallbackValues(std::map<std::string,std::string> map);
/// Enable console-only script functionality
void setScriptConsoleMode (bool enabled);
2012-07-30 10:37:46 +00:00
/// Set path for a script that is run on startup in the console.
void setStartupScript (const std::string& path);
/// Override the game setting specified activation distance.
void setActivationDistanceOverride (int distance);
2014-02-02 13:09:59 +00:00
void setWarningsMode (int mode);
2014-07-21 07:34:10 +00:00
void setScriptBlacklist (const std::vector<std::string>& list);
void setScriptBlacklistUse (bool use);
2014-08-11 18:37:29 +00:00
void enableFontExport(bool exportFonts);
private:
Files::ConfigurationManager& mCfgMgr;
};
}
#endif /* ENGINE_H */