SDL: Do not require a static graphics mode list in OpenGL and SurfaceSDL.
This commit is contained in:
parent
a9cb67df08
commit
d34c9d5bcb
5 changed files with 10 additions and 18 deletions
|
@ -122,10 +122,6 @@ const OSystem::GraphicsMode glGraphicsModes[] = {
|
||||||
|
|
||||||
} // End of anonymous namespace
|
} // End of anonymous namespace
|
||||||
|
|
||||||
const OSystem::GraphicsMode *OpenGLGraphicsManager::supportedGraphicsModes() {
|
|
||||||
return glGraphicsModes;
|
|
||||||
}
|
|
||||||
|
|
||||||
const OSystem::GraphicsMode *OpenGLGraphicsManager::getSupportedGraphicsModes() const {
|
const OSystem::GraphicsMode *OpenGLGraphicsManager::getSupportedGraphicsModes() const {
|
||||||
return glGraphicsModes;
|
return glGraphicsModes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,10 +57,6 @@ public:
|
||||||
virtual void setFeatureState(OSystem::Feature f, bool enable);
|
virtual void setFeatureState(OSystem::Feature f, bool enable);
|
||||||
virtual bool getFeatureState(OSystem::Feature f);
|
virtual bool getFeatureState(OSystem::Feature f);
|
||||||
|
|
||||||
// HACK: This is required for the SDL backend to switch between OpenGL SDL
|
|
||||||
// and Surface SDL.
|
|
||||||
static const OSystem::GraphicsMode *supportedGraphicsModes();
|
|
||||||
|
|
||||||
virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
|
virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
|
||||||
virtual int getDefaultGraphicsMode() const;
|
virtual int getDefaultGraphicsMode() const;
|
||||||
virtual bool setGraphicsMode(int mode);
|
virtual bool setGraphicsMode(int mode);
|
||||||
|
|
|
@ -262,10 +262,6 @@ bool SurfaceSdlGraphicsManager::getFeatureState(OSystem::Feature f) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const OSystem::GraphicsMode *SurfaceSdlGraphicsManager::supportedGraphicsModes() {
|
|
||||||
return s_supportedGraphicsModes;
|
|
||||||
}
|
|
||||||
|
|
||||||
const OSystem::GraphicsMode *SurfaceSdlGraphicsManager::getSupportedGraphicsModes() const {
|
const OSystem::GraphicsMode *SurfaceSdlGraphicsManager::getSupportedGraphicsModes() const {
|
||||||
return s_supportedGraphicsModes;
|
return s_supportedGraphicsModes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,6 @@ public:
|
||||||
virtual void setFeatureState(OSystem::Feature f, bool enable);
|
virtual void setFeatureState(OSystem::Feature f, bool enable);
|
||||||
virtual bool getFeatureState(OSystem::Feature f);
|
virtual bool getFeatureState(OSystem::Feature f);
|
||||||
|
|
||||||
static const OSystem::GraphicsMode *supportedGraphicsModes();
|
|
||||||
virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
|
virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
|
||||||
virtual int getDefaultGraphicsMode() const;
|
virtual int getDefaultGraphicsMode() const;
|
||||||
virtual bool setGraphicsMode(int mode);
|
virtual bool setGraphicsMode(int mode);
|
||||||
|
|
|
@ -651,21 +651,26 @@ void OSystem_SDL::setupGraphicsModes() {
|
||||||
_graphicsModes.clear();
|
_graphicsModes.clear();
|
||||||
_graphicsModeIds.clear();
|
_graphicsModeIds.clear();
|
||||||
|
|
||||||
const OSystem::GraphicsMode *sdlGraphicsModes = SurfaceSdlGraphicsManager::supportedGraphicsModes();
|
|
||||||
const OSystem::GraphicsMode *openglGraphicsModes = OpenGLSdlGraphicsManager::supportedGraphicsModes();
|
|
||||||
|
|
||||||
// Count the number of graphics modes
|
// Count the number of graphics modes
|
||||||
const OSystem::GraphicsMode *srcMode = sdlGraphicsModes;
|
const OSystem::GraphicsMode *srcMode;
|
||||||
|
|
||||||
|
GraphicsManager *manager = new SurfaceSdlGraphicsManager(_eventSource);
|
||||||
|
srcMode = manager->getSupportedGraphicsModes();
|
||||||
while (srcMode->name) {
|
while (srcMode->name) {
|
||||||
_graphicsModes.push_back(*srcMode);
|
_graphicsModes.push_back(*srcMode);
|
||||||
srcMode++;
|
srcMode++;
|
||||||
}
|
}
|
||||||
|
delete manager;
|
||||||
|
|
||||||
_firstGLMode = _graphicsModes.size();
|
_firstGLMode = _graphicsModes.size();
|
||||||
srcMode = openglGraphicsModes;
|
manager = new OpenGLSdlGraphicsManager(_desktopWidth, _desktopHeight, _eventSource);
|
||||||
|
srcMode = manager->getSupportedGraphicsModes();
|
||||||
while (srcMode->name) {
|
while (srcMode->name) {
|
||||||
_graphicsModes.push_back(*srcMode);
|
_graphicsModes.push_back(*srcMode);
|
||||||
srcMode++;
|
srcMode++;
|
||||||
}
|
}
|
||||||
|
delete manager;
|
||||||
|
manager = nullptr;
|
||||||
|
|
||||||
// Set a null mode at the end
|
// Set a null mode at the end
|
||||||
GraphicsMode nullMode;
|
GraphicsMode nullMode;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue