LambdaHack-0.8.3.0: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Client.UI.Key

Contents

Description

Frontend-independent keyboard input operations.

Synopsis

Documentation

data Key #

Frontend-independent datatype to represent keys.

Constructors

Esc 
Return 
Space 
Tab 
BackTab 
BackSpace 
PgUp 
PgDn 
Left 
Right 
Up 
Down 
End 
Begin 
Insert 
Delete 
PrintScreen 
Home 
KP Char

a keypad key for a character (digits and operators)

Char Char

a single printable character

Fun Int

function key

LeftButtonPress

left mouse button pressed

MiddleButtonPress

middle mouse button pressed

RightButtonPress

right mouse button pressed

LeftButtonRelease

left mouse button released

MiddleButtonRelease

middle mouse button released

RightButtonRelease

right mouse button released

WheelNorth

mouse wheel rotated north

WheelSouth

mouse wheel rotated south

Unknown String

an unknown key, registered to warn the user

DeadKey 
Instances
Eq Key # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Methods

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

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

Ord Key # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Methods

compare :: Key -> Key -> Ordering #

(<) :: Key -> Key -> Bool #

(<=) :: Key -> Key -> Bool #

(>) :: Key -> Key -> Bool #

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

max :: Key -> Key -> Key #

min :: Key -> Key -> Key #

Generic Key # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Associated Types

type Rep Key :: * -> * #

Methods

from :: Key -> Rep Key x #

to :: Rep Key x -> Key #

Binary Key # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Methods

put :: Key -> Put #

get :: Get Key #

putList :: [Key] -> Put #

NFData Key # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Methods

rnf :: Key -> () #

type Rep Key # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

type Rep Key = D1 (MetaData "Key" "Game.LambdaHack.Client.UI.Key" "LambdaHack-0.8.3.0-1hn0NFDS4ux6qD3ggO7yse" False) ((((C1 (MetaCons "Esc" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "Return" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "Space" PrefixI False) (U1 :: * -> *))) :+: ((C1 (MetaCons "Tab" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "BackTab" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "BackSpace" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "PgUp" PrefixI False) (U1 :: * -> *)))) :+: (((C1 (MetaCons "PgDn" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "Left" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "Right" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "Up" PrefixI False) (U1 :: * -> *))) :+: ((C1 (MetaCons "Down" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "End" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "Begin" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "Insert" PrefixI False) (U1 :: * -> *))))) :+: ((((C1 (MetaCons "Delete" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "PrintScreen" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "Home" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "KP" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Char)))) :+: ((C1 (MetaCons "Char" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Char)) :+: C1 (MetaCons "Fun" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Int))) :+: (C1 (MetaCons "LeftButtonPress" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "MiddleButtonPress" PrefixI False) (U1 :: * -> *)))) :+: (((C1 (MetaCons "RightButtonPress" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "LeftButtonRelease" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "MiddleButtonRelease" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "RightButtonRelease" PrefixI False) (U1 :: * -> *))) :+: ((C1 (MetaCons "WheelNorth" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "WheelSouth" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "Unknown" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 String)) :+: C1 (MetaCons "DeadKey" PrefixI False) (U1 :: * -> *))))))

data Modifier #

Our own encoding of modifiers.

Constructors

NoModifier 
Shift 
Control 
Alt 
Instances
Eq Modifier # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Ord Modifier # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Show Modifier # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Generic Modifier # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Associated Types

type Rep Modifier :: * -> * #

Methods

from :: Modifier -> Rep Modifier x #

to :: Rep Modifier x -> Modifier #

Binary Modifier # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Methods

put :: Modifier -> Put #

get :: Get Modifier #

putList :: [Modifier] -> Put #

NFData Modifier # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Methods

rnf :: Modifier -> () #

type Rep Modifier # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

type Rep Modifier = D1 (MetaData "Modifier" "Game.LambdaHack.Client.UI.Key" "LambdaHack-0.8.3.0-1hn0NFDS4ux6qD3ggO7yse" False) ((C1 (MetaCons "NoModifier" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "Shift" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "Control" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "Alt" PrefixI False) (U1 :: * -> *)))

data KM #

Key and modifier.

Constructors

KM 

Fields

Instances
Eq KM # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Methods

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

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

Ord KM # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Methods

compare :: KM -> KM -> Ordering #

(<) :: KM -> KM -> Bool #

(<=) :: KM -> KM -> Bool #

(>) :: KM -> KM -> Bool #

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

max :: KM -> KM -> KM #

min :: KM -> KM -> KM #

Show KM # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Methods

showsPrec :: Int -> KM -> ShowS #

show :: KM -> String #

showList :: [KM] -> ShowS #

Generic KM # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Associated Types

type Rep KM :: * -> * #

Methods

from :: KM -> Rep KM x #

to :: Rep KM x -> KM #

Binary KM # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Methods

put :: KM -> Put #

get :: Get KM #

putList :: [KM] -> Put #

NFData KM # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

Methods

rnf :: KM -> () #

type Rep KM # 
Instance details

Defined in Game.LambdaHack.Client.UI.Key

type Rep KM = D1 (MetaData "KM" "Game.LambdaHack.Client.UI.Key" "LambdaHack-0.8.3.0-1hn0NFDS4ux6qD3ggO7yse" False) (C1 (MetaCons "KM" PrefixI True) (S1 (MetaSel (Just "modifier") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Modifier) :*: S1 (MetaSel (Just "key") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Key)))

data KMP #

Key, modifier and position of mouse pointer.

Constructors

KMP 

Fields

showKey :: Key -> String #

Common and terse names for keys.

showKM :: KM -> String #

Show a key with a modifier, if any.

upKM :: KM #

dirAllKey :: Bool -> Bool -> [Key] #

handleDir :: Bool -> Bool -> KM -> Maybe Vector #

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

moveBinding :: Bool -> Bool -> (Vector -> a) -> (Vector -> a) -> [(KM, a)] #

Binding of both sets of movement keys, vi and laptop.

mkKM :: String -> KM #

mkChar :: Char -> KM #

mkKP :: Char -> KM #

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.

See https://github.com/twobob/gtk-/blob/master/gdk/keyname-table.h

keyTranslateWeb :: String -> Bool -> Key #

Translate key from a Web API string description (https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key#Key_values) to our internal key type. To be used in web frontends. The argument says whether Shift is pressed.

Internal operations