mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-17 01:10:10 +00:00
added new mwstate subsystem
This commit is contained in:
parent
eddd6bf48d
commit
79b7fa258b
@ -72,6 +72,10 @@ add_openmw_dir (mwmechanics
|
||||
aiescort aiactivate repair enchanting pathfinding security spellsuccess
|
||||
)
|
||||
|
||||
add_openmw_dir (mwstate
|
||||
statemanagerimp
|
||||
)
|
||||
|
||||
add_openmw_dir (mwbase
|
||||
environment world scriptmanager dialoguemanager journal soundmanager mechanicsmanager
|
||||
inputmanager windowmanager
|
||||
|
@ -7,6 +7,8 @@
|
||||
|
||||
#include <MyGUI_WidgetManager.h>
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include <components/compiler/extensions0.hpp>
|
||||
|
||||
#include <components/bsa/bsa_archive.hpp>
|
||||
@ -39,8 +41,7 @@
|
||||
|
||||
#include "mwmechanics/mechanicsmanagerimp.hpp"
|
||||
|
||||
|
||||
#include <SDL.h>
|
||||
#include "mwstate/statemanagerimp.hpp"
|
||||
|
||||
void OMW::Engine::executeLocalScripts()
|
||||
{
|
||||
@ -320,6 +321,8 @@ std::string OMW::Engine::loadSettings (Settings::Manager & settings)
|
||||
|
||||
void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||
{
|
||||
mEnvironment.setStateManager (new MWState::StateManager);
|
||||
|
||||
Nif::NIFFile::CacheLock cachelock;
|
||||
|
||||
std::string renderSystem = settings.getString("render system", "Video");
|
||||
@ -397,7 +400,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
|
||||
for (size_t i = 0; i < mContentFiles.size(); i++)
|
||||
mTranslationDataStorage.loadTranslationData(mFileCollections, mContentFiles[i]);
|
||||
|
||||
Compiler::registerExtensions (mExtensions);
|
||||
Compiler::registerExtensions (mExtensions);
|
||||
|
||||
// Create sound system
|
||||
mEnvironment.setSoundManager (new MWSound::SoundManager(mUseSound));
|
||||
|
@ -11,13 +11,15 @@
|
||||
#include "mechanicsmanager.hpp"
|
||||
#include "inputmanager.hpp"
|
||||
#include "windowmanager.hpp"
|
||||
#include "statemanager.hpp"
|
||||
|
||||
MWBase::Environment *MWBase::Environment::sThis = 0;
|
||||
bool MWBase::Environment::sExit = false;
|
||||
|
||||
MWBase::Environment::Environment()
|
||||
: mWorld (0), mSoundManager (0), mScriptManager (0), mWindowManager (0),
|
||||
mMechanicsManager (0), mDialogueManager (0), mJournal (0), mInputManager (0), mFrameDuration (0)
|
||||
mMechanicsManager (0), mDialogueManager (0), mJournal (0), mInputManager (0), mFrameDuration (0),
|
||||
mStateManager (0)
|
||||
{
|
||||
assert (!sThis);
|
||||
sThis = this;
|
||||
@ -69,6 +71,11 @@ void MWBase::Environment::setInputManager (InputManager *inputManager)
|
||||
mInputManager = inputManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setStateManager (StateManager *stateManager)
|
||||
{
|
||||
mStateManager = stateManager;
|
||||
}
|
||||
|
||||
void MWBase::Environment::setFrameDuration (float duration)
|
||||
{
|
||||
mFrameDuration = duration;
|
||||
@ -122,6 +129,12 @@ MWBase::InputManager *MWBase::Environment::getInputManager() const
|
||||
return mInputManager;
|
||||
}
|
||||
|
||||
MWBase::StateManager *MWBase::Environment::getStateManager() const
|
||||
{
|
||||
assert (mStateManager);
|
||||
return mStateManager;
|
||||
}
|
||||
|
||||
float MWBase::Environment::getFrameDuration() const
|
||||
{
|
||||
return mFrameDuration;
|
||||
@ -152,6 +165,9 @@ void MWBase::Environment::cleanup()
|
||||
|
||||
delete mInputManager;
|
||||
mInputManager = 0;
|
||||
|
||||
delete mStateManager;
|
||||
mStateManager = 0;
|
||||
}
|
||||
|
||||
const MWBase::Environment& MWBase::Environment::get()
|
||||
|
@ -11,6 +11,7 @@ namespace MWBase
|
||||
class MechanicsManager;
|
||||
class InputManager;
|
||||
class WindowManager;
|
||||
class StateManager;
|
||||
|
||||
/// \brief Central hub for mw-subsystems
|
||||
///
|
||||
@ -30,6 +31,7 @@ namespace MWBase
|
||||
DialogueManager *mDialogueManager;
|
||||
Journal *mJournal;
|
||||
InputManager *mInputManager;
|
||||
StateManager *mStateManager;
|
||||
float mFrameDuration;
|
||||
|
||||
static bool sExit;
|
||||
@ -65,6 +67,8 @@ namespace MWBase
|
||||
|
||||
void setInputManager (InputManager *inputManager);
|
||||
|
||||
void setStateManager (StateManager *stateManager);
|
||||
|
||||
void setFrameDuration (float duration);
|
||||
///< Set length of current frame in seconds.
|
||||
|
||||
@ -84,6 +88,8 @@ namespace MWBase
|
||||
|
||||
InputManager *getInputManager() const;
|
||||
|
||||
StateManager *getStateManager() const;
|
||||
|
||||
float getFrameDuration() const;
|
||||
|
||||
void cleanup();
|
||||
|
25
apps/openmw/mwbase/statemanager.hpp
Normal file
25
apps/openmw/mwbase/statemanager.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef GAME_MWSTATE_STATEMANAGER_H
|
||||
#define GAME_MWSTATE_STATEMANAGER_H
|
||||
|
||||
namespace MWBase
|
||||
{
|
||||
/// \brief Interface for game state manager (implemented in MWState)
|
||||
class StateManager
|
||||
{
|
||||
private:
|
||||
|
||||
StateManager (const StateManager&);
|
||||
///< not implemented
|
||||
|
||||
StateManager& operator= (const StateManager&);
|
||||
///< not implemented
|
||||
|
||||
public:
|
||||
|
||||
StateManager() {}
|
||||
|
||||
virtual ~StateManager() {}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
7
apps/openmw/mwstate/statemanagerimp.cpp
Normal file
7
apps/openmw/mwstate/statemanagerimp.cpp
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
#include "statemanagerimp.hpp"
|
||||
|
||||
MWState::StateManager::StateManager()
|
||||
{
|
||||
|
||||
}
|
17
apps/openmw/mwstate/statemanagerimp.hpp
Normal file
17
apps/openmw/mwstate/statemanagerimp.hpp
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef GAME_STATE_STATEMANAGER_H
|
||||
#define GAME_STATE_STATEMANAGER_H
|
||||
|
||||
#include "../mwbase/statemanager.hpp"
|
||||
|
||||
namespace MWState
|
||||
{
|
||||
class StateManager : public MWBase::StateManager
|
||||
{
|
||||
public:
|
||||
|
||||
StateManager();
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user