diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 3c6eb6f16..251aeac20 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -253,7 +253,7 @@ void OMW::Engine::go() // Sets up the input system MWInput::MWInputManager input(mOgre, mEnvironment.mWorld->getPlayerPos(), - *mEnvironment.mWindowManager, mDebug); + *mEnvironment.mWindowManager, mDebug, *this); focusFrameCounter = 0; @@ -266,3 +266,8 @@ void OMW::Engine::go() std::cout << "Quitting peacefully.\n"; } + +void OMW::Engine::activate() +{ + std::cout << "activate" << std::endl; +} diff --git a/apps/openmw/engine.hpp b/apps/openmw/engine.hpp index 412c4fa73..62166e050 100644 --- a/apps/openmw/engine.hpp +++ b/apps/openmw/engine.hpp @@ -111,12 +111,15 @@ namespace OMW /// Enable verbose script output void enableVerboseScripts(); - + /// Start as a new game. void setNewGame(); /// Initialise and enter main loop. void go(); + + /// Activate the focussed object. + void activate(); }; } diff --git a/apps/openmw/mwinput/inputmanager.cpp b/apps/openmw/mwinput/inputmanager.cpp index f851b43b2..f730150b0 100644 --- a/apps/openmw/mwinput/inputmanager.cpp +++ b/apps/openmw/mwinput/inputmanager.cpp @@ -17,6 +17,8 @@ #include #include "../mwrender/playerpos.hpp" +#include "../engine.hpp" + #include #include #include @@ -58,6 +60,7 @@ namespace MWInput OEngine::GUI::EventInjectorPtr guiEvents; MWRender::PlayerPos &player; MWGui::WindowManager &windows; + OMW::Engine& mEngine; // Count screenshots. int shotCount; @@ -137,7 +140,7 @@ namespace MWInput void activate() { - + mEngine.activate(); } // Exit program now button (which is disabled in GUI mode) @@ -151,13 +154,15 @@ namespace MWInput InputImpl(OEngine::Render::OgreRenderer &_ogre, MWRender::PlayerPos &_player, MWGui::WindowManager &_windows, - bool debug) + bool debug, + OMW::Engine& engine) : ogre(_ogre), exit(ogre.getWindow()), input(ogre.getWindow(), !debug), poller(input), player(_player), windows(_windows), + mEngine (engine), shotCount(0) { using namespace OEngine::Input; @@ -275,9 +280,10 @@ namespace MWInput MWInputManager::MWInputManager(OEngine::Render::OgreRenderer &ogre, MWRender::PlayerPos &player, MWGui::WindowManager &windows, - bool debug) + bool debug, + OMW::Engine& engine) { - impl = new InputImpl(ogre,player,windows,debug); + impl = new InputImpl(ogre,player,windows,debug, engine); } MWInputManager::~MWInputManager() diff --git a/apps/openmw/mwinput/inputmanager.hpp b/apps/openmw/mwinput/inputmanager.hpp index 094b848ee..554089588 100644 --- a/apps/openmw/mwinput/inputmanager.hpp +++ b/apps/openmw/mwinput/inputmanager.hpp @@ -19,6 +19,11 @@ namespace MWGui class WindowManager; } +namespace OMW +{ + class Engine; +} + namespace MWInput { // Forward declaration of the real implementation. @@ -37,7 +42,8 @@ namespace MWInput MWInputManager(OEngine::Render::OgreRenderer &_ogre, MWRender::PlayerPos &_player, MWGui::WindowManager &_windows, - bool debug); + bool debug, + OMW::Engine& engine); ~MWInputManager(); }; }