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

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Client.UI

Contents

Description

Ways for the client to use player input via UI to produce server requests, based on the client's view (visualized for the player) of the game state.

Synopsis

Querying the human player

queryUI :: MonadClientUI m => m RequestUI Source #

Handle the move of a human player.

UI monad and session type

class MonadClient m => MonadClientUI m where Source #

The monad that gives the client access to UI operations.

Minimal complete definition

getsSession, modifySession, liftIO

Methods

getsSession :: (SessionUI -> a) -> m a Source #

modifySession :: (SessionUI -> SessionUI) -> m () Source #

liftIO :: IO a -> m a Source #

data SessionUI Source #

The information that is used across a client playing session, including many consecutive games in a single session. Some of it is saved, some is reset when a new playing session starts. An important component is the frontend session.

Constructors

SessionUI 

Fields

Instances
Binary SessionUI Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.SessionUI

Updating UI state wrt game state changes

displayRespUpdAtomicUI :: MonadClientUI m => Bool -> UpdAtomic -> m () Source #

Visualize atomic updates sent to the client. This is done in the global state after the command is executed and after the client state is modified by the command.

displayRespSfxAtomicUI :: MonadClientUI m => Bool -> SfxAtomic -> m () Source #

Display special effects (text, animation) sent to the client.

Startup and initialization

data KeyKind Source #

Key-command mappings to be specified in content and used for the UI.

data UIOptions Source #

Options that affect the UI of the client.

Instances
Show UIOptions Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.UIOptions

Generic UIOptions Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.UIOptions

Associated Types

type Rep UIOptions :: * -> * #

Binary UIOptions Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.UIOptions

NFData UIOptions Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.UIOptions

Methods

rnf :: UIOptions -> () #

type Rep UIOptions Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.UIOptions

type Rep UIOptions = D1 (MetaData "UIOptions" "Game.LambdaHack.Client.UI.UIOptions" "LambdaHack-0.8.1.2-9Fmfvbfsr9xEInnejydwaW" False) (C1 (MetaCons "UIOptions" PrefixI True) ((((S1 (MetaSel (Just "uCommands") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 [(KM, CmdTriple)]) :*: S1 (MetaSel (Just "uHeroNames") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 [(Int, (Text, Text))])) :*: (S1 (MetaSel (Just "uVi") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Bool) :*: S1 (MetaSel (Just "uLaptop") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Bool))) :*: ((S1 (MetaSel (Just "uGtkFontFamily") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Text) :*: S1 (MetaSel (Just "uSdlFontFile") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Text)) :*: (S1 (MetaSel (Just "uSdlTtfSizeAdd") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Int) :*: S1 (MetaSel (Just "uSdlFonSizeAdd") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Int)))) :*: (((S1 (MetaSel (Just "uFontSize") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Int) :*: S1 (MetaSel (Just "uColorIsBold") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Bool)) :*: (S1 (MetaSel (Just "uHistoryMax") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Int) :*: S1 (MetaSel (Just "uMaxFps") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Int))) :*: ((S1 (MetaSel (Just "uNoAnim") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Bool) :*: S1 (MetaSel (Just "uRunStopMsgs") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Bool)) :*: (S1 (MetaSel (Just "uhpWarningPercent") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 Int) :*: S1 (MetaSel (Just "uCmdline") NoSourceUnpackedness NoSourceStrictness DecidedStrict) (Rec0 [String]))))))

applyUIOptions :: COps -> UIOptions -> ClientOptions -> ClientOptions Source #

Modify client options with UI options.

uCmdline :: UIOptions -> [String] Source #

Hardwired commandline arguments to process.

mkUIOptions :: COps -> Bool -> IO UIOptions Source #

Read and parse UI config file.

Operations exposed for Game.LambdaHack.Client.LoopM

data ChanFrontend Source #

Connection channel between a frontend and a client. Frontend acts as a server, serving keys, etc., when given frames to display.

chanFrontend :: MonadClientUI m => ClientOptions -> m ChanFrontend Source #

Initialize the frontend chosen by the player via client options.

msgAdd :: MonadClientUI m => Text -> m () Source #

Add a message to the current report. Do not report if it was a duplicate.

tryRestore :: MonadClientUI m => m (Maybe (StateClient, Maybe SessionUI)) Source #

Try to read saved client game state from the file system.

stdBinding Source #

Arguments

:: KeyKind

default key bindings from the content

-> UIOptions

UI client options

-> Binding

concrete binding

Create binding of keys to movement and other standard commands, as well as commands defined in the config file.

Internal operations

humanCommand :: forall m. MonadClientUI m => m ReqUI Source #

Let the human player issue commands until any command takes time.