LambdaHack-0.11.0.0: A game engine library for tactical squad ASCII roguelike dungeon crawlers
Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Client.UI

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.

This module is leaking quite a bit of implementation details for the sake of Game.LambdaHack.Client.LoopM. After multiplayer is enabled again and the new requirements sorted out, this should be redesigned and some code moved down the module hierarhy tree, exposing a smaller API here.

Synopsis

Querying the human player

queryUI :: (MonadClient m, MonadClientUI m) => m (Maybe RequestUI) Source #

Handle the move of a human player.

UI monad operations

class MonadClientRead m => MonadClientUI m where Source #

The monad that gives the client access to UI operations, but not to modifying client state, except for the client-side pointman (as opposed to pointman stores in faction data in main game state), which is more of a UI concept, but is shared with AI to be able to keep it when switching AI on/off and to save on typing.

UI session type

data SessionUI Source #

The information that is used across a human player playing session, including many consecutive games in a single session, including playing different teams. Some of it is saved, some is reset when a new playing session starts. Nothing is tied to a faction/team, but instead all to UI configuration and UI input and display history. An important component is the frontend session.

Constructors

SessionUI 

Fields

Instances

Instances details
Binary SessionUI Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.SessionUI

data ReqDelay Source #

Instances

Instances details
Eq ReqDelay Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.SessionUI

Updating UI state wrt game state changes

watchRespUpdAtomicUI :: MonadClientUI m => 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. Doesn't modify client state (except a few fields), but only client session (e.g., by displaying messages). This is enforced by types.

watchRespSfxAtomicUI :: MonadClientUI m => SfxAtomic -> m () Source #

Display special effects (text, animation) sent to the client. Don't modify client state (except a few fields), but only client session (e.g., by displaying messages). This is enforced by types.

Startup and initialization

data CCUI Source #

Operations for all UI content types, gathered together.

Constructors

CCUI 

data UIOptions Source #

Options that affect the UI of the client, specified in the config file. More documentation is in the default config file.

Instances

Instances details
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 :: Type -> Type #

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.11.0.0-inplace" '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 "uLeftHand") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "uChosenFontset") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "uAllFontsScale") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Double)) :*: (S1 ('MetaSel ('Just "uFullscreenMode") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 FullscreenMode) :*: S1 ('MetaSel ('Just "uhpWarningPercent") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))) :*: (((S1 ('MetaSel ('Just "uMsgWrapColumn") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 X) :*: S1 ('MetaSel ('Just "uHistoryMax") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)) :*: (S1 ('MetaSel ('Just "uMaxFps") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Double) :*: S1 ('MetaSel ('Just "uNoAnim") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool))) :*: ((S1 ('MetaSel ('Just "uOverrideCmdline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [String]) :*: S1 ('MetaSel ('Just "uFonts") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Text, FontDefinition)])) :*: (S1 ('MetaSel ('Just "uFontsets") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Text, FontSet)]) :*: S1 ('MetaSel ('Just "uMessageColors") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(String, Color)]))))))

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

Modify client options with UI options.

mkUIOptions :: RuleContent -> ClientOptions -> IO UIOptions Source #

Read and parse UI config file.

Assorted operations and types

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 => ScreenContent -> ClientOptions -> m ChanFrontend Source #

Initialize the frontend chosen by the player via client options.

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

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

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

Add a message to the current report.

data MsgClassShow Source #

Instances

Instances details
Bounded MsgClassShow Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Enum MsgClassShow Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Eq MsgClassShow Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Ord MsgClassShow Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Show MsgClassShow Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Generic MsgClassShow Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

Associated Types

type Rep MsgClassShow :: Type -> Type #

Binary MsgClassShow Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

MsgShared MsgClassShow Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

type Rep MsgClassShow Source # 
Instance details

Defined in Game.LambdaHack.Client.UI.Msg

type Rep MsgClassShow = D1 ('MetaData "MsgClassShow" "Game.LambdaHack.Client.UI.Msg" "LambdaHack-0.11.0.0-inplace" 'False) (((C1 ('MetaCons "MsgPromptGeneric" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgPromptFocus" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MsgPromptMention" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgPromptModify" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "MsgPromptActors" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgPromptItems" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "MsgPromptAction" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "MsgActionAlert" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MsgSpottedThreat" 'PrefixI 'False) (U1 :: Type -> Type)))))

Internal operations

stepQueryUI :: (MonadClient m, MonadClientUI m) => m (Maybe ReqUI) Source #

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