SYSTEM: Add side textures as a System feature

This commit is contained in:
Dries Harnie 2015-08-14 15:16:07 +02:00
parent 147ba6ecbb
commit 8fc79af213
4 changed files with 41 additions and 2 deletions

View file

@ -113,9 +113,12 @@ public:
virtual int16 getOverlayHeight() { return _overlayHeight; } virtual int16 getOverlayHeight() { return _overlayHeight; }
virtual int16 getOverlayWidth() { return _overlayWidth; } virtual int16 getOverlayWidth() { return _overlayWidth; }
void closeOverlay(); // ResidualVM specific method void closeOverlay(); // ResidualVM specific method
#ifdef SDL_BACKEND
/* Render the passed Surfaces besides the game texture.
* This is used for widescreen support in the Grim engine.
* Note: we must copy the Surfaces, as they are free()d after this call.
*/
virtual void setSideTextures(Graphics::Surface *left, Graphics::Surface *right); virtual void setSideTextures(Graphics::Surface *left, Graphics::Surface *right);
#endif
virtual bool showMouse(bool visible); virtual bool showMouse(bool visible);
virtual void warpMouse(int x, int y); virtual void warpMouse(int x, int y);

View file

@ -438,3 +438,17 @@ Common::TimerManager *OSystem_SDL::getTimerManager() {
return _timerManager; return _timerManager;
#endif #endif
} }
// ResidualVM specific code
bool OSystem_SDL::hasFeature(Feature f) {
if (f == kFeatureSideTextures)
return true;
return ModularBackend::hasFeature(f);
}
// ResidualVM specific code
void OSystem_SDL::suggestSideTextures(Graphics::Surface *left,
Graphics::Surface *right) {
SurfaceSdlGraphicsManager *ssgm = dynamic_cast<SurfaceSdlGraphicsManager *>(_graphicsManager);
ssgm->setSideTextures(left, right);
}

View file

@ -77,6 +77,11 @@ public:
virtual Audio::Mixer *getMixer(); virtual Audio::Mixer *getMixer();
virtual Common::TimerManager *getTimerManager(); virtual Common::TimerManager *getTimerManager();
// ResidualVM specific code
virtual bool hasFeature(Feature f);
// ResidualVM specific code
virtual void suggestSideTextures(Graphics::Surface *left,
Graphics::Surface *right) override;
protected: protected:
bool _inited; bool _inited;
bool _initedSDL; bool _initedSDL;

View file

@ -313,6 +313,8 @@ public:
//ResidualVM specific //ResidualVM specific
kFeatureOpenGL, kFeatureOpenGL,
kFeatureVirtControls, kFeatureVirtControls,
// Can side textures be rendered on the side for widescreen support?
kFeatureSideTextures,
/** /**
* The presence of this feature indicates whether the displayLogFile() * The presence of this feature indicates whether the displayLogFile()
@ -666,6 +668,21 @@ public:
virtual Graphics::PixelBuffer setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) = 0; virtual Graphics::PixelBuffer setupScreen(uint screenW, uint screenH, bool fullscreen, bool accel3d) = 0;
/**
* Suggest textures to render at the side of the game window.
* This enables eg. Grim to render the game in a widescreen format.
*
* The system must take a copy of the Surfaces, as they will be free()d
* automatically.
*
* !!! ResidualVM specific method: !!!
*
* @param left Texture to be used on the left
* @param height Texture to be used on the right
*/
virtual void suggestSideTextures(Graphics::Surface *left,
Graphics::Surface *right) {};
/** /**
* Returns the currently set virtual screen height. * Returns the currently set virtual screen height.
* @see initSize * @see initSize