1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-06 22:15:37 +00:00

routed activate signal from input sub-system to engine-class

This commit is contained in:
Marc Zinnschlag 2010-08-05 13:36:33 +02:00
parent 87c84e6fcd
commit 2d695cc806
4 changed files with 27 additions and 7 deletions

View file

@ -253,7 +253,7 @@ void OMW::Engine::go()
// Sets up the input system // Sets up the input system
MWInput::MWInputManager input(mOgre, mEnvironment.mWorld->getPlayerPos(), MWInput::MWInputManager input(mOgre, mEnvironment.mWorld->getPlayerPos(),
*mEnvironment.mWindowManager, mDebug); *mEnvironment.mWindowManager, mDebug, *this);
focusFrameCounter = 0; focusFrameCounter = 0;
@ -266,3 +266,8 @@ void OMW::Engine::go()
std::cout << "Quitting peacefully.\n"; std::cout << "Quitting peacefully.\n";
} }
void OMW::Engine::activate()
{
std::cout << "activate" << std::endl;
}

View file

@ -111,12 +111,15 @@ namespace OMW
/// Enable verbose script output /// Enable verbose script output
void enableVerboseScripts(); void enableVerboseScripts();
/// Start as a new game. /// Start as a new game.
void setNewGame(); void setNewGame();
/// Initialise and enter main loop. /// Initialise and enter main loop.
void go(); void go();
/// Activate the focussed object.
void activate();
}; };
} }

View file

@ -17,6 +17,8 @@
#include <libs/platform/strings.h> #include <libs/platform/strings.h>
#include "../mwrender/playerpos.hpp" #include "../mwrender/playerpos.hpp"
#include "../engine.hpp"
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <OgreRoot.h> #include <OgreRoot.h>
@ -58,6 +60,7 @@ namespace MWInput
OEngine::GUI::EventInjectorPtr guiEvents; OEngine::GUI::EventInjectorPtr guiEvents;
MWRender::PlayerPos &player; MWRender::PlayerPos &player;
MWGui::WindowManager &windows; MWGui::WindowManager &windows;
OMW::Engine& mEngine;
// Count screenshots. // Count screenshots.
int shotCount; int shotCount;
@ -137,7 +140,7 @@ namespace MWInput
void activate() void activate()
{ {
mEngine.activate();
} }
// Exit program now button (which is disabled in GUI mode) // Exit program now button (which is disabled in GUI mode)
@ -151,13 +154,15 @@ namespace MWInput
InputImpl(OEngine::Render::OgreRenderer &_ogre, InputImpl(OEngine::Render::OgreRenderer &_ogre,
MWRender::PlayerPos &_player, MWRender::PlayerPos &_player,
MWGui::WindowManager &_windows, MWGui::WindowManager &_windows,
bool debug) bool debug,
OMW::Engine& engine)
: ogre(_ogre), : ogre(_ogre),
exit(ogre.getWindow()), exit(ogre.getWindow()),
input(ogre.getWindow(), !debug), input(ogre.getWindow(), !debug),
poller(input), poller(input),
player(_player), player(_player),
windows(_windows), windows(_windows),
mEngine (engine),
shotCount(0) shotCount(0)
{ {
using namespace OEngine::Input; using namespace OEngine::Input;
@ -275,9 +280,10 @@ namespace MWInput
MWInputManager::MWInputManager(OEngine::Render::OgreRenderer &ogre, MWInputManager::MWInputManager(OEngine::Render::OgreRenderer &ogre,
MWRender::PlayerPos &player, MWRender::PlayerPos &player,
MWGui::WindowManager &windows, 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() MWInputManager::~MWInputManager()

View file

@ -19,6 +19,11 @@ namespace MWGui
class WindowManager; class WindowManager;
} }
namespace OMW
{
class Engine;
}
namespace MWInput namespace MWInput
{ {
// Forward declaration of the real implementation. // Forward declaration of the real implementation.
@ -37,7 +42,8 @@ namespace MWInput
MWInputManager(OEngine::Render::OgreRenderer &_ogre, MWInputManager(OEngine::Render::OgreRenderer &_ogre,
MWRender::PlayerPos &_player, MWRender::PlayerPos &_player,
MWGui::WindowManager &_windows, MWGui::WindowManager &_windows,
bool debug); bool debug,
OMW::Engine& engine);
~MWInputManager(); ~MWInputManager();
}; };
} }