LambdaHack-0.5.0.0: A game engine library for 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

Client UI monad

class MonadClient m => MonadClientUI m Source #

The monad that gives the client access to UI operations.

Minimal complete definition

getsSession, liftIO

Instances

Assorted UI operations

queryUI :: MonadClientUI m => m RequestUI Source #

Handle the move of a UI player.

pongUI :: MonadClientUI m => m RequestUI Source #

Client signals to the server that it's still online, flushes frames (if needed) and sends some extra info.

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

Visualize atomic actions 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

srtFrontend Source #

Arguments

:: (DebugModeCli -> SessionUI -> State -> StateClient -> chanServerUI -> IO ())

UI main loop

-> (DebugModeCli -> SessionUI -> State -> StateClient -> chanServerAI -> IO ())

AI main loop

-> KeyKind

key and command content

-> COps

game content

-> DebugModeCli

client debug parameters

-> ((FactionId -> chanServerUI -> IO ()) -> (FactionId -> chanServerAI -> IO ()) -> IO ())

frontend main loop

-> IO () 

Wire together game content, the main loops of game clients, the main game loop assigned to this frontend (possibly containing the server loop, if the whole game runs in one process), UI config and the definitions of game commands.

data KeyKind Source #

Key-command mappings to be used for the UI.

data SessionUI Source #

The information that is constant across a client playing session, including many consecutive games in a single session, but is completely disregarded and reset when a new playing session starts. This includes a frontend session and keybinding info.

Operations exposed for LoopClient

data ColorMode Source #

Color mode for the display.

Constructors

ColorFull

normal, with full colours

ColorBW

black+white only

displayMore :: MonadClientUI m => ColorMode -> Msg -> m Bool Source #

Display a message with a -more- prompt. Return value indicates if the player tried to cancel/escape.

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

Add a message to the current report.

Internal operations

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

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