1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-04 21:40:03 +00:00
OpenMW/apps/openmw/mwbase/environment.hpp

126 lines
3.5 KiB
C++
Raw Normal View History

2015-01-31 23:27:34 +01:00
#ifndef GAME_BASE_ENVIRONMENT_H
#define GAME_BASE_ENVIRONMENT_H
2022-01-29 23:21:39 +02:00
#include <memory>
namespace osg
{
class Stats;
}
2020-12-29 21:45:59 +01:00
namespace Resource
{
class ResourceSystem;
}
namespace MWBase
{
class World;
class ScriptManager;
class DialogueManager;
class Journal;
class SoundManager;
class MechanicsManager;
class InputManager;
class WindowManager;
2013-11-16 10:31:46 +01:00
class StateManager;
2020-12-18 23:21:10 +01:00
class LuaManager;
/// \brief Central hub for mw-subsystems
///
/// This class allows each mw-subsystem to access any others subsystem's top-level manager class.
///
class Environment
{
static Environment *sThis;
2022-01-29 23:21:39 +02:00
std::unique_ptr<World> mWorld;
std::unique_ptr<SoundManager> mSoundManager;
std::unique_ptr<ScriptManager> mScriptManager;
std::unique_ptr<WindowManager> mWindowManager;
std::unique_ptr<MechanicsManager> mMechanicsManager;
std::unique_ptr<DialogueManager> mDialogueManager;
std::unique_ptr<Journal> mJournal;
std::unique_ptr<InputManager> mInputManager;
std::unique_ptr<StateManager> mStateManager;
std::unique_ptr<LuaManager> mLuaManager;
Resource::ResourceSystem* mResourceSystem{};
float mFrameDuration{};
float mFrameRateLimit{};
Environment (const Environment&);
///< not implemented
Environment& operator= (const Environment&);
///< not implemented
public:
Environment();
~Environment();
2022-01-29 23:21:39 +02:00
void setWorld (std::unique_ptr<World>&& world);
2022-01-29 23:21:39 +02:00
void setSoundManager (std::unique_ptr<SoundManager>&& soundManager);
2022-01-29 23:21:39 +02:00
void setScriptManager (std::unique_ptr<ScriptManager>&& scriptManager);
2022-01-29 23:21:39 +02:00
void setWindowManager (std::unique_ptr<WindowManager>&& windowManager);
2022-01-29 23:21:39 +02:00
void setMechanicsManager (std::unique_ptr<MechanicsManager>&& mechanicsManager);
2022-01-29 23:21:39 +02:00
void setDialogueManager (std::unique_ptr<DialogueManager>&& dialogueManager);
2022-01-29 23:21:39 +02:00
void setJournal (std::unique_ptr<Journal>&& journal);
2022-01-29 23:21:39 +02:00
void setInputManager (std::unique_ptr<InputManager>&& inputManager);
2022-01-29 23:21:39 +02:00
void setStateManager (std::unique_ptr<StateManager>&& stateManager);
2013-11-16 10:31:46 +01:00
2022-01-29 23:21:39 +02:00
void setLuaManager (std::unique_ptr<LuaManager>&& luaManager);
2020-12-18 23:21:10 +01:00
2020-12-29 21:45:59 +01:00
void setResourceSystem (Resource::ResourceSystem *resourceSystem);
void setFrameDuration (float duration);
///< Set length of current frame in seconds.
void setFrameRateLimit(float frameRateLimit);
float getFrameRateLimit() const;
World *getWorld() const;
SoundManager *getSoundManager() const;
ScriptManager *getScriptManager() const;
WindowManager *getWindowManager() const;
MechanicsManager *getMechanicsManager() const;
DialogueManager *getDialogueManager() const;
Journal *getJournal() const;
InputManager *getInputManager() const;
2013-11-16 10:31:46 +01:00
StateManager *getStateManager() const;
2020-12-18 23:21:10 +01:00
LuaManager *getLuaManager() const;
2020-12-29 21:45:59 +01:00
Resource::ResourceSystem *getResourceSystem() const;
float getFrameDuration() const;
void cleanup();
///< Delete all mw*-subsystems.
static const Environment& get();
///< Return instance of this class.
void reportStats(unsigned int frameNumber, osg::Stats& stats) const;
};
}
#endif