LambdaHack-0.2.10: A roguelike game engine in early and active development

Safe HaskellNone

Game.LambdaHack.Common.Key

Description

Frontend-independent keyboard input operations.

Synopsis

Documentation

data Key

Frontend-independent datatype to represent keys.

Constructors

Esc 
Return 
Space 
Tab 
BackTab 
PgUp 
PgDn 
Left 
Right 
Up 
Down 
End 
Begin 
Home 
KP !Char

a keypad key for a character (digits and operators)

Char !Char

a single printable character

Unknown !Text

an unknown key, registered to warn the user

Instances

Eq Key 
Ord Key 
Binary Key 

handleDir :: X -> KM -> (Vector -> a) -> a -> a

Configurable event handler for the direction keys. Used for directed commands such as close door.

moveBinding :: (VectorXY -> a) -> (VectorXY -> a) -> [(KM, a)]

Binding of both sets of movement keys.

keyTranslate :: String -> Key

Translate key from a GTK string description to our internal key type. To be used, in particular, for the command bindings and macros in the config file.

data Modifier

Our own encoding of modifiers. Incomplete.

Constructors

NoModifier 
Control 

Instances

data KM

Constructors

KM 

Fields

modifier :: !Modifier
 
key :: !Key
 

Instances

Eq KM 
Ord KM 
Show KM 
Binary KM 

showKM :: KM -> Text

Show a key with a modifier, if any.