sdl2-2.5.2.0: Both high- and low-level bindings to the SDL library (version 2.0.6+).
Safe HaskellSafe
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 

Fields

Instances

Instances details
Bounded Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Eq Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

(==) :: Scancode -> Scancode -> Bool

(/=) :: Scancode -> Scancode -> Bool

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

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 :: forall r r'. (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 # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

compare :: Scancode -> Scancode -> Ordering

(<) :: Scancode -> Scancode -> Bool

(<=) :: Scancode -> Scancode -> Bool

(>) :: Scancode -> Scancode -> Bool

(>=) :: Scancode -> Scancode -> Bool

max :: Scancode -> Scancode -> Scancode

min :: Scancode -> Scancode -> Scancode

Read Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

readsPrec :: Int -> ReadS Scancode

readList :: ReadS [Scancode]

readPrec :: ReadPrec Scancode

readListPrec :: ReadPrec [Scancode]

Show Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

showsPrec :: Int -> Scancode -> ShowS

show :: Scancode -> String

showList :: [Scancode] -> ShowS

Generic Scancode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Associated Types

type Rep Scancode :: Type -> Type

Methods

from :: Scancode -> Rep Scancode x

to :: Rep Scancode x -> Scancode

ToNumber Scancode Word32 Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

toNumber :: Scancode -> Word32 Source #

FromNumber Scancode Word32 Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

fromNumber :: Word32 -> Scancode Source #

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.2.0-Cx4Ipj2keSJFpflqvJYEGr" '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
Bounded Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Eq Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

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

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

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

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 :: forall r r'. (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 # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

compare :: Keycode -> Keycode -> Ordering

(<) :: Keycode -> Keycode -> Bool

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

(>) :: Keycode -> Keycode -> Bool

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

max :: Keycode -> Keycode -> Keycode

min :: Keycode -> Keycode -> Keycode

Read Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

readsPrec :: Int -> ReadS Keycode

readList :: ReadS [Keycode]

readPrec :: ReadPrec Keycode

readListPrec :: ReadPrec [Keycode]

Show Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

showsPrec :: Int -> Keycode -> ShowS

show :: Keycode -> String

showList :: [Keycode] -> ShowS

Generic Keycode Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Associated Types

type Rep Keycode :: Type -> Type

Methods

from :: Keycode -> Rep Keycode x

to :: Rep Keycode x -> Keycode

ToNumber Keycode Int32 Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

toNumber :: Keycode -> Int32 Source #

FromNumber Keycode Int32 Source # 
Instance details

Defined in SDL.Input.Keyboard.Codes

Methods

fromNumber :: Int32 -> Keycode Source #

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.2.0-Cx4Ipj2keSJFpflqvJYEGr" 'True) (C1 ('MetaCons "Keycode" 'PrefixI 'True) (S1 ('MetaSel ('Just "unwrapKeycode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int32)))