xref: /haiku/src/libs/glut/glutGameMode.h (revision 25a7b01d15612846f332751841da3579db313082)
1 /*
2  * Copyright 2010, Haiku Inc.
3  * Authors:
4  *		Philippe Houdoin <phoudoin %at% haiku-os %dot% org>
5  *
6  * Distributed under the terms of the MIT License.
7  */
8 #ifndef GLUT_GAME_MODE_H
9 #define GLUT_GAME_MODE_H
10 
11 #include <GL/glut.h>
12 #include <Screen.h>
13 
14 
15 /*!	All information needed for game mode and
16 	subwindows (handled as similarly as possible).
17 */
18 class GlutGameMode {
19 public:
20 				GlutGameMode();
21 	virtual		~GlutGameMode();
22 
23 	status_t	Set(const char* modeString);
24 
25 	status_t	Enter();
26 	status_t	Leave();
27 
IsActive()28 	bool		IsActive() const 				{ return fActive; }
29 	bool		IsPossible();
HasDisplayChanged()30 	bool		HasDisplayChanged() const		{ return fDisplayChanged; }
31 
Width()32 	int			Width() const					{ return fWidth; }
Height()33 	int			Height() const					{ return fHeight; }
PixelDepth()34 	int			PixelDepth() const				{ return fPixelDepth; }
RefreshRate()35 	int			RefreshRate() const				{ return fRefreshRate; }
36 
37 private:
38 	display_mode*	_FindMatchingMode();
39 
40 	static int		_CompareModes(const void* mode1, const void* mode2);
41 	static int		_GetModeRefreshRate(const display_mode* mode);
42 	static int		_GetModePixelDepth(const display_mode* mode);
43 
44 	bool			fActive;
45 	bool			fDisplayChanged;
46 	int				fWidth;
47 	int				fHeight;
48 	int				fPixelDepth;
49 	int				fRefreshRate;
50 	display_mode*	fModesList;
51 	uint32			fModesCount;
52 	display_mode	fOriginalMode;
53 	int				fGameModeWorkspace;
54 	display_mode	fCurrentMode;
55 	int				fGameModeWindow;
56 	int				fPreviousWindow;
57 
58 };
59 
60 #endif	// GLUT_GAME_MODE_H
61