aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/opengl/opengl-graphics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'backends/graphics/opengl/opengl-graphics.cpp')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp53
1 files changed, 11 insertions, 42 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 046be4c669..8e01e76f16 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
//
@@ -1254,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;
@@ -1282,36 +1277,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;
@@ -1383,9 +1348,13 @@ const char *OpenGLGraphicsManager::getCurrentModeName() {
}
#ifdef USE_OSD
+const Graphics::Font *OpenGLGraphicsManager::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);