diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/resvmopenglsdl/resvmopenglsdl-graphics.cpp similarity index 89% rename from backends/graphics/openglsdl/openglsdl-graphics.cpp rename to backends/graphics/resvmopenglsdl/resvmopenglsdl-graphics.cpp index 42abd39a998..5e5c3d02265 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/resvmopenglsdl/resvmopenglsdl-graphics.cpp @@ -24,7 +24,7 @@ #if defined(SDL_BACKEND) -#include "backends/graphics/openglsdl/openglsdl-graphics.h" +#include "backends/graphics/resvmopenglsdl/resvmopenglsdl-graphics.h" #include "backends/events/sdl/resvm-sdl-events.h" #include "common/config-manager.h" @@ -44,7 +44,7 @@ #include "image/bmp.h" #endif -OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(SdlEventSource *eventSource, SdlWindow *window, const Capabilities &capabilities) +ResVmOpenGLSdlGraphicsManager::ResVmOpenGLSdlGraphicsManager(SdlEventSource *eventSource, SdlWindow *window, const Capabilities &capabilities) : ResVmSdlGraphicsManager(eventSource, window), #if SDL_VERSION_ATLEAST(2, 0, 0) _glContext(nullptr), @@ -69,14 +69,14 @@ OpenGLSdlGraphicsManager::OpenGLSdlGraphicsManager(SdlEventSource *eventSource, _screenChangeCount = 1 << (sizeof(int) * 8 - 2); } -OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() { +ResVmOpenGLSdlGraphicsManager::~ResVmOpenGLSdlGraphicsManager() { closeOverlay(); #if SDL_VERSION_ATLEAST(2, 0, 0) deinitializeRenderer(); #endif } -bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) const { +bool ResVmOpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) const { return (f == OSystem::kFeatureFullscreenMode) || (f == OSystem::kFeatureOpenGL) || @@ -88,7 +88,7 @@ bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) const { (f == OSystem::kFeatureOverlaySupportsAlpha && _overlayFormat.aBits() > 3); } -bool OpenGLSdlGraphicsManager::getFeatureState(OSystem::Feature f) const { +bool ResVmOpenGLSdlGraphicsManager::getFeatureState(OSystem::Feature f) const { switch (f) { case OSystem::kFeatureVSync: return isVSyncEnabled(); @@ -101,7 +101,7 @@ bool OpenGLSdlGraphicsManager::getFeatureState(OSystem::Feature f) const { } } -void OpenGLSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { +void ResVmOpenGLSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { switch (f) { case OSystem::kFeatureFullscreenMode: if (_fullscreen != enable) { @@ -117,7 +117,7 @@ void OpenGLSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) } } -void OpenGLSdlGraphicsManager::setupScreen(uint gameWidth, uint gameHeight, bool fullscreen, bool accel3d) { +void ResVmOpenGLSdlGraphicsManager::setupScreen(uint gameWidth, uint gameHeight, bool fullscreen, bool accel3d) { assert(accel3d); closeOverlay(); @@ -187,7 +187,7 @@ void OpenGLSdlGraphicsManager::setupScreen(uint gameWidth, uint gameHeight, bool #endif } -void OpenGLSdlGraphicsManager::createOrUpdateScreen() { +void ResVmOpenGLSdlGraphicsManager::createOrUpdateScreen() { closeOverlay(); // If the game can't adapt to any resolution, render it to a framebuffer @@ -260,7 +260,7 @@ void OpenGLSdlGraphicsManager::createOrUpdateScreen() { #endif } -Math::Rect2d OpenGLSdlGraphicsManager::computeGameRect(bool renderToFrameBuffer, uint gameWidth, uint gameHeight, +Math::Rect2d ResVmOpenGLSdlGraphicsManager::computeGameRect(bool renderToFrameBuffer, uint gameWidth, uint gameHeight, uint screenWidth, uint screenHeight) { if (renderToFrameBuffer) { if (_lockAspectRatio) { @@ -281,7 +281,7 @@ Math::Rect2d OpenGLSdlGraphicsManager::computeGameRect(bool renderToFrameBuffer, } } -void OpenGLSdlGraphicsManager::notifyResize(const int width, const int height) { +void ResVmOpenGLSdlGraphicsManager::notifyResize(const int width, const int height) { #if SDL_VERSION_ATLEAST(2, 0, 0) // Get the updated size directly from SDL, in case there are multiple // resize events in the message queue. @@ -311,11 +311,11 @@ void OpenGLSdlGraphicsManager::notifyResize(const int width, const int height) { #endif } -Graphics::PixelBuffer OpenGLSdlGraphicsManager::getScreenPixelBuffer() { +Graphics::PixelBuffer ResVmOpenGLSdlGraphicsManager::getScreenPixelBuffer() { error("Direct screen buffer access is not allowed when using OpenGL"); } -void OpenGLSdlGraphicsManager::initializeOpenGLContext() const { +void ResVmOpenGLSdlGraphicsManager::initializeOpenGLContext() const { OpenGL::ContextType type; #ifdef USE_GLES2 @@ -333,7 +333,7 @@ void OpenGLSdlGraphicsManager::initializeOpenGLContext() const { #endif } -OpenGLSdlGraphicsManager::OpenGLPixelFormat::OpenGLPixelFormat(uint screenBytesPerPixel, uint red, uint blue, uint green, uint alpha, int samples) : +ResVmOpenGLSdlGraphicsManager::OpenGLPixelFormat::OpenGLPixelFormat(uint screenBytesPerPixel, uint red, uint blue, uint green, uint alpha, int samples) : bytesPerPixel(screenBytesPerPixel), redSize(red), blueSize(blue), @@ -343,7 +343,7 @@ OpenGLSdlGraphicsManager::OpenGLPixelFormat::OpenGLPixelFormat(uint screenBytesP } -bool OpenGLSdlGraphicsManager::createOrUpdateGLContext(uint gameWidth, uint gameHeight, +bool ResVmOpenGLSdlGraphicsManager::createOrUpdateGLContext(uint gameWidth, uint gameHeight, uint effectiveWidth, uint effectiveHeight, bool renderToFramebuffer, bool engineSupportsArbitraryResolutions) { @@ -464,12 +464,12 @@ bool OpenGLSdlGraphicsManager::createOrUpdateGLContext(uint gameWidth, uint game return it != pixelFormats.end(); } -bool OpenGLSdlGraphicsManager::shouldRenderToFramebuffer() const { +bool ResVmOpenGLSdlGraphicsManager::shouldRenderToFramebuffer() const { bool engineSupportsArbitraryResolutions = !g_engine || g_engine->hasFeature(Engine::kSupportsArbitraryResolutions); return !engineSupportsArbitraryResolutions && _capabilities.openGLFrameBuffer; } -bool OpenGLSdlGraphicsManager::isVSyncEnabled() const { +bool ResVmOpenGLSdlGraphicsManager::isVSyncEnabled() const { #if SDL_VERSION_ATLEAST(2, 0, 0) return SDL_GL_GetSwapInterval() != 0; #else @@ -479,7 +479,7 @@ bool OpenGLSdlGraphicsManager::isVSyncEnabled() const { #endif } -void OpenGLSdlGraphicsManager::drawOverlay() { +void ResVmOpenGLSdlGraphicsManager::drawOverlay() { glViewport(0, 0, _overlayScreen->getWidth(), _overlayScreen->getHeight()); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); @@ -496,7 +496,7 @@ void OpenGLSdlGraphicsManager::drawOverlay() { _surfaceRenderer->restorePreviousState(); } -void OpenGLSdlGraphicsManager::drawSideTextures() { +void ResVmOpenGLSdlGraphicsManager::drawSideTextures() { if (_fullscreen && _lockAspectRatio) { _surfaceRenderer->setFlipY(true); @@ -518,7 +518,7 @@ void OpenGLSdlGraphicsManager::drawSideTextures() { } #ifndef AMIGAOS -OpenGL::FrameBuffer *OpenGLSdlGraphicsManager::createFramebuffer(uint width, uint height) { +OpenGL::FrameBuffer *ResVmOpenGLSdlGraphicsManager::createFramebuffer(uint width, uint height) { #if !defined(USE_GLES2) if (_antialiasing && OpenGLContext.framebufferObjectMultisampleSupported) { return new OpenGL::MultiSampleFrameBuffer(width, height, _antialiasing); @@ -530,7 +530,7 @@ OpenGL::FrameBuffer *OpenGLSdlGraphicsManager::createFramebuffer(uint width, uin } #endif // AMIGAOS -void OpenGLSdlGraphicsManager::updateScreen() { +void ResVmOpenGLSdlGraphicsManager::updateScreen() { if (_frameBuffer) { _frameBuffer->detach(); glViewport(0, 0, _overlayScreen->getWidth(), _overlayScreen->getHeight()); @@ -562,7 +562,7 @@ void OpenGLSdlGraphicsManager::updateScreen() { } } -int16 OpenGLSdlGraphicsManager::getHeight() const { +int16 ResVmOpenGLSdlGraphicsManager::getHeight() const { // ResidualVM specific if (_frameBuffer) return _frameBuffer->getHeight(); @@ -570,7 +570,7 @@ int16 OpenGLSdlGraphicsManager::getHeight() const { return _overlayScreen->getHeight(); } -int16 OpenGLSdlGraphicsManager::getWidth() const { +int16 ResVmOpenGLSdlGraphicsManager::getWidth() const { // ResidualVM specific if (_frameBuffer) return _frameBuffer->getWidth(); @@ -582,7 +582,7 @@ int16 OpenGLSdlGraphicsManager::getWidth() const { #pragma mark --- Overlays --- #pragma mark - -void OpenGLSdlGraphicsManager::suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) { +void ResVmOpenGLSdlGraphicsManager::suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) { delete _sideTextures[0]; _sideTextures[0] = nullptr; delete _sideTextures[1]; @@ -595,7 +595,7 @@ void OpenGLSdlGraphicsManager::suggestSideTextures(Graphics::Surface *left, Grap } } -void OpenGLSdlGraphicsManager::showOverlay() { +void ResVmOpenGLSdlGraphicsManager::showOverlay() { if (_overlayVisible) { return; } @@ -616,7 +616,7 @@ void OpenGLSdlGraphicsManager::showOverlay() { } } -void OpenGLSdlGraphicsManager::hideOverlay() { +void ResVmOpenGLSdlGraphicsManager::hideOverlay() { if (!_overlayVisible) { return; } @@ -626,15 +626,15 @@ void OpenGLSdlGraphicsManager::hideOverlay() { _overlayBackground = nullptr; } -void OpenGLSdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { +void ResVmOpenGLSdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { _overlayScreen->copyRectToSurface(buf, pitch, x, y, w, h); } -void OpenGLSdlGraphicsManager::clearOverlay() { +void ResVmOpenGLSdlGraphicsManager::clearOverlay() { _overlayScreen->fill(0); } -void OpenGLSdlGraphicsManager::grabOverlay(void *buf, int pitch) const { +void ResVmOpenGLSdlGraphicsManager::grabOverlay(void *buf, int pitch) const { const Graphics::Surface *overlayData = _overlayScreen->getBackingSurface(); const byte *src = (const byte *)overlayData->getPixels(); @@ -647,7 +647,7 @@ void OpenGLSdlGraphicsManager::grabOverlay(void *buf, int pitch) const { } } -void OpenGLSdlGraphicsManager::closeOverlay() { +void ResVmOpenGLSdlGraphicsManager::closeOverlay() { delete _sideTextures[0]; delete _sideTextures[1]; _sideTextures[0] = _sideTextures[1] = nullptr; @@ -666,15 +666,15 @@ void OpenGLSdlGraphicsManager::closeOverlay() { OpenGL::Context::destroy(); } -int16 OpenGLSdlGraphicsManager::getOverlayHeight() const { +int16 ResVmOpenGLSdlGraphicsManager::getOverlayHeight() const { return _overlayScreen->getHeight(); } -int16 OpenGLSdlGraphicsManager::getOverlayWidth() const { +int16 ResVmOpenGLSdlGraphicsManager::getOverlayWidth() const { return _overlayScreen->getWidth(); } -void OpenGLSdlGraphicsManager::warpMouse(int x, int y) { +void ResVmOpenGLSdlGraphicsManager::warpMouse(int x, int y) { //ResidualVM specific if (_frameBuffer) { // Scale from game coordinates to screen coordinates @@ -688,7 +688,7 @@ void OpenGLSdlGraphicsManager::warpMouse(int x, int y) { _window->warpMouseInWindow(x, y); } -void OpenGLSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) { +void ResVmOpenGLSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) { if (_overlayVisible || !_frameBuffer) return; @@ -705,13 +705,13 @@ void OpenGLSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) { } #if SDL_VERSION_ATLEAST(2, 0, 0) -void OpenGLSdlGraphicsManager::deinitializeRenderer() { +void ResVmOpenGLSdlGraphicsManager::deinitializeRenderer() { SDL_GL_DeleteContext(_glContext); _glContext = nullptr; } #endif // SDL_VERSION_ATLEAST(2, 0, 0) -bool OpenGLSdlGraphicsManager::saveScreenshot(const Common::String &filename) const { +bool ResVmOpenGLSdlGraphicsManager::saveScreenshot(const Common::String &filename) const { // Largely based on the implementation from ScummVM uint width = _overlayScreen->getWidth(); uint height = _overlayScreen->getHeight(); diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/resvmopenglsdl/resvmopenglsdl-graphics.h similarity index 94% rename from backends/graphics/openglsdl/openglsdl-graphics.h rename to backends/graphics/resvmopenglsdl/resvmopenglsdl-graphics.h index d3ee0790edc..47896ba27ea 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/resvmopenglsdl/resvmopenglsdl-graphics.h @@ -20,8 +20,8 @@ * */ -#ifndef BACKENDS_GRAPHICS_OPENGLSDL_GRAPHICS_H -#define BACKENDS_GRAPHICS_OPENGLSDL_GRAPHICS_H +#ifndef BACKENDS_GRAPHICS_RESVMOPENGLSDL_GRAPHICS_H +#define BACKENDS_GRAPHICS_RESVMOPENGLSDL_GRAPHICS_H #include "backends/graphics/sdl/resvm-sdl-graphics.h" @@ -37,7 +37,7 @@ namespace OpenGL { * * Used when rendering games with OpenGL */ -class OpenGLSdlGraphicsManager : public ResVmSdlGraphicsManager { +class ResVmOpenGLSdlGraphicsManager : public ResVmSdlGraphicsManager { public: /** * Capabilities of the current device @@ -54,8 +54,8 @@ public: Capabilities() : openGLFrameBuffer(false) {} }; - OpenGLSdlGraphicsManager(SdlEventSource *eventSource, SdlWindow *window, const Capabilities &capabilities); - virtual ~OpenGLSdlGraphicsManager(); + ResVmOpenGLSdlGraphicsManager(SdlEventSource *eventSource, SdlWindow *window, const Capabilities &capabilities); + virtual ~ResVmOpenGLSdlGraphicsManager(); // GraphicsManager API - Features virtual bool hasFeature(OSystem::Feature f) const override; diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/resvmsurfacesdl/resvmsurfacesdl-graphics.cpp similarity index 87% rename from backends/graphics/surfacesdl/surfacesdl-graphics.cpp rename to backends/graphics/resvmsurfacesdl/resvmsurfacesdl-graphics.cpp index ca108a8cd65..c1ee6466b5f 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/resvmsurfacesdl/resvmsurfacesdl-graphics.cpp @@ -24,7 +24,7 @@ #if defined(SDL_BACKEND) -#include "backends/graphics/surfacesdl/surfacesdl-graphics.h" +#include "backends/graphics/resvmsurfacesdl/resvmsurfacesdl-graphics.h" #include "backends/events/sdl/resvm-sdl-events.h" #include "common/config-manager.h" #include "common/file.h" @@ -40,7 +40,7 @@ #define SDL_FULLSCREEN 0x40000000 #endif -SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window) +ResVmSurfaceSdlGraphicsManager::ResVmSurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window) : ResVmSdlGraphicsManager(sdlEventSource, window), #if SDL_VERSION_ATLEAST(2, 0, 0) @@ -62,7 +62,7 @@ SurfaceSdlGraphicsManager::SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSou _sideSurfaces[0] = _sideSurfaces[1] = nullptr; } -SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() { +ResVmSurfaceSdlGraphicsManager::~ResVmSurfaceSdlGraphicsManager() { closeOverlay(); if (_subScreen) { @@ -75,7 +75,7 @@ SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() { #endif } -bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) const { +bool ResVmSurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) const { return #if SDL_VERSION_ATLEAST(2, 0, 0) (f == OSystem::kFeatureFullscreenToggleKeepsContext) || @@ -84,7 +84,7 @@ bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) const { (f == OSystem::kFeatureFullscreenMode); } -bool SurfaceSdlGraphicsManager::getFeatureState(OSystem::Feature f) const { +bool ResVmSurfaceSdlGraphicsManager::getFeatureState(OSystem::Feature f) const { switch (f) { case OSystem::kFeatureFullscreenMode: return _fullscreen; @@ -95,7 +95,7 @@ bool SurfaceSdlGraphicsManager::getFeatureState(OSystem::Feature f) const { } } -void SurfaceSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { +void ResVmSurfaceSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) { switch (f) { case OSystem::kFeatureFullscreenMode: if (_fullscreen != enable) { @@ -111,7 +111,7 @@ void SurfaceSdlGraphicsManager::setFeatureState(OSystem::Feature f, bool enable) } } -void SurfaceSdlGraphicsManager::setupScreen(uint gameWidth, uint gameHeight, bool fullscreen, bool accel3d) { +void ResVmSurfaceSdlGraphicsManager::setupScreen(uint gameWidth, uint gameHeight, bool fullscreen, bool accel3d) { assert(!accel3d); if (_subScreen) { @@ -138,7 +138,7 @@ void SurfaceSdlGraphicsManager::setupScreen(uint gameWidth, uint gameHeight, boo #endif // SDL_VERSION_ATLEAST(2, 0, 0) } -void SurfaceSdlGraphicsManager::createOrUpdateScreen() { +void ResVmSurfaceSdlGraphicsManager::createOrUpdateScreen() { closeOverlay(); // Choose the effective window size or fullscreen mode @@ -192,11 +192,11 @@ void SurfaceSdlGraphicsManager::createOrUpdateScreen() { dynamic_cast(_eventSource)->resetKeyboardEmulation(_gameRect.getWidth() - 1, _gameRect.getHeight() - 1); } -Graphics::PixelBuffer SurfaceSdlGraphicsManager::getScreenPixelBuffer() { +Graphics::PixelBuffer ResVmSurfaceSdlGraphicsManager::getScreenPixelBuffer() { return Graphics::PixelBuffer(_screenFormat, (byte *)_subScreen->pixels); } -void SurfaceSdlGraphicsManager::drawSideTextures() { +void ResVmSurfaceSdlGraphicsManager::drawSideTextures() { if (_fullscreen && _lockAspectRatio) { if (_sideSurfaces[0]) { SDL_Rect dstrect; @@ -217,14 +217,14 @@ void SurfaceSdlGraphicsManager::drawSideTextures() { } } -void SurfaceSdlGraphicsManager::drawOverlay() { +void ResVmSurfaceSdlGraphicsManager::drawOverlay() { if (!_overlayscreen) return; SDL_BlitSurface(_overlayscreen, NULL, _screen, NULL); } -void SurfaceSdlGraphicsManager::updateScreen() { +void ResVmSurfaceSdlGraphicsManager::updateScreen() { SDL_Rect dstrect; dstrect.x = _gameRect.getTopLeft().getX(); dstrect.y = _gameRect.getTopLeft().getY(); @@ -248,12 +248,12 @@ void SurfaceSdlGraphicsManager::updateScreen() { #endif } -int16 SurfaceSdlGraphicsManager::getHeight() const { +int16 ResVmSurfaceSdlGraphicsManager::getHeight() const { // ResidualVM specific return _subScreen->h; } -int16 SurfaceSdlGraphicsManager::getWidth() const { +int16 ResVmSurfaceSdlGraphicsManager::getWidth() const { // ResidualVM specific return _subScreen->w; } @@ -262,7 +262,7 @@ int16 SurfaceSdlGraphicsManager::getWidth() const { #pragma mark --- Overlays --- #pragma mark - -void SurfaceSdlGraphicsManager::clearOverlay() { +void ResVmSurfaceSdlGraphicsManager::clearOverlay() { if (!_overlayscreen) return; @@ -274,7 +274,7 @@ void SurfaceSdlGraphicsManager::clearOverlay() { _overlayDirty = true; } -void SurfaceSdlGraphicsManager::suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) { +void ResVmSurfaceSdlGraphicsManager::suggestSideTextures(Graphics::Surface *left, Graphics::Surface *right) { delete _sideSurfaces[0]; _sideSurfaces[0] = nullptr; delete _sideSurfaces[1]; @@ -289,7 +289,7 @@ void SurfaceSdlGraphicsManager::suggestSideTextures(Graphics::Surface *left, Gra } } -void SurfaceSdlGraphicsManager::showOverlay() { +void ResVmSurfaceSdlGraphicsManager::showOverlay() { if (_overlayVisible) return; @@ -300,7 +300,7 @@ void SurfaceSdlGraphicsManager::showOverlay() { dynamic_cast(_eventSource)->resetKeyboardEmulation(getOverlayWidth() - 1, getOverlayHeight() - 1); } -void SurfaceSdlGraphicsManager::hideOverlay() { +void ResVmSurfaceSdlGraphicsManager::hideOverlay() { if (!_overlayVisible) return; @@ -311,7 +311,7 @@ void SurfaceSdlGraphicsManager::hideOverlay() { dynamic_cast(_eventSource)->resetKeyboardEmulation(_gameRect.getWidth() - 1, _gameRect.getHeight() - 1); } -void SurfaceSdlGraphicsManager::grabOverlay(void *buf, int pitch) const { +void ResVmSurfaceSdlGraphicsManager::grabOverlay(void *buf, int pitch) const { if (_overlayscreen == NULL) return; @@ -330,7 +330,7 @@ void SurfaceSdlGraphicsManager::grabOverlay(void *buf, int pitch) const { SDL_UnlockSurface(_overlayscreen); } -void SurfaceSdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { +void ResVmSurfaceSdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) { if (_overlayscreen == NULL) return; @@ -373,7 +373,7 @@ void SurfaceSdlGraphicsManager::copyRectToOverlay(const void *buf, int pitch, in SDL_UnlockSurface(_overlayscreen); } -void SurfaceSdlGraphicsManager::closeOverlay() { +void ResVmSurfaceSdlGraphicsManager::closeOverlay() { SDL_FreeSurface(_sideSurfaces[0]); SDL_FreeSurface(_sideSurfaces[1]); _sideSurfaces[0] = _sideSurfaces[1] = nullptr; @@ -389,7 +389,7 @@ void SurfaceSdlGraphicsManager::closeOverlay() { } } -void SurfaceSdlGraphicsManager::warpMouse(int x, int y) { +void ResVmSurfaceSdlGraphicsManager::warpMouse(int x, int y) { //ResidualVM specific // Scale from game coordinates to screen coordinates x = (x * _gameRect.getWidth()) / _subScreen->w; @@ -401,7 +401,7 @@ void SurfaceSdlGraphicsManager::warpMouse(int x, int y) { _window->warpMouseInWindow(x, y); } -void SurfaceSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) { +void ResVmSurfaceSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) { if (_overlayVisible) return; @@ -418,7 +418,7 @@ void SurfaceSdlGraphicsManager::transformMouseCoordinates(Common::Point &point) } #if SDL_VERSION_ATLEAST(2, 0, 0) -void SurfaceSdlGraphicsManager::deinitializeRenderer() { +void ResVmSurfaceSdlGraphicsManager::deinitializeRenderer() { SDL_DestroyTexture(_screenTexture); _screenTexture = nullptr; @@ -426,7 +426,7 @@ void SurfaceSdlGraphicsManager::deinitializeRenderer() { _renderer = nullptr; } -SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) { +SDL_Surface *ResVmSurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags) { deinitializeRenderer(); uint32 createWindowFlags = 0; @@ -498,7 +498,7 @@ SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height, } #endif // SDL_VERSION_ATLEAST(2, 0, 0) -bool SurfaceSdlGraphicsManager::saveScreenshot(const Common::String &filename) const { +bool ResVmSurfaceSdlGraphicsManager::saveScreenshot(const Common::String &filename) const { // Based on the implementation from ScummVM bool success; SDL_Surface *screen = nullptr; @@ -555,7 +555,7 @@ bool SurfaceSdlGraphicsManager::saveScreenshot(const Common::String &filename) c return success; } -int SurfaceSdlGraphicsManager::getGraphicsModeScale(int mode) const { +int ResVmSurfaceSdlGraphicsManager::getGraphicsModeScale(int mode) const { return 1; } diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/resvmsurfacesdl/resvmsurfacesdl-graphics.h similarity index 92% rename from backends/graphics/surfacesdl/surfacesdl-graphics.h rename to backends/graphics/resvmsurfacesdl/resvmsurfacesdl-graphics.h index 974d036cfc2..730fec83f24 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.h +++ b/backends/graphics/resvmsurfacesdl/resvmsurfacesdl-graphics.h @@ -20,8 +20,8 @@ * */ -#ifndef BACKENDS_GRAPHICS_SURFACESDL_GRAPHICS_H -#define BACKENDS_GRAPHICS_SURFACESDL_GRAPHICS_H +#ifndef BACKENDS_GRAPHICS_RESVMSURFACESDL_GRAPHICS_H +#define BACKENDS_GRAPHICS_RESVMSURFACESDL_GRAPHICS_H #include "backends/graphics/sdl/resvm-sdl-graphics.h" @@ -30,10 +30,10 @@ * * Used when rendering the launcher, or games with TinyGL */ -class SurfaceSdlGraphicsManager : public ResVmSdlGraphicsManager { +class ResVmSurfaceSdlGraphicsManager : public ResVmSdlGraphicsManager { public: - SurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window); - virtual ~SurfaceSdlGraphicsManager(); + ResVmSurfaceSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window); + virtual ~ResVmSurfaceSdlGraphicsManager(); // GraphicsManager API - Features virtual bool hasFeature(OSystem::Feature f) const override; diff --git a/backends/module.mk b/backends/module.mk index 6fb409fca6d..21a8e09a1e0 100644 --- a/backends/module.mk +++ b/backends/module.mk @@ -121,7 +121,7 @@ MODULE_OBJS += \ events/sdl/resvm-sdl-events.o \ graphics/sdl/sdl-graphics.o \ graphics/sdl/resvm-sdl-graphics.o \ - graphics/surfacesdl/surfacesdl-graphics.o \ + graphics/resvmsurfacesdl/resvmsurfacesdl-graphics.o \ mixer/sdl/sdl-mixer.o \ mutex/sdl/sdl-mutex.o \ plugins/sdl/sdl-provider.o \ @@ -135,7 +135,7 @@ endif ifdef USE_OPENGL MODULE_OBJS += \ - graphics/openglsdl/openglsdl-graphics.o + graphics/resvmopenglsdl/resvmopenglsdl-graphics.o endif ifdef USE_DISCORD diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index b9e77bad6b6..a6da2833a70 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -52,11 +52,11 @@ #include "backends/keymapper/hardware-input.h" #include "backends/mutex/sdl/sdl-mutex.h" #include "backends/timer/sdl/sdl-timer.h" -#include "backends/graphics/surfacesdl/surfacesdl-graphics.h" +#include "backends/graphics/resvmsurfacesdl/resvmsurfacesdl-graphics.h" // ResidualVM specific #ifdef USE_OPENGL -#include "backends/graphics/openglsdl/openglsdl-graphics.h" -//#include "graphics/cursorman.h" // ResidualVM +#include "backends/graphics/resvmopenglsdl/resvmopenglsdl-graphics.h" // ResidualVM specific +//#include "graphics/cursorman.h" // ResidualVM specific #include "graphics/opengl/context.h" // ResidualVM specific #endif #include "graphics/renderer.h" // ResidualVM specific @@ -263,7 +263,7 @@ void OSystem_SDL::initBackend() { #endif if (_graphicsManager == 0) { - _graphicsManager = new SurfaceSdlGraphicsManager(_eventSource, _window); + _graphicsManager = new ResVmSurfaceSdlGraphicsManager(_eventSource, _window); // ResidualVM specific } } @@ -489,9 +489,9 @@ void OSystem_SDL::setWindowCaption(const char *caption) { #ifdef USE_OPENGL void OSystem_SDL::setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) { bool switchedManager = false; - if (accel3d && !dynamic_cast(_graphicsManager)) { + if (accel3d && !dynamic_cast(_graphicsManager)) { switchedManager = true; - } else if (!accel3d && !dynamic_cast(_graphicsManager)) { + } else if (!accel3d && !dynamic_cast(_graphicsManager)) { switchedManager = true; } @@ -501,9 +501,9 @@ void OSystem_SDL::setupScreen(uint screenW, uint screenH, bool fullscreen, bool delete _graphicsManager; if (accel3d) { - _graphicsManager = sdlGraphicsManager = new OpenGLSdlGraphicsManager(_eventSource, _window, _capabilities); + _graphicsManager = sdlGraphicsManager = new ResVmOpenGLSdlGraphicsManager(_eventSource, _window, _capabilities); } else { - _graphicsManager = sdlGraphicsManager = new SurfaceSdlGraphicsManager(_eventSource, _window); + _graphicsManager = sdlGraphicsManager = new ResVmSurfaceSdlGraphicsManager(_eventSource, _window); } sdlGraphicsManager->activateManager(); } diff --git a/backends/platform/sdl/sdl.h b/backends/platform/sdl/sdl.h index 05da3ea44e2..caf53473e68 100644 --- a/backends/platform/sdl/sdl.h +++ b/backends/platform/sdl/sdl.h @@ -38,7 +38,7 @@ class DiscordPresence; #endif // ResidualVM - Start #ifdef USE_OPENGL -#include "backends/graphics/openglsdl/openglsdl-graphics.h" +#include "backends/graphics/resvmopenglsdl/resvmopenglsdl-graphics.h" #endif // ResidualVM - End @@ -137,7 +137,7 @@ protected: // Graphics capabilities void detectFramebufferSupport(); void detectAntiAliasingSupport(); - OpenGLSdlGraphicsManager::Capabilities _capabilities; + ResVmOpenGLSdlGraphicsManager::Capabilities _capabilities; #endif // End of ResidualVM specific code