mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 09:18:38 +00:00
GOB: Add PreGob input/event utility functions
This commit is contained in:
parent
27782700a5
commit
83896dea3e
@ -137,4 +137,48 @@ bool PreGob::isCursorVisible() const {
|
||||
return CursorMan.isVisible();
|
||||
}
|
||||
|
||||
void PreGob::endFrame(bool doInput) {
|
||||
_vm->_draw->blitInvalidated();
|
||||
_vm->_util->waitEndFrame();
|
||||
|
||||
if (doInput)
|
||||
_vm->_util->processInput();
|
||||
}
|
||||
|
||||
int16 PreGob::checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons) {
|
||||
_vm->_util->getMouseState(&mouseX, &mouseY, &mouseButtons);
|
||||
_vm->_util->forceMouseUp();
|
||||
|
||||
return _vm->_util->checkKey();
|
||||
}
|
||||
|
||||
int16 PreGob::waitInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons) {
|
||||
bool finished = false;
|
||||
|
||||
int16 key = 0;
|
||||
while (!_vm->shouldQuit() && !finished) {
|
||||
endFrame(true);
|
||||
|
||||
key = checkInput(mouseX, mouseY, mouseButtons);
|
||||
|
||||
finished = (mouseButtons != kMouseButtonsNone) || (key != 0);
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
int16 PreGob::waitInput() {
|
||||
int16 mouseX, mouseY;
|
||||
MouseButtons mouseButtons;
|
||||
|
||||
return waitInput(mouseX, mouseY, mouseButtons);
|
||||
}
|
||||
|
||||
bool PreGob::hasInput() {
|
||||
int16 mouseX, mouseY;
|
||||
MouseButtons mouseButtons;
|
||||
|
||||
return checkInput(mouseX, mouseY, mouseButtons) || (mouseButtons != kMouseButtonsNone);
|
||||
}
|
||||
|
||||
} // End of namespace Gob
|
||||
|
@ -23,6 +23,8 @@
|
||||
#ifndef GOB_PREGOB_PREGOB_H
|
||||
#define GOB_PREGOB_PREGOB_H
|
||||
|
||||
#include "gob/util.h"
|
||||
|
||||
namespace Gob {
|
||||
|
||||
class GobEngine;
|
||||
@ -62,6 +64,13 @@ protected:
|
||||
|
||||
bool isCursorVisible() const;
|
||||
|
||||
void endFrame(bool doInput);
|
||||
|
||||
int16 checkInput(int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);
|
||||
int16 waitInput (int16 &mouseX, int16 &mouseY, MouseButtons &mouseButtons);
|
||||
int16 waitInput();
|
||||
bool hasInput();
|
||||
|
||||
|
||||
GobEngine *_vm;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user