OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
engine.hpp
Go to the documentation of this file.
1 #ifndef ENGINE_H
2 #define ENGINE_H
3 
8 
9 #include <osgViewer/Viewer>
10 
11 
12 #include "mwbase/environment.hpp"
13 
14 #include "mwworld/ptr.hpp"
15 
16 namespace Resource
17 {
18  class ResourceSystem;
19 }
20 
21 namespace VFS
22 {
23  class Manager;
24 }
25 
26 namespace Compiler
27 {
28  class Context;
29 }
30 
31 namespace MWScript
32 {
33  class ScriptManager;
34 }
35 
36 namespace MWSound
37 {
38  class SoundManager;
39 }
40 
41 namespace MWWorld
42 {
43  class World;
44 }
45 
46 namespace MWGui
47 {
48  class WindowManager;
49 }
50 
51 namespace Files
52 {
53  struct ConfigurationManager;
54 }
55 
56 namespace osgViewer
57 {
58  class ScreenCaptureHandler;
59 }
60 
61 struct SDL_Window;
62 
63 namespace OMW
64 {
66  class Engine
67  {
68  SDL_Window* mWindow;
69  std::auto_ptr<VFS::Manager> mVFS;
70  std::auto_ptr<Resource::ResourceSystem> mResourceSystem;
75  std::vector<std::string> mArchives;
76  boost::filesystem::path mResDir;
77  osg::ref_ptr<osgViewer::Viewer> mViewer;
78  osg::ref_ptr<osgViewer::ScreenCaptureHandler> mScreenCaptureHandler;
79  std::string mCellName;
80  std::vector<std::string> mContentFiles;
82  bool mSkipMenu;
83  bool mUseSound;
87  std::string mFocusName;
88  std::map<std::string,std::string> mFallbackMap;
90  std::string mStartupScript;
92  std::string mSaveGameFile;
93  // Grab mouse?
94  bool mGrab;
95 
97 
100 
102  bool mFSStrict;
104  std::vector<std::string> mScriptBlacklist;
106  bool mNewGame;
107 
108  osg::Timer_t mStartTick;
109 
110  // not implemented
111  Engine (const Engine&);
112  Engine& operator= (const Engine&);
113 
114  void executeLocalScripts();
115 
116  void frame (float dt);
117 
119  std::string loadSettings (Settings::Manager & settings);
120 
122  void prepareEngine (Settings::Manager & settings);
123 
124  void createWindow(Settings::Manager& settings);
125  void setWindowIcon();
126 
127  public:
128  Engine(Files::ConfigurationManager& configurationManager);
129  virtual ~Engine();
130 
135  void enableFSStrict(bool fsStrict);
136 
138  void setDataDirs(const Files::PathContainer& dataDirs);
139 
141  void addArchive(const std::string& archive);
142 
144  void setResourceDir(const boost::filesystem::path& parResDir);
145 
147  void setCell(const std::string& cellName);
148 
153  void addContentFile(const std::string& file);
154 
156  void setScriptsVerbosity(bool scriptsVerbosity);
157 
159  void setSoundUsage(bool soundUsage);
160 
165  void setSkipMenu (bool skipMenu, bool newGame);
166 
167  void setGrabMouse(bool grab) { mGrab = grab; }
168 
170  void go();
171 
173  void setCompileAll (bool all);
174 
176  void setCompileAllDialogue (bool all);
177 
179  void setEncoding(const ToUTF8::FromType& encoding);
180 
181  void setFallbackValues(std::map<std::string,std::string> map);
182 
184  void setScriptConsoleMode (bool enabled);
185 
187  void setStartupScript (const std::string& path);
188 
191 
192  void setWarningsMode (int mode);
193 
194  void setScriptBlacklist (const std::vector<std::string>& list);
195 
196  void setScriptBlacklistUse (bool use);
197 
198  void enableFontExport(bool exportFonts);
199 
201  void setSaveGameFile(const std::string& savegame);
202 
203  private:
205  };
206 }
207 
208 #endif /* ENGINE_H */
osg::ref_ptr< osgViewer::Viewer > mViewer
Definition: engine.hpp:77
void executeLocalScripts()
Definition: engine.cpp:67
Main engine class, that brings together all the components of OpenMW.
Definition: engine.hpp:66
Engine & operator=(const Engine &)
MWBase::Environment mEnvironment
Definition: engine.hpp:71
void setFallbackValues(std::map< std::string, std::string > map)
Definition: engine.cpp:738
void addArchive(const std::string &archive)
Add BSA archive.
Definition: engine.cpp:261
std::map< std::string, std::string > mFallbackMap
Definition: engine.hpp:88
bool mScriptConsoleMode
Definition: engine.hpp:89
Files::Collections mFileCollections
Definition: engine.hpp:101
void setScriptBlacklist(const std::vector< std::string > &list)
Definition: engine.cpp:763
ToUTF8::Utf8Encoder * mEncoder
Definition: engine.hpp:73
int mWarningsMode
Definition: engine.hpp:86
void setCell(const std::string &cellName)
Set start cell name (only interiors for now)
Definition: engine.cpp:273
std::auto_ptr< VFS::Manager > mVFS
Definition: engine.hpp:69
Central hub for mw-subsystems.
Definition: environment.hpp:22
bool mFSStrict
Definition: engine.hpp:102
void setSaveGameFile(const std::string &savegame)
Set the save game file to load after initialising the engine.
Definition: engine.cpp:778
int list(Bsa::BSAFile &bsa, Arguments &info)
Definition: bsatool.cpp:183
bool mNewGame
Definition: engine.hpp:106
Definition: context.hpp:10
Definition: configurationmanager.hpp:20
void setDataDirs(const Files::PathContainer &dataDirs)
Set data dirs.
Definition: engine.cpp:254
Definition: translation.hpp:9
bool mUseSound
Definition: engine.hpp:83
std::string loadSettings(Settings::Manager &settings)
Load settings from various files, returns the path to the user settings file.
Definition: engine.cpp:294
virtual ~Engine()
Definition: engine.cpp:227
int mActivationDistanceOverride
Definition: engine.hpp:91
osg::Timer_t mStartTick
Definition: engine.hpp:108
Compiler::Extensions mExtensions
Definition: engine.hpp:98
bool mExportFonts
Definition: engine.hpp:96
bool mVerboseScripts
Definition: engine.hpp:81
Compiler::Context * mScriptContext
Definition: engine.hpp:99
bool mGrab
Definition: engine.hpp:94
void setWindowIcon()
Definition: engine.cpp:409
void frame(float dt)
Definition: engine.cpp:81
void setSkipMenu(bool skipMenu, bool newGame)
Definition: engine.cpp:288
std::vector< std::string > mScriptBlacklist
Definition: engine.hpp:104
void setResourceDir(const boost::filesystem::path &parResDir)
Set resource dir.
Definition: engine.cpp:266
Collection of compiler extensions.
Definition: extensions.hpp:39
osg::ref_ptr< osgViewer::ScreenCaptureHandler > mScreenCaptureHandler
Definition: engine.hpp:78
std::string mStartupScript
Definition: engine.hpp:90
void addContentFile(const std::string &file)
addContentFile - Adds content file (ie. esm/esp, or omwgame/omwaddon) to the content files container...
Definition: engine.cpp:278
bool mCompileAllDialogue
Definition: engine.hpp:85
void setSoundUsage(bool soundUsage)
Disable or enable all sounds.
Definition: engine.cpp:728
FromType
Definition: to_utf8.hpp:11
std::string mCellName
Definition: engine.hpp:79
void setStartupScript(const std::string &path)
Set path for a script that is run on startup in the console.
Definition: engine.cpp:748
std::string mFocusName
Definition: engine.hpp:87
float distance(const ESM::Pathgrid::Point &point, float x, float y, float z)
Definition: pathfinding.cpp:69
Files::PathContainer mDataDirs
Definition: engine.hpp:74
Engine(const Engine &)
void setScriptConsoleMode(bool enabled)
Enable console-only script functionality.
Definition: engine.cpp:743
void setScriptBlacklistUse(bool use)
Definition: engine.cpp:768
void setCompileAll(bool all)
Compile all scripts (excludign dialogue scripts) at startup?
Definition: engine.cpp:718
void setWarningsMode(int mode)
Definition: engine.cpp:758
void createWindow(Settings::Manager &settings)
Definition: engine.cpp:316
std::vector< std::string > mContentFiles
Definition: engine.hpp:80
boost::filesystem::path mResDir
Definition: engine.hpp:76
std::vector< std::string > mArchives
Definition: engine.hpp:75
SDL_Window * mWindow
Definition: engine.hpp:68
Settings management (can change during runtime)
Definition: settings.hpp:17
void enableFontExport(bool exportFonts)
Definition: engine.cpp:773
void setScriptsVerbosity(bool scriptsVerbosity)
Enable or disable verbose script output.
Definition: engine.cpp:283
Translation::Storage mTranslationDataStorage
Definition: engine.hpp:103
void setGrabMouse(bool grab)
Definition: engine.hpp:167
ToUTF8::FromType mEncoding
Definition: engine.hpp:72
bool mSkipMenu
Definition: engine.hpp:82
bool mCompileAll
Definition: engine.hpp:84
std::string mSaveGameFile
Definition: engine.hpp:92
Definition: collections.hpp:10
void enableFSStrict(bool fsStrict)
Definition: engine.cpp:247
bool mScriptBlacklistUse
Definition: engine.hpp:105
std::auto_ptr< Resource::ResourceSystem > mResourceSystem
Definition: engine.hpp:70
Definition: to_utf8.hpp:25
std::vector< boost::filesystem::path > PathContainer
Definition: gamesettings.hpp:14
Files::ConfigurationManager & mCfgMgr
Definition: engine.hpp:204
void prepareEngine(Settings::Manager &settings)
Prepare engine for game play.
Definition: engine.cpp:434
void setActivationDistanceOverride(int distance)
Override the game setting specified activation distance.
Definition: engine.cpp:753
Definition: windowmanagerimp.hpp:116
void setEncoding(const ToUTF8::FromType &encoding)
Font encoding.
Definition: engine.cpp:733
void setCompileAllDialogue(bool all)
Compile all dialogue scripts at startup?
Definition: engine.cpp:723
void go()
Initialise and enter main loop.
Definition: engine.cpp:612