DREAMWEB: Better 'mouseCall' api, DreamWebEngine should not use _context, ideally

This commit is contained in:
Bertrand Augereau 2011-08-25 07:46:23 +02:00
parent 2cecbe0e3a
commit 0baa0afb38
3 changed files with 13 additions and 9 deletions

View file

@ -303,7 +303,7 @@ void DreamWebEngine::keyPressed(uint16 ascii) {
keybuf[in] = ascii;
}
void DreamWebEngine::mouseCall() {
void DreamWebEngine::mouseCall(uint16 *x, uint16 *y, uint16 *state) {
processEvents();
Common::EventManager *eventMan = _system->getEventManager();
Common::Point pos = eventMan->getMousePos();
@ -315,13 +315,12 @@ void DreamWebEngine::mouseCall() {
pos.y = 15;
if (pos.y > 184)
pos.y = 184;
_context.cx = pos.x;
_context.dx = pos.y;
*x = pos.x;
*y = pos.y;
unsigned state = eventMan->getButtonState();
_context.bx = state == _oldMouseState? 0: state;
_oldMouseState = state;
_context.flags._c = false;
unsigned newState = eventMan->getButtonState();
*state = (newState == _oldMouseState? 0 : newState);
_oldMouseState = newState;
}
void DreamWebEngine::fadeDos() {

View file

@ -82,7 +82,7 @@ public:
uint32 skipBytes(uint32 bytes);
void closeFile();
void mouseCall(); //fill mouse pos and button state
void mouseCall(uint16 *x, uint16 *y, uint16 *state); //fill mouse pos and button state
void processEvents();
void setPalette();
void fadeDos();

View file

@ -285,7 +285,12 @@ void DreamGenContext::dontloadseg() {
}
void DreamGenContext::mousecall() {
engine->mouseCall();
uint16 x, y, state;
engine->mouseCall(&x, &y, &state);
cx = x;
dx = y;
bx = state;
flags._c = false;
}
void DreamGenContext::setmouse() {