GLUT-2.7.0.15: A binding for the OpenGL Utility Toolkit

Copyright | (c) Sven Panne 2002-2018
License | BSD3
Maintainer | Sven Panne <svenpanne@gmail.com>
Stability | stable
Portability | portable
Safe Haskell | None
Language | Haskell2010

Graphics.UI.GLUT.GameMode

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 the original GLUT for X, it is essentially the same as using `fullScreen`. The GLUT clone freeglut (see http://freeglut.sourceforge.net/) does not have this restriction.

Synopsis

- data GameModeCapability
  - = GameModeWidth
  - | GameModeHeight
  - | GameModeBitsPerPlane
  - | GameModeRefreshRate
  - | GameModeNum
- data GameModeCapabilityDescription = Where' GameModeCapability Relation Int
- gameModeCapabilities :: SettableStateVar [GameModeCapabilityDescription]
- enterGameMode :: MonadIO m => m (Window, Bool)
- leaveGameMode :: MonadIO m => m ()
- type BitsPerPlane = Int
- type RefreshRate = Int
- data GameModeInfo = GameModeInfo Size BitsPerPlane RefreshRate
- gameModeInfo :: GettableStateVar (Maybe GameModeInfo)
- gameModeActive :: GettableStateVar Bool

# Documentation

data GameModeCapability Source #

Capabilities for `gameModeCapabilities`

Constructors

GameModeWidth | Width of the screen resolution in pixels
GameModeHeight | Height of the screen resolution in pixels
GameModeBitsPerPlane | Color depth of the screen in bits
GameModeRefreshRate | Refresh rate in Hertz
GameModeNum | Match the Nth frame buffer configuration compatible with the given capabilities (numbering starts at 1)

Instances

Eq GameModeCapability Source # |
Instance details Defined in Graphics.UI.GLUT.GameMode Methods (==) :: GameModeCapability -> GameModeCapability -> Bool Source # (/=) :: GameModeCapability -> GameModeCapability -> Bool Source #
Ord GameModeCapability Source # |

Instance details

Defined in Graphics.UI.GLUT.GameMode

Methods

compare :: GameModeCapability -> GameModeCapability -> Ordering Source #

(<) :: GameModeCapability -> GameModeCapability -> Bool Source #

(<=) :: GameModeCapability -> GameModeCapability -> Bool Source #

(>) :: GameModeCapability -> GameModeCapability -> Bool Source #

(>=) :: GameModeCapability -> GameModeCapability -> Bool Source #

max :: GameModeCapability -> GameModeCapability -> GameModeCapability Source #

min :: GameModeCapability -> GameModeCapability -> GameModeCapability Source #

Show GameModeCapability Source # |
Instance details Defined in Graphics.UI.GLUT.GameMode Methods showsPrec :: Int -> GameModeCapability -> ShowS Source # show :: GameModeCapability -> String Source # showList :: [GameModeCapability] -> ShowS Source #

data GameModeCapabilityDescription Source #

A single capability description for `gameModeCapabilities`.

Constructors

Where' GameModeCapability Relation Int |

Instances

Eq GameModeCapabilityDescription Source # |
Instance details Defined in Graphics.UI.GLUT.GameMode Methods (==) :: GameModeCapabilityDescription -> GameModeCapabilityDescription -> Bool Source # (/=) :: GameModeCapabilityDescription -> GameModeCapabilityDescription -> Bool Source #
Ord GameModeCapabilityDescription Source # |

Instance details

Defined in Graphics.UI.GLUT.GameMode

Methods

compare :: GameModeCapabilityDescription -> GameModeCapabilityDescription -> Ordering Source #

(<) :: GameModeCapabilityDescription -> GameModeCapabilityDescription -> Bool Source #

(<=) :: GameModeCapabilityDescription -> GameModeCapabilityDescription -> Bool Source #

(>) :: GameModeCapabilityDescription -> GameModeCapabilityDescription -> Bool Source #

(>=) :: GameModeCapabilityDescription -> GameModeCapabilityDescription -> Bool Source #

max :: GameModeCapabilityDescription -> GameModeCapabilityDescription -> GameModeCapabilityDescription Source #

min :: GameModeCapabilityDescription -> GameModeCapabilityDescription -> GameModeCapabilityDescription Source #

Show GameModeCapabilityDescription Source # |
Instance details Defined in Graphics.UI.GLUT.GameMode Methods showsPrec :: Int -> GameModeCapabilityDescription -> ShowS Source # show :: GameModeCapabilityDescription -> String Source # showList :: [GameModeCapabilityDescription] -> ShowS Source #

gameModeCapabilities :: SettableStateVar [GameModeCapabilityDescription] Source #

Controls 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 `gameModeInfo`.

Note that even for game mode the current values of `initialDisplayMode`or `initialDisplayCapabilities` will determine which buffers are available, if double buffering is used or not, etc.

enterGameMode :: MonadIO m => m (Window, Bool) Source #

Enter game mode, trying to change resolution, refresh rate, etc., as specified by the current value of `gameModeCapabilities`. 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.

leaveGameMode :: MonadIO m => m () Source #

Leave game mode, restoring the old display mode and destroying the game mode window.

type BitsPerPlane = Int Source #

The color depth of the screen, measured in bits (e.g. 8, 16, 24, 32, ...)

type RefreshRate = Int Source #

The refresh rate of the screen, measured in Hertz (e.g. 60, 75, 100, ...)

data GameModeInfo Source #

Constructors

GameModeInfo Size BitsPerPlane RefreshRate |

Instances

Eq GameModeInfo Source # |
Instance details Defined in Graphics.UI.GLUT.GameMode Methods (==) :: GameModeInfo -> GameModeInfo -> Bool Source # (/=) :: GameModeInfo -> GameModeInfo -> Bool Source #
Ord GameModeInfo Source # |

Instance details

Defined in Graphics.UI.GLUT.GameMode

Methods

compare :: GameModeInfo -> GameModeInfo -> Ordering Source #

(<) :: GameModeInfo -> GameModeInfo -> Bool Source #

(<=) :: GameModeInfo -> GameModeInfo -> Bool Source #

(>) :: GameModeInfo -> GameModeInfo -> Bool Source #

(>=) :: GameModeInfo -> GameModeInfo -> Bool Source #

max :: GameModeInfo -> GameModeInfo -> GameModeInfo Source #

min :: GameModeInfo -> GameModeInfo -> GameModeInfo Source #

Show GameModeInfo Source # |
Instance details Defined in Graphics.UI.GLUT.GameMode Methods showsPrec :: Int -> GameModeInfo -> ShowS Source # show :: GameModeInfo -> String Source # showList :: [GameModeInfo] -> ShowS Source #

gameModeInfo :: GettableStateVar (Maybe GameModeInfo) Source #

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

gameModeActive :: GettableStateVar Bool Source #

Contains `True` when the game mode is active, `False` otherwise.