HOpenGL Libraries (GLUT package)ContentsIndex
Graphics.UI.GLUT.GameMode
Portability portable
Stability experimental
Maintainer sven_panne@yahoo.com
Description

In addition to the functionality offered by fullScreen, GLUT offers an sub-API to change the screen resolution, color depth, and refresh rate of the display for a single full screen window. This mode of operation is called game mode, and is restricted in various ways: No pop-up menus are allowed for this full screen window, no other (sub-)windows can be created, and all other applications are hidden.

X Implementation Notes: Note that game mode is not fully supported in GLUT for X, it is essentially the same as using fullScreen, with the additional restrictions mentioned above.

Synopsis
data Capability'
= Width
| Height
| BitsPerPlane
| RefreshRate
| Num'
data CapabilityDescription' = Where' Capability' Relation CInt
initGameMode :: [CapabilityDescription'] -> IO ()
enterGameMode :: IO (Window, Bool)
leaveGameMode :: IO ()
type BitsPerPlane = CInt
type RefreshRate = CInt
data GameModeInfo = GameModeInfo WindowSize BitsPerPlane RefreshRate
getGameModeInfo :: IO (Maybe GameModeInfo)
isGameModeActive :: IO Bool
Documentation
data Capability'
Capabilities for initGameMode
Constructors
WidthWidth of the screen resolution in pixels
HeightHeight of the screen resolution in pixels
BitsPerPlaneColor depth of the screen in bits
RefreshRateRefresh rate in Hertz
Num'Match the Nth fram buffer configuration compatible with with the give capabilities (numbering starts at 1)
Instances
Eq Capability'
Ord Capability'
data CapabilityDescription'
A single capability description for initGameMode.
Constructors
Where' Capability' Relation CInt
Instances
Eq CapabilityDescription'
Ord CapabilityDescription'
initGameMode :: [CapabilityDescription'] -> IO ()

Set the game mode to be used when enterGameMode is called. It is described by a list of zero or more capability descriptions, which are translated into a set of criteria used to select the appropriate screen configuration. The criteria are matched in strict left to right order of precdence. That is, the first specified criterion (leftmost) takes precedence over the later criteria for non-exact criteria (IsGreaterThan, IsLessThan, etc.). Exact criteria (IsEqualTo, IsNotEqualTo) must match exactly so precedence is not relevant.

To determine which configuration will actually be tried by enterGameMode (if any), use getGameModeInfo.

Note that even for game mode previous calls to initDisplayModeor initDisplay will determine which buffers are available, if double buffering is used or not, etc.

enterGameMode :: IO (Window, Bool)

Enter game mode, trying to change resolution, refresh rate, etc., as specified by the last call to initGameMode. An identifier for the game mode window and a flag, indicating if the display mode actually changed, are returned. The game mode window is made the current window.

Re-entering game mode is allowed, the previous game mode window gets destroyed by this, and a new one is created.

X Implementation Notes: GLUT for X never changes the display mode, but simply creates a full screen window, requesting absolutely no decorations from the window manager.

leaveGameMode :: IO ()
Leave game mode, restoring the old display mode and destroying the game mode window.
type BitsPerPlane = CInt
The color depth of the screen, measured in bits (e.g. 8, 16, 24, 32, ...)
type RefreshRate = CInt
The refresh rate of the screen, measured in Hertz (e.g. 60, 75, 100, ...)
data GameModeInfo
Constructors
GameModeInfo WindowSize BitsPerPlane RefreshRate
getGameModeInfo :: IO (Maybe GameModeInfo)

Return Just the mode which would be tried by the next call to enterGameMode. Returns Nothing if the mode requested by the last call to initGameMode is not possible, in which case enterGameMode would simply create a full screen window using the current mode.

X Implementation Notes: GLUT for X will always return Nothing.

isGameModeActive :: IO Bool
Test whether game mode is active or not.
Produced by Haddock version 0.6