mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-12 03:56:20 +00:00
added the instance of EventManager returned by OSystem::getEventManager as a member of the Engine base class. This allows to simply the code a bit and should more efficient too (ie. less virtual function chain calls, obj->getA()->getB()). Also updated several engines to make use of it.
svn-id: r26357
This commit is contained in:
parent
852971cfe6
commit
5aca9dce8c
@ -61,8 +61,7 @@ void AgiEngine::processEvents() {
|
||||
Common::Event event;
|
||||
int key = 0;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_QUIT:
|
||||
_gfx->deinitVideo();
|
||||
|
@ -309,7 +309,7 @@ void AGOSEngine::handleMouseMoved() {
|
||||
}
|
||||
|
||||
CursorMan.showMouse(true);
|
||||
_mouse = _system->getEventManager()->getMousePos();
|
||||
_mouse = _eventMan->getMousePos();
|
||||
|
||||
if (_defaultVerb) {
|
||||
uint id = 101;
|
||||
|
@ -332,8 +332,7 @@ void AGOSEngine::delay(uint amount) {
|
||||
_inCallBack = false;
|
||||
}
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode >= '0' && event.kbd.keycode <='9'
|
||||
|
@ -48,6 +48,7 @@ Engine::Engine(OSystem *syst)
|
||||
: _system(syst),
|
||||
_mixer(_system->getMixer()),
|
||||
_timer(_system->getTimerManager()),
|
||||
_eventMan(_system->getEventManager()),
|
||||
_saveFileMan(_system->getSavefileManager()),
|
||||
_targetName(ConfMan.getActiveDomainName()),
|
||||
_gameDataPath(ConfMan.get("path")) {
|
||||
|
@ -31,6 +31,7 @@ namespace Audio {
|
||||
class Mixer;
|
||||
}
|
||||
namespace Common {
|
||||
class EventManager;
|
||||
class SaveFileManager;
|
||||
class TimerManager;
|
||||
}
|
||||
@ -45,6 +46,7 @@ public:
|
||||
Common::TimerManager * _timer;
|
||||
|
||||
protected:
|
||||
Common::EventManager *_eventMan;
|
||||
Common::SaveFileManager *_saveFileMan;
|
||||
|
||||
const Common::String _targetName; // target name for saves
|
||||
|
@ -811,8 +811,7 @@ void KyraEngine::gui_getInput() {
|
||||
uint32 now = _system->getMillis();
|
||||
|
||||
_mouseWheel = 0;
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_QUIT:
|
||||
quitGame();
|
||||
@ -1487,8 +1486,7 @@ void KyraEngine::gui_updateMainMenuAnimation() {
|
||||
bool KyraEngine::gui_mainMenuGetInput() {
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_QUIT:
|
||||
quitGame();
|
||||
|
@ -608,8 +608,7 @@ void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
|
||||
|
||||
uint32 start = _system->getMillis();
|
||||
do {
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode >= '1' && event.kbd.keycode <= '9' &&
|
||||
@ -690,7 +689,7 @@ void KyraEngine::delay(uint32 amount, bool update, bool isMainLoop) {
|
||||
}
|
||||
|
||||
Common::Point KyraEngine::getMousePos() const {
|
||||
Common::Point mouse = g_system->getEventManager()->getMousePos();
|
||||
Common::Point mouse = _eventMan->getMousePos();
|
||||
if (_flags.useHiResOverlay) {
|
||||
mouse.x >>= 1;
|
||||
mouse.y >>= 1;
|
||||
@ -702,8 +701,7 @@ void KyraEngine::waitForEvent() {
|
||||
bool finished = false;
|
||||
Common::Event event;
|
||||
while (!finished && !_quitFlag) {
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
finished = true;
|
||||
|
@ -1171,8 +1171,7 @@ void KyraEngine::seq_playCredits() {
|
||||
_screen->updateScreen();
|
||||
}
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
finished = true;
|
||||
|
@ -118,8 +118,7 @@ void KyraEngine::waitForChatToFinish(int vocFile, int16 chatDuration, const char
|
||||
uint32 nextTime = loopStart + _tickLength;
|
||||
|
||||
while (_system->getMillis() < nextTime) {
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.keycode == '.')
|
||||
|
@ -40,8 +40,7 @@ namespace Saga {
|
||||
int SagaEngine::processInput() {
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.flags == Common::KBD_CTRL) {
|
||||
@ -153,7 +152,7 @@ int SagaEngine::processInput() {
|
||||
}
|
||||
|
||||
Point SagaEngine::mousePos() const {
|
||||
return _system->getEventManager()->getMousePos();
|
||||
return _eventMan->getMousePos();
|
||||
}
|
||||
|
||||
} // End of namespace Saga
|
||||
|
@ -57,8 +57,7 @@ enum MouseButtonStatus {
|
||||
void ScummEngine::parseEvents() {
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
|
@ -851,8 +851,7 @@ int ScummEngine_vCUPhe::go() {
|
||||
void ScummEngine_vCUPhe::parseEvents() {
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_QUIT:
|
||||
_quit = true;
|
||||
|
@ -511,7 +511,6 @@ void SkyEngine::gotTimerTick(void) {
|
||||
|
||||
void SkyEngine::delay(int32 amount) {
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
Common::Event event;
|
||||
|
||||
uint32 start = _system->getMillis();
|
||||
@ -521,7 +520,7 @@ void SkyEngine::delay(int32 amount) {
|
||||
amount = 0;
|
||||
|
||||
do {
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
_keyFlags = event.kbd.flags;
|
||||
|
@ -706,8 +706,7 @@ void SwordEngine::delay(int32 amount) { //copied and mutilated from sky.cpp
|
||||
uint32 start = _system->getMillis();
|
||||
|
||||
do {
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
// Make sure backspace works right (this fixes a small issue on OS X)
|
||||
|
@ -534,8 +534,7 @@ uint32 Sword2Engine::setInputEventFilter(uint32 filter) {
|
||||
void Sword2Engine::parseInputEvents() {
|
||||
Common::Event event;
|
||||
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
while (eventMan->pollEvent(event)) {
|
||||
while (_eventMan->pollEvent(event)) {
|
||||
switch (event.type) {
|
||||
case Common::EVENT_KEYDOWN:
|
||||
if (event.kbd.flags == Common::KBD_CTRL) {
|
||||
|
@ -237,10 +237,8 @@ void ToucheEngine::writeConfigurationSettings() {
|
||||
ConfMan.flushToDisk();
|
||||
}
|
||||
|
||||
Common::Point ToucheEngine::getMousePos() {
|
||||
Common::EventManager *eventMan = _system->getEventManager();
|
||||
|
||||
return eventMan->getMousePos();
|
||||
Common::Point ToucheEngine::getMousePos() const {
|
||||
return _eventMan->getMousePos();
|
||||
}
|
||||
|
||||
void ToucheEngine::mainLoop() {
|
||||
|
@ -611,7 +611,7 @@ protected:
|
||||
int displayQuitDialog();
|
||||
void displayTextMode(int str);
|
||||
|
||||
Common::Point getMousePos();
|
||||
Common::Point getMousePos() const;
|
||||
|
||||
MidiPlayer *_midiPlayer;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user