aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/openglsdl/openglsdl-graphics.h
blob: 309301c25af41fba4ff0c13aefa9430c68f12d10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/* ScummVM - Graphic Adventure Engine
 *
 * ScummVM is the legal property of its developers, whose names
 * are too numerous to list here. Please refer to the COPYRIGHT
 * file distributed with this source distribution.
 *
 * This program is free software; you can redistribute it and/or
 * 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.
 *
 * $URL$
 * $Id$
 *
 */

#ifndef BACKENDS_GRAPHICS_OPENGLSDL_H
#define BACKENDS_GRAPHICS_OPENGLSDL_H

#include "backends/platform/sdl/sdl-sys.h"
#if defined(ARRAYSIZE) && !defined(_WINDOWS_)
#undef ARRAYSIZE
#endif

#include "backends/graphics/opengl/opengl-graphics.h"

/**
 * SDL OpenGL graphics manager
 */
class OpenGLSdlGraphicsManager : public OpenGLGraphicsManager {
public:
	OpenGLSdlGraphicsManager();
	virtual ~OpenGLSdlGraphicsManager();

	virtual bool hasFeature(OSystem::Feature f);
	virtual void setFeatureState(OSystem::Feature f, bool enable);

#ifdef USE_RGB_COLOR
	virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
#endif

	virtual bool notifyEvent(const Common::Event &event);

	virtual void updateScreen();

protected:
	virtual void internUpdateScreen();

	virtual bool loadGFXMode();
	virtual void unloadGFXMode();

	virtual void setFullscreenMode(bool enable);

	virtual bool isHotkey(const Common::Event &event);

#ifdef USE_RGB_COLOR
	Common::List<Graphics::PixelFormat> _supportedFormats;

	/**
	 * Update the list of supported pixel formats.
	 * This method is invoked by loadGFXMode().
	 */
	void detectSupportedFormats();
#endif

	/**
	 * Toggles fullscreen.
	 * @loop loop direction for switching fullscreen mode, if 0 toggles it.
	 */
	virtual void toggleFullScreen(int loop);

	/**
	 * Setup the fullscreen mode.
	 * @return false if failed finding a mode, true otherwise.
	 */
	virtual bool setupFullscreenMode();

	virtual void setInternalMousePosition(int x, int y);

	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
};

#endif