properly fixed mouse positioning in game engine

svn-id: r45810
This commit is contained in:
Paweł Kołodziejski 2009-11-10 19:51:40 +00:00
parent 92bd012b55
commit c25739b839
3 changed files with 23 additions and 2 deletions

View File

@ -29,6 +29,15 @@
#if defined(SAMSUNGTV)
void OSystem_SDL_SamsungTV::generateMouseMoveEvent(int x, int y) {
SDL_Event event;
memset(&event, 0, sizeof(event));
event.type = SDL_MOUSEMOTION;
event.motion.x = x;
event.motion.y = y;
SDL_PushEvent(&event);
}
void OSystem_SDL_SamsungTV::handleKbdMouse() {
uint32 curTime = getMillis();
if (curTime >= _km.last_time + _km.delay_time) {
@ -93,7 +102,7 @@ void OSystem_SDL_SamsungTV::handleKbdMouse() {
_km.y_down_count = 1;
}
setMousePos(_km.x, _km.y);
generateMouseMoveEvent(_km.x, _km.y);
}
}
}

View File

@ -542,8 +542,19 @@ void OSystem_SDL_SamsungTV::setFullscreenMode(bool enable) {
}
void OSystem_SDL_SamsungTV::warpMouse(int x, int y) {
if (_mouseCurState.x != x || _mouseCurState.y != y)
int y1 = y;
if (_videoMode.aspectRatioCorrection && !_overlayVisible)
y1 = real2Aspect(y);
if (_mouseCurState.x != x || _mouseCurState.y != y) {
if (!_overlayVisible)
generateMouseMoveEvent(x * _videoMode.scaleFactor, y1 * _videoMode.scaleFactor);
else
generateMouseMoveEvent(x, y1);
setMousePos(x, y);
}
}
void OSystem_SDL_SamsungTV::setMouseCursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y, uint32 keycolor, int cursorTargetScale, const Graphics::PixelFormat *format) {

View File

@ -96,6 +96,7 @@ protected:
void setFullscreenMode(bool enable);
void handleKbdMouse();
void generateMouseMoveEvent(int x, int y);
virtual bool remapKey(SDL_Event &ev, Common::Event &event);
};