From 04ab0e58b4142bf58db2180a2bac6897821d069f Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 8 Aug 2011 23:56:54 +0200 Subject: SDL: Take advantage of SdlGraphicsManager. This gets rid of the hacks, where SdlEventSource added events with custom type numbers to pass SDL_VIDEOEXPOSE and SDL_VIDEORESIZE to the graphics manager. Furthermore it get rids of the uninituitive and hard to trace way of assigning the proper mouse coordinates to mouse related events. Formerly it passed the real screen coordinates through the even dispatching api to the graphics manager (at least hopefully ;-) and let that handle creating a new event with the proper coordinates. Now instead SdlEventSource handles the proper coordinate setup itself. Since this is a behavior change and I can not test all the SDL based small devices ports this commit might break compilation for them and more serve it might also break mouse position behavior. If any of that occurs I am sorry about it. --- backends/graphics/opengl/opengl-graphics.cpp | 39 ---------------------------- 1 file changed, 39 deletions(-) (limited to 'backends/graphics/opengl/opengl-graphics.cpp') diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 046be4c669..57c2378649 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -67,10 +67,6 @@ OpenGLGraphicsManager::OpenGLGraphicsManager() } OpenGLGraphicsManager::~OpenGLGraphicsManager() { - // Unregister the event observer - if (g_system->getEventManager()->getEventDispatcher() != NULL) - g_system->getEventManager()->getEventDispatcher()->unregisterObserver(this); - free(_gamePalette); free(_cursorPalette); @@ -79,11 +75,6 @@ OpenGLGraphicsManager::~OpenGLGraphicsManager() { delete _cursorTexture; } -void OpenGLGraphicsManager::initEventObserver() { - // Register the graphics manager as a event observer - g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 10, false); -} - // // Feature // @@ -1282,36 +1273,6 @@ void OpenGLGraphicsManager::adjustMousePosition(int16 &x, int16 &y) { } } -bool OpenGLGraphicsManager::notifyEvent(const Common::Event &event) { - switch (event.type) { - case Common::EVENT_MOUSEMOVE: - if (!event.synthetic) { - _cursorState.x = event.mouse.x; - _cursorState.y = event.mouse.y; - } - case Common::EVENT_LBUTTONDOWN: - case Common::EVENT_RBUTTONDOWN: - case Common::EVENT_WHEELUP: - case Common::EVENT_WHEELDOWN: - case Common::EVENT_MBUTTONDOWN: - case Common::EVENT_LBUTTONUP: - case Common::EVENT_RBUTTONUP: - case Common::EVENT_MBUTTONUP: - if (!event.synthetic) { - Common::Event newEvent(event); - newEvent.synthetic = true; - adjustMousePosition(newEvent.mouse.x, newEvent.mouse.y); - g_system->getEventManager()->pushEvent(newEvent); - } - return !event.synthetic; - - default: - break; - } - - return false; -} - bool OpenGLGraphicsManager::saveScreenshot(const char *filename) { int width = _videoMode.hardwareWidth; int height = _videoMode.hardwareHeight; -- cgit v1.2.3 From b8dcd9a25eb27ef40aa5535fc83879d20db7e10c Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 12 Aug 2011 04:06:54 +0200 Subject: OPENGL: Fix aspect ratio correction behavior. Now only 320x200 and 640x400 will result in aspect ratio correction to be used if the user requested it. This should fix some strechting in Myst/Riven. --- backends/graphics/opengl/opengl-graphics.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'backends/graphics/opengl/opengl-graphics.cpp') diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 57c2378649..40ef17e477 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -1245,12 +1245,16 @@ void OpenGLGraphicsManager::toggleAntialiasing() { _transactionDetails.filterChanged = true; } -uint OpenGLGraphicsManager::getAspectRatio() { +uint OpenGLGraphicsManager::getAspectRatio() const { // In case we enable aspect ratio correction we force a 4/3 ratio. + // But just for 320x200 and 640x400 games, since other games do not need + // this. // TODO: This makes OpenGL Normal behave like OpenGL Conserve, when aspect // ratio correction is enabled, but it's better than the previous 4/3 mode // mess at least... - if (_videoMode.aspectRatioCorrection) + if (_videoMode.aspectRatioCorrection + && ((_videoMode.screenWidth == 320 && _videoMode.screenHeight == 200) + || (_videoMode.screenWidth == 640 && _videoMode.screenHeight == 400))) return 13333; else if (_videoMode.mode == OpenGL::GFX_NORMAL) return _videoMode.hardwareWidth * 10000 / _videoMode.hardwareHeight; -- cgit v1.2.3 From 59739a7a0e3e4826ba7b27d5270a8d7a26b787ef Mon Sep 17 00:00:00 2001 From: Chris Warren-Smith Date: Sun, 7 Aug 2011 21:33:32 +1000 Subject: BADA: Initial BADA port implementation --- backends/graphics/opengl/opengl-graphics.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'backends/graphics/opengl/opengl-graphics.cpp') diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 40ef17e477..d80ac8050e 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -1348,9 +1348,13 @@ const char *OpenGLGraphicsManager::getCurrentModeName() { } #ifdef USE_OSD +const Graphics::Font* getFontOSD() { + return FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont); +} + void OpenGLGraphicsManager::updateOSD() { // The font we are going to use: - const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont); + const Graphics::Font *font = getFontOSD(); if (_osdSurface.w != _osdTexture->getWidth() || _osdSurface.h != _osdTexture->getHeight()) _osdSurface.create(_osdTexture->getWidth(), _osdTexture->getHeight(), _overlayFormat); -- cgit v1.2.3 From 812e4498ec04231d113bdecabd506d6fa4d84c85 Mon Sep 17 00:00:00 2001 From: Chris Warren-Smith Date: Sat, 13 Aug 2011 08:06:03 +1000 Subject: BADA: Fix formatting and non bada host compile error --- backends/graphics/opengl/opengl-graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends/graphics/opengl/opengl-graphics.cpp') diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index d80ac8050e..8e01e76f16 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -1348,7 +1348,7 @@ const char *OpenGLGraphicsManager::getCurrentModeName() { } #ifdef USE_OSD -const Graphics::Font* getFontOSD() { +const Graphics::Font *OpenGLGraphicsManager::getFontOSD() { return FontMan.getFontByUsage(Graphics::FontManager::kLocalizedFont); } -- cgit v1.2.3