sdl2-2.4.1.0: Both high- and low-level bindings to the SDL library (version 2.0.4+).

Safe HaskellSafe
LanguageHaskell2010

SDL.Input.Keyboard.Codes

Contents

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

Bounded Scancode Source # 
Eq Scancode Source # 
Data Scancode Source # 

Methods

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

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

toConstr :: Scancode -> Constr #

dataTypeOf :: Scancode -> DataType #

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

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

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

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

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

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

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

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

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

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

Ord Scancode Source # 
Read Scancode Source # 
Show Scancode Source # 
Generic Scancode Source # 

Associated Types

type Rep Scancode :: * -> * #

Methods

from :: Scancode -> Rep Scancode x #

to :: Rep Scancode x -> Scancode #

ToNumber Scancode Word32 Source # 
FromNumber Scancode Word32 Source # 
type Rep Scancode Source # 
type Rep Scancode = D1 * (MetaData "Scancode" "SDL.Input.Keyboard.Codes" "sdl2-2.4.1.0-GJ23ELiCVd1AQAhvhiAzSX" True) (C1 * (MetaCons "Scancode" PrefixI True) (S1 * (MetaSel (Just Symbol "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

Bounded Keycode Source # 
Eq Keycode Source # 

Methods

(==) :: Keycode -> Keycode -> Bool #

(/=) :: Keycode -> Keycode -> Bool #

Data Keycode Source # 

Methods

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

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

toConstr :: Keycode -> Constr #

dataTypeOf :: Keycode -> DataType #

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

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

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

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

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

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

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

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

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

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

Ord Keycode Source # 
Read Keycode Source # 
Show Keycode Source # 
Generic Keycode Source # 

Associated Types

type Rep Keycode :: * -> * #

Methods

from :: Keycode -> Rep Keycode x #

to :: Rep Keycode x -> Keycode #

ToNumber Keycode Int32 Source # 
FromNumber Keycode Int32 Source # 
type Rep Keycode Source # 
type Rep Keycode = D1 * (MetaData "Keycode" "SDL.Input.Keyboard.Codes" "sdl2-2.4.1.0-GJ23ELiCVd1AQAhvhiAzSX" True) (C1 * (MetaCons "Keycode" PrefixI True) (S1 * (MetaSel (Just Symbol "unwrapKeycode") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 * Int32)))