GLUT-2.7.0.16: 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 | Safe-Inferred
Language | Haskell2010

Graphics.UI.GLUT.DeviceControl

Description

GLUT offers some routines for controlling the key repeat and polling the joystick.

Synopsis

- data GlobalKeyRepeat
  - = GlobalKeyRepeatOff
  - | GlobalKeyRepeatOn
  - | GlobalKeyRepeatDefault
- globalKeyRepeat :: StateVar GlobalKeyRepeat
- data PerWindowKeyRepeat
  - = PerWindowKeyRepeatOff
  - | PerWindowKeyRepeatOn
- perWindowKeyRepeat :: StateVar PerWindowKeyRepeat
- forceJoystickCallback :: MonadIO m => m ()

# Documentation

data GlobalKeyRepeat Source #

The state of the global key repeat

Constructors

GlobalKeyRepeatOff |
GlobalKeyRepeatOn |
GlobalKeyRepeatDefault |

#### Instances

Instances details

Show GlobalKeyRepeat Source # |
Instance details Defined in Graphics.UI.GLUT.DeviceControl Methods showsPrec :: Int -> GlobalKeyRepeat -> ShowS Source # show :: GlobalKeyRepeat -> String Source # showList :: [GlobalKeyRepeat] -> ShowS Source #
Eq GlobalKeyRepeat Source # |
Instance details Defined in Graphics.UI.GLUT.DeviceControl Methods (==) :: GlobalKeyRepeat -> GlobalKeyRepeat -> Bool Source # (/=) :: GlobalKeyRepeat -> GlobalKeyRepeat -> Bool Source #
Ord GlobalKeyRepeat Source # |

Instance details

Defined in Graphics.UI.GLUT.DeviceControl

Methods

compare :: GlobalKeyRepeat -> GlobalKeyRepeat -> Ordering Source #

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

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

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

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

max :: GlobalKeyRepeat -> GlobalKeyRepeat -> GlobalKeyRepeat Source #

min :: GlobalKeyRepeat -> GlobalKeyRepeat -> GlobalKeyRepeat Source #

globalKeyRepeat :: StateVar GlobalKeyRepeat Source #

Controls the key repeat mode for the window system on a global basis if possible. If supported by the window system, the key repeat can either be disabled, enabled, or set to the window system's default key repeat state.

X Implementation Notes: X11 sends `KeyPress` events repeatedly when the window system's global auto repeat is enabled. `perWindowKeyRepeat` can prevent these auto repeated keystrokes from being reported as keyboard or special callbacks, but there is still some minimal overhead by the X server to continually stream `KeyPress` events to the GLUT application. The `globalKeyRepeat` state variable can be used to actually disable the global sending of auto repeated `KeyPress` events. Note that `globalKeyRepeat` affects the global window system auto repeat state so other applications will not auto repeat if you disable auto repeat globally through `globalKeyRepeat`. GLUT applications using the X11 GLUT implementation should disable key repeat with `globalKeyRepeat` to disable key repeats most efficiently, but are responsible for explicitly restoring the default key repeat state on exit.

Win32 Implementation Notes: The Win32 implementation of `globalKeyRepeat` does nothing. The `perWindowKeyRepeat` can be used in the Win32 GLUT implementation to ignore repeated keys on a per-window basis without changing the global window system key repeat.

data PerWindowKeyRepeat Source #

The state of the per-window key repeat

Constructors

PerWindowKeyRepeatOff |
PerWindowKeyRepeatOn |

#### Instances

Instances details

Show PerWindowKeyRepeat Source # |
Instance details Defined in Graphics.UI.GLUT.DeviceControl Methods showsPrec :: Int -> PerWindowKeyRepeat -> ShowS Source # show :: PerWindowKeyRepeat -> String Source # showList :: [PerWindowKeyRepeat] -> ShowS Source #
Eq PerWindowKeyRepeat Source # |
Instance details Defined in Graphics.UI.GLUT.DeviceControl Methods (==) :: PerWindowKeyRepeat -> PerWindowKeyRepeat -> Bool Source # (/=) :: PerWindowKeyRepeat -> PerWindowKeyRepeat -> Bool Source #
Ord PerWindowKeyRepeat Source # |

Instance details

Defined in Graphics.UI.GLUT.DeviceControl

Methods

compare :: PerWindowKeyRepeat -> PerWindowKeyRepeat -> Ordering Source #

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

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

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

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

max :: PerWindowKeyRepeat -> PerWindowKeyRepeat -> PerWindowKeyRepeat Source #

min :: PerWindowKeyRepeat -> PerWindowKeyRepeat -> PerWindowKeyRepeat Source #

perWindowKeyRepeat :: StateVar PerWindowKeyRepeat Source #

Controls if auto repeat keystrokes are reported to the current window. Ignoring auto repeated keystrokes is generally done in conjunction with using the `keyboardMouseCallback`. If you do not ignore auto repeated keystrokes, your GLUT application will experience repeated release/press callbacks. Games using the keyboard will typically want to ignore key repeat.

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

Execute the joystick callback set by `joystickCallback` once (if one exists). This is done in a synchronous fashion within the current context, i.e. when `forceJoystickCallback` returns, the callback will have already happened.