diff options
Diffstat (limited to 'backends/graphics/openglsdl/openglsdl-graphics.h')
| -rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.h | 132 | 
1 files changed, 62 insertions, 70 deletions
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.h b/backends/graphics/openglsdl/openglsdl-graphics.h index 1587183328..9934ca79e2 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.h +++ b/backends/graphics/openglsdl/openglsdl-graphics.h @@ -8,117 +8,109 @@   * modify it under the terms of the GNU General Public License   * as published by the Free Software Foundation; either version 2   * of the License, or (at your option) any later version. - + *   * This program is distributed in the hope that it will be useful,   * but WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   * GNU General Public License for more details. - + *   * You should have received a copy of the GNU General Public License   * along with this program; if not, write to the Free Software   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.   *   */ -#ifndef BACKENDS_GRAPHICS_OPENGLSDL_H -#define BACKENDS_GRAPHICS_OPENGLSDL_H +#ifndef BACKENDS_GRAPHICS_OPENGLSDL_OPENGLSDL_GRAPHICS_H +#define BACKENDS_GRAPHICS_OPENGLSDL_OPENGLSDL_GRAPHICS_H -#include "backends/platform/sdl/sdl-sys.h" -#if defined(ARRAYSIZE) && !defined(_WINDOWS_) -#undef ARRAYSIZE -#endif -#include "backends/graphics/sdl/sdl-graphics.h"  #include "backends/graphics/opengl/opengl-graphics.h" +#include "backends/graphics/sdl/sdl-graphics.h" +#include "backends/platform/sdl/sdl-sys.h" +#include "common/array.h"  #include "common/events.h" -/** - * SDL OpenGL graphics manager - */ -class OpenGLSdlGraphicsManager : public OpenGLGraphicsManager, public SdlGraphicsManager, public Common::EventObserver { +class OpenGLSdlGraphicsManager : public OpenGL::OpenGLGraphicsManager, public SdlGraphicsManager, public Common::EventObserver {  public: -	OpenGLSdlGraphicsManager(SdlEventSource *eventSource); +	OpenGLSdlGraphicsManager(uint desktopWidth, uint desktopHeight, SdlEventSource *eventSource);  	virtual ~OpenGLSdlGraphicsManager(); +	// GraphicsManager API +	virtual void activateManager(); +	virtual void deactivateManager(); +  	virtual bool hasFeature(OSystem::Feature f);  	virtual void setFeatureState(OSystem::Feature f, bool enable); +	virtual bool getFeatureState(OSystem::Feature f); + +	virtual bool setGraphicsMode(int mode); +	virtual void resetGraphicsScale();  #ifdef USE_RGB_COLOR  	virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;  #endif -	virtual void initEventObserver(); -	virtual bool notifyEvent(const Common::Event &event); -  	virtual void updateScreen(); -	// SdlGraphicsManager interface +	// EventObserver API +	virtual bool notifyEvent(const Common::Event &event); + +	// SdlGraphicsManager API  	virtual void notifyVideoExpose();  	virtual void notifyResize(const uint width, const uint height);  	virtual void transformMouseCoordinates(Common::Point &point);  	virtual void notifyMousePos(Common::Point mouse);  protected: -	virtual void internUpdateScreen(); +	virtual void setInternalMousePosition(int x, int y); -	virtual bool loadGFXMode(); -	virtual void unloadGFXMode(); -	virtual bool isHotkey(const Common::Event &event); +	virtual bool loadVideoMode(uint requestedWidth, uint requestedHeight, const Graphics::PixelFormat &format); +private: +	bool setupMode(uint width, uint height); -#ifdef USE_RGB_COLOR -	Common::List<Graphics::PixelFormat> _supportedFormats; +	uint32 _lastVideoModeLoad; +	SDL_Surface *_hwScreen; -	/** -	 * Update the list of supported pixel formats. -	 * This method is invoked by loadGFXMode(). -	 */ -	void detectSupportedFormats(); -#endif +	uint _lastRequestedWidth; +	uint _lastRequestedHeight; +	uint _graphicsScale; +	bool _ignoreLoadVideoMode; +	bool _gotResize; -	/** -	 * Toggles fullscreen. -	 * @loop loop direction for switching fullscreen mode, if 0 toggles it. -	 */ -	virtual void toggleFullScreen(int loop); +	bool _wantsFullScreen; +	uint _ignoreResizeEvents; -	int _activeFullscreenMode; +	struct VideoMode { +		VideoMode() : width(0), height(0) {} +		VideoMode(uint w, uint h) : width(w), height(h) {} -	/** -	 * Setup the fullscreen mode. -	 * @return false if failed finding a mode, true otherwise. -	 */ -	virtual bool setupFullscreenMode(); +		bool operator<(const VideoMode &right) const { +			if (width < right.width) { +				return true; +			} else if (width == right.width && height < right.height) { +				return true; +			} else { +				return false; +			} +		} -	virtual void setInternalMousePosition(int x, int y); +		bool operator==(const VideoMode &right) const { +			return width == right.width && height == right.height; +		} -	int _lastFullscreenModeWidth; -	int _lastFullscreenModeHeight; -	int _desktopWidth; -	int _desktopHeight; - -	// Hardware screen -	SDL_Surface *_hwscreen; - -	// If screen was resized by the user -	bool _screenResized; - -	// Ignore resize events for the number of updateScreen() calls. -	// Normaly resize events are user generated when resizing the window -	// from its borders, but in some cases a resize event can be generated -	// after a fullscreen change. -	int _ignoreResizeFrames; - -#ifdef USE_OSD -	/** -	 * Displays a mode change message in OSD -	 */ -	void displayModeChangedMsg(); - -	/** -	 * Displays a scale change message in OSD -	 */ -	void displayScaleChangedMsg(); -#endif +		bool operator!=(const VideoMode &right) const { +			return !(*this == right); +		} + +		uint width, height; +	}; +	typedef Common::Array<VideoMode> VideoModeArray; +	VideoModeArray _fullscreenVideoModes; + +	uint _desiredFullscreenWidth; +	uint _desiredFullscreenHeight; + +	virtual bool isHotkey(const Common::Event &event);  };  #endif  | 
