diff options
Diffstat (limited to 'backends/graphics/openpandora')
-rw-r--r-- | backends/graphics/openpandora/op-graphics.cpp | 43 | ||||
-rw-r--r-- | backends/graphics/openpandora/op-graphics.h | 23 |
2 files changed, 38 insertions, 28 deletions
diff --git a/backends/graphics/openpandora/op-graphics.cpp b/backends/graphics/openpandora/op-graphics.cpp index 5f0301a0c8..f371081fde 100644 --- a/backends/graphics/openpandora/op-graphics.cpp +++ b/backends/graphics/openpandora/op-graphics.cpp @@ -26,28 +26,59 @@ #include "backends/graphics/openpandora/op-graphics.h" #include "backends/events/openpandora/op-events.h" -//#include "backends/platform/openpandora/op-sdl.h" #include "graphics/scaler/aspect.h" #include "common/mutex.h" #include "common/textconsole.h" +static SDL_Cursor *hiddenCursor; + OPGraphicsManager::OPGraphicsManager(SdlEventSource *sdlEventSource) : SurfaceSdlGraphicsManager(sdlEventSource) { } bool OPGraphicsManager::loadGFXMode() { - /* FIXME: For now we just cheat and set the overlay to 640*480 not 800*480 and let SDL - deal with the boarders (it saves cleaning up the overlay when the game screen is - smaller than the overlay ;) + + uint8_t hiddenCursorData = 0; + hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0); + + /* On the OpenPandora we need to work around an SDL assumption that + returns relative mouse coordinates when you get to the screen + edges using the touchscreen. The workaround is to set a blank + SDL cursor and not disable it (Hackish I know). + + The root issues likes in the Windows Manager GRAB code in SDL. + That is why the issue is not seen on framebuffer devices like the + GP2X (there is no X window manager ;)). */ - _videoMode.overlayWidth = 640; - _videoMode.overlayHeight = 480; + SDL_ShowCursor(SDL_ENABLE); + SDL_SetCursor(hiddenCursor); + _videoMode.fullscreen = true; + _videoMode.overlayWidth = _videoMode.screenWidth * _videoMode.scaleFactor; + _videoMode.overlayHeight = _videoMode.screenHeight * _videoMode.scaleFactor; + if (_videoMode.screenHeight != 200 && _videoMode.screenHeight != 400) _videoMode.aspectRatioCorrection = false; + if (_videoMode.aspectRatioCorrection) + _videoMode.overlayHeight = real2Aspect(_videoMode.overlayHeight); + + _videoMode.hardwareWidth = _videoMode.screenWidth * _videoMode.scaleFactor; + _videoMode.hardwareHeight = effectiveScreenHeight(); + return SurfaceSdlGraphicsManager::loadGFXMode(); } +void OPGraphicsManager::unloadGFXMode() { + + uint8_t hiddenCursorData = 0; + hiddenCursor = SDL_CreateCursor(&hiddenCursorData, &hiddenCursorData, 8, 1, 0, 0); + + // Free the hidden SDL cursor created in loadGFXMode + SDL_FreeCursor(hiddenCursor); + + SurfaceSdlGraphicsManager::unloadGFXMode(); +} + #endif diff --git a/backends/graphics/openpandora/op-graphics.h b/backends/graphics/openpandora/op-graphics.h index 0b3eeae8ec..2e3d63e3ad 100644 --- a/backends/graphics/openpandora/op-graphics.h +++ b/backends/graphics/openpandora/op-graphics.h @@ -24,7 +24,6 @@ #define BACKENDS_GRAPHICS_OP_H #include "backends/graphics/surfacesdl/surfacesdl-graphics.h" -#include "graphics/scaler/aspect.h" // for aspect2Real #include "graphics/scaler/downscaler.h" enum { @@ -35,28 +34,8 @@ class OPGraphicsManager : public SurfaceSdlGraphicsManager { public: OPGraphicsManager(SdlEventSource *sdlEventSource); -// bool hasFeature(OSystem::Feature f); -// void setFeatureState(OSystem::Feature f, bool enable); -// bool getFeatureState(OSystem::Feature f); -// int getDefaultGraphicsMode() const; - -// void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL); -// const OSystem::GraphicsMode *getSupportedGraphicsModes() const; -// bool setGraphicsMode(const char *name); -// bool setGraphicsMode(int mode); -// void setGraphicsModeIntern(); -// void internUpdateScreen(); -// void showOverlay(); -// void hideOverlay(); bool loadGFXMode(); -// void drawMouse(); -// void undrawMouse(); -// virtual void warpMouse(int x, int y); - -// SurfaceSdlGraphicsManager::MousePos *getMouseCurState(); -// SurfaceSdlGraphicsManager::VideoState *getVideoMode(); - -// virtual void adjustMouseEvent(const Common::Event &event); + void unloadGFXMode(); }; #endif /* BACKENDS_GRAPHICS_OP_H */ |