Issue #107: InputManager is accessed only through the interface class from now on

actorid
Marc Zinnschlag 13 years ago
parent b68f9d6a28
commit 0231533d05

@ -20,7 +20,7 @@ add_openmw_dir (mwrender
)
add_openmw_dir (mwinput
inputmanager
inputmanagerimp
mouselookevent
)
@ -66,6 +66,7 @@ add_openmw_dir (mwmechanics
add_openmw_dir (mwbase
environment world scriptmanager dialoguemanager journal soundmanager mechanicsmanager
inputmanager
)
# Main executable

@ -13,7 +13,7 @@
#include <components/nifbullet/bullet_nif_loader.hpp>
#include <components/nifogre/ogre_nif_loader.hpp>
#include "mwinput/inputmanager.hpp"
#include "mwinput/inputmanagerimp.hpp"
#include "mwgui/window_manager.hpp"
#include "mwgui/cursorreplace.hpp"

@ -3,14 +3,13 @@
#include <cassert>
#include "../mwinput/inputmanager.hpp"
#include "world.hpp"
#include "scriptmanager.hpp"
#include "dialoguemanager.hpp"
#include "journal.hpp"
#include "soundmanager.hpp"
#include "mechanicsmanager.hpp"
#include "inputmanager.hpp"
MWBase::Environment *MWBase::Environment::sThis = 0;
@ -63,7 +62,7 @@ void MWBase::Environment::setJournal (Journal *journal)
mJournal = journal;
}
void MWBase::Environment::setInputManager (MWInput::MWInputManager *inputManager)
void MWBase::Environment::setInputManager (InputManager *inputManager)
{
mInputManager = inputManager;
}
@ -115,7 +114,7 @@ MWBase::Journal *MWBase::Environment::getJournal() const
return mJournal;
}
MWInput::MWInputManager *MWBase::Environment::getInputManager() const
MWBase::InputManager *MWBase::Environment::getInputManager() const
{
assert (mInputManager);
return mInputManager;

@ -6,11 +6,6 @@ namespace MWGui
class WindowManager;
}
namespace MWInput
{
struct MWInputManager;
}
namespace MWBase
{
class World;
@ -19,6 +14,7 @@ namespace MWBase
class Journal;
class SoundManager;
class MechanicsManager;
class InputManager;
/// \brief Central hub for mw-subsystems
///
@ -37,7 +33,7 @@ namespace MWBase
MechanicsManager *mMechanicsManager;
DialogueManager *mDialogueManager;
Journal *mJournal;
MWInput::MWInputManager *mInputManager;
InputManager *mInputManager;
float mFrameDuration;
Environment (const Environment&);
@ -66,7 +62,7 @@ namespace MWBase
void setJournal (Journal *journal);
void setInputManager (MWInput::MWInputManager *inputManager);
void setInputManager (InputManager *inputManager);
void setFrameDuration (float duration);
///< Set length of current frame in seconds.
@ -85,7 +81,7 @@ namespace MWBase
Journal *getJournal() const;
MWInput::MWInputManager *getInputManager() const;
InputManager *getInputManager() const;
float getFrameDuration() const;

@ -0,0 +1,37 @@
#ifndef GAME_MWBASE_INPUTMANAGER_H
#define GAME_MWBASE_INPUTMANAGER_H
#include <string>
#include <components/settings/settings.hpp>
namespace MWBase
{
/// \brief Interface for input manager (implemented in MWInput)
class InputManager
{
InputManager (const InputManager&);
///< not implemented
InputManager& operator= (const InputManager&);
///< not implemented
public:
InputManager() {}
virtual ~InputManager() {}
virtual void update() = 0;
virtual void changeInputMode(bool guiMode) = 0;
virtual void processChangedSettings(const Settings::CategorySettingVector& changed) = 0;
virtual void setDragDrop(bool dragDrop) = 0;
virtual void toggleControlSwitch (const std::string& sw, bool value) = 0;
};
}
#endif

@ -19,7 +19,6 @@
#include "../mwworld/player.hpp"
#include "../mwworld/containerstore.hpp"
#include "../mwinput/inputmanager.hpp"
#include "../mwgui/dialogue.hpp"
#include "../mwgui/window_manager.hpp"

@ -6,8 +6,6 @@
#include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwinput/inputmanager.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/player.hpp"

@ -19,8 +19,6 @@
#include "../mwclass/container.hpp"
#include "../mwinput/inputmanager.hpp"
#include "window_manager.hpp"
#include "widgets.hpp"
#include "countdialog.hpp"

@ -4,8 +4,6 @@
#include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwinput/inputmanager.hpp"
#include "../mwworld/actiontake.hpp"
#include "../mwworld/player.hpp"

@ -13,11 +13,10 @@
#include "../mwbase/environment.hpp"
#include "../mwbase/world.hpp"
#include "../mwbase/soundmanager.hpp"
#include "../mwbase/inputmanager.hpp"
#include "../mwrender/renderingmanager.hpp"
#include "../mwinput/inputmanager.hpp"
#include "window_manager.hpp"
#include "confirmationdialog.hpp"

@ -21,10 +21,9 @@
#include "alchemywindow.hpp"
#include "spellwindow.hpp"
#include "../mwinput/inputmanager.hpp"
#include "../mwbase/environment.hpp"
#include "../mwbase/mechanicsmanager.hpp"
#include "../mwbase/inputmanager.hpp"
#include "../mwworld/ptr.hpp"
#include "../mwworld/cellstore.hpp"

@ -1,4 +1,4 @@
#include "inputmanager.hpp"
#include "inputmanagerimp.hpp"
#include <OgreRoot.h>
@ -501,8 +501,8 @@ private:
impl->adjustMouseRegion(Settings::Manager::getInt("resolution x", "Video"), Settings::Manager::getInt("resolution y", "Video"));
}
void MWInputManager::toggleControlSwitch(std::string sw, bool value)
void MWInputManager::toggleControlSwitch (const std::string& sw, bool value)
{
impl->toggleControlSwitch(sw, value);
impl->toggleControlSwitch(sw, value);
}
}

@ -1,10 +1,12 @@
#ifndef _MWINPUT_MWINPUTMANAGER_H
#define _MWINPUT_MWINPUTMANAGER_H
#ifndef _MWINPUT_MWINPUTMANAGERIMP_H
#define _MWINPUT_MWINPUTMANAGERIMP_H
#include "../mwgui/mode.hpp"
#include <components/settings/settings.hpp>
#include "../mwbase/inputmanager.hpp"
namespace OEngine
{
namespace Render
@ -38,7 +40,7 @@ namespace MWInput
This class is just an interface. All the messy details are in
inputmanager.cpp.
*/
struct MWInputManager
struct MWInputManager : public MWBase::InputManager
{
InputImpl *impl;
@ -48,17 +50,17 @@ namespace MWInput
MWGui::WindowManager &_windows,
bool debug,
OMW::Engine& engine);
~MWInputManager();
virtual ~MWInputManager();
void update();
virtual void update();
void changeInputMode(bool guiMode);
virtual void changeInputMode(bool guiMode);
void processChangedSettings(const Settings::CategorySettingVector& changed);
virtual void processChangedSettings(const Settings::CategorySettingVector& changed);
void setDragDrop(bool dragDrop);
virtual void setDragDrop(bool dragDrop);
void toggleControlSwitch(std::string sw, bool value);
virtual void toggleControlSwitch (const std::string& sw, bool value);
};
}
#endif

@ -22,12 +22,12 @@
#include "../mwbase/world.hpp" // these includes can be removed once the static-hack is gone
#include "../mwbase/environment.hpp"
#include "../mwbase/inputmanager.hpp" // FIXME
#include "../mwworld/ptr.hpp"
#include "../mwworld/player.hpp"
#include "../mwgui/window_manager.hpp" // FIXME
#include "../mwinput/inputmanager.hpp" // FIXME
#include "shadows.hpp"
#include "localmap.hpp"

@ -8,19 +8,16 @@
#include <components/interpreter/opcodes.hpp>
#include "../mwbase/environment.hpp"
#include "../mwbase/inputmanager.hpp"
#include "../mwworld/player.hpp"
#include "../mwworld/class.hpp"
#include "../mwmechanics/npcstats.hpp"
#include "../mwinput/inputmanager.hpp"
#include "interpretercontext.hpp"
#include "ref.hpp"
#include <iostream>
namespace MWScript
{
namespace Control
@ -41,11 +38,6 @@ namespace MWScript
MWBase::Environment::get()
.getInputManager()
->toggleControlSwitch(mControl, mEnable);
if (mEnable)
std::cout << "enable: " << mControl << std::endl;
else
std::cout << "disable: " << mControl << std::endl;
}
};

@ -10,7 +10,6 @@
#include "../mwbase/environment.hpp"
#include "../mwgui/window_manager.hpp"
#include "../mwinput/inputmanager.hpp"
#include "interpretercontext.hpp"

@ -15,8 +15,6 @@
#include "../mwgui/window_manager.hpp"
#include "../mwinput/inputmanager.hpp"
#include "locals.hpp"
#include "globalscripts.hpp"

Loading…
Cancel
Save