sdl2-2.5.5.0: Both high- and low-level bindings to the SDL library (version 2.0.6+).
Safe HaskellSafe-Inferred
LanguageHaskell2010

SDL.Input.Keyboard.Codes

Description

An enumeration of scancodes and keycodes, allowing you to pattern match on keyboard keys.

This module uses a relatively new GHC feature called PatternSynonyms in order to provide pattern matches over the underlying Scancode or Keycode. We do this so that you are also able to work with vendor-specific or otherwise unknown codes.

Synopsis

Scancodes

Scancodes are codes that correspond to the physical position of a key, independent of the current keyboard layout. Scancodes are meant to be layout-independent. Think of this as "the user pressed the Q key as it would be on a US QWERTY keyboard" regardless of whether this is actually a European keyboard or a Dvorak keyboard or whatever. The scancode is always the same key position. Scancode makes sense when you want key presses based on their location on a keyboard - for example, the traditional "WASD" layout used in first-person shooters.

newtype Scancode Source #

Constructors

Scancode 

Instances

Instances details
Data Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Scancode -> c Scancode Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Scancode Source #

toConstr :: Scancode -> Constr Source #

dataTypeOf :: Scancode -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Scancode) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Scancode) Source #

gmapT :: (forall b. Data b => b -> b) -> Scancode -> Scancode Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Scancode -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Scancode -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Scancode -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Scancode -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Scancode -> m Scancode Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Scancode -> m Scancode Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Scancode -> m Scancode Source #

Bounded Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Generic Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Associated Types

type Rep Scancode :: Type -> Type Source #

Read Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Show Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Eq Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Ord Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

FromNumber Scancode Word32 Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

ToNumber Scancode Word32 Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

type Rep Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

type Rep Scancode = D1 ('MetaData "Scancode" "SDL.Input.Keyboard.Codes" "sdl2-2.5.5.0-inplace" 'True) (C1 ('MetaCons "Scancode" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapScancode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word32)))

Keycode

Keycodes are layout-dependent codes, in that the code you receive can change for the same physical key depending on the users keyboard layout. Think of this as "the user pressed the key that is labelled Q on a specific keyboard." Keycode makes sense when you are anticipating the user to press either keys that match some mneumonic, or they are entering text.

newtype Keycode Source #

Constructors

Keycode 

Fields

Instances

Instances details
Data Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Keycode -> c Keycode Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Keycode Source #

toConstr :: Keycode -> Constr Source #

dataTypeOf :: Keycode -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Keycode) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Keycode) Source #

gmapT :: (forall b. Data b => b -> b) -> Keycode -> Keycode Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Keycode -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Keycode -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Keycode -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Keycode -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Keycode -> m Keycode Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Keycode -> m Keycode Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Keycode -> m Keycode Source #

Bounded Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Generic Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Associated Types

type Rep Keycode :: Type -> Type Source #

Read Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Show Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Eq Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Ord Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

FromNumber Keycode Int32 Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

ToNumber Keycode Int32 Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

type Rep Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

type Rep Keycode = D1 ('MetaData "Keycode" "SDL.Input.Keyboard.Codes" "sdl2-2.5.5.0-inplace" 'True) (C1 ('MetaCons "Keycode" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapKeycode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int32)))