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

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Client.UI.MonadClientUI

Contents

- Client UI monad
- Assorted primitives
- Internal operations

Description

Client monad for interacting with a human through UI.

Synopsis

- class MonadClientRead m => MonadClientUI (m :: Type -> Type) where
  - getsSession :: (SessionUI -> a) -> m a
  - modifySession :: (SessionUI -> SessionUI) -> m ()
  - updateClientLeader :: ActorId -> m ()
  - getCacheBfs :: ActorId -> m (Array BfsDistance)
  - getCachePath :: ActorId -> Point -> m (Maybe AndPath)
- clientPrintUI :: MonadClientUI m => Text -> m ()
- debugPossiblyPrintUI :: MonadClientUI m => Text -> m ()
- getSession :: MonadClientUI m => m SessionUI
- putSession :: MonadClientUI m => SessionUI -> m ()
- displayFrames :: MonadClientUI m => LevelId -> PreFrames3 -> m ()
- connFrontendFrontKey :: MonadClientUI m => [KM] -> PreFrame3 -> m KM
- setFrontAutoYes :: MonadClientUI m => Bool -> m ()
- frontendShutdown :: MonadClientUI m => m ()
- printScreen :: MonadClientUI m => m ()
- chanFrontend :: MonadClientUI m => ScreenContent -> ClientOptions -> m ChanFrontend
- anyKeyPressed :: MonadClientUI m => m Bool
- discardPressedKey :: MonadClientUI m => m ()
- resetPressedKeys :: MonadClientUI m => m ()
- revCmdMap :: MonadClientUI m => m (HumanCmd -> KM)
- getReportUI :: MonadClientUI m => Bool -> m Report
- getMiniHintAiming :: MonadClientUI m => m Text
- computeChosenLore :: MonadClientUI m => m ([(ActorId, Actor)], [(ItemId, ItemQuant)])
- getArenaUI :: MonadClientUI m => m LevelId
- viewedLevelUI :: MonadClientUI m => m LevelId
- mxhairToPos :: MonadClientUI m => m (Maybe Point)
- xhairToPos :: MonadClientUI m => m Point
- setXHairFromGUI :: MonadClientUI m => Maybe Target -> m ()
- clearAimMode :: MonadClientUI m => m ()
- getFontSetup :: MonadClientUI m => m FontSetup
- scoreToSlideshow :: MonadClientUI m => Int -> Status -> m Slideshow
- defaultHistory :: MonadClientUI m => m History
- tellAllClipPS :: MonadClientUI m => m ()
- tellGameClipPS :: MonadClientUI m => m ()
- elapsedSessionTimeGT :: MonadClientRead m => POSIXTime -> Int -> m Bool
- resetSessionStart :: MonadClientUI m => m ()
- resetGameStart :: MonadClientUI m => m ()
- partActorLeader :: MonadClientUI m => ActorId -> m Part
- partPronounLeader :: MonadClientUI m => ActorId -> m Part
- tryRestore :: MonadClientUI m => m (Maybe (StateClient, Maybe SessionUI))
- rndToActionUI :: MonadClientUI m => Rnd a -> m a
- tryOpenBrowser :: MonadClientUI m => String -> m Bool
- connFrontend :: MonadClientUI m => FrontReq a -> m a
- displayFrame :: MonadClientUI m => Maybe Frame -> m ()

# Client UI monad

class MonadClientRead m => MonadClientUI (m :: Type -> Type) 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.

Methods

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

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

updateClientLeader :: ActorId -> m () Source #

getCacheBfs :: ActorId -> m (Array BfsDistance) Source #

getCachePath :: ActorId -> Point -> m (Maybe AndPath) Source #

#### Instances

Instances details

MonadClientUI CliImplementation Source # |

Instance details

Defined in Implementation.MonadClientImplementation

Methods

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

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

updateClientLeader :: ActorId -> CliImplementation () Source #

getCacheBfs :: ActorId -> CliImplementation (Array BfsDistance) Source #

getCachePath :: ActorId -> Point -> CliImplementation (Maybe AndPath) Source #

# Assorted primitives

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

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

getSession :: MonadClientUI m => m SessionUI Source #

putSession :: MonadClientUI m => SessionUI -> m () Source #

displayFrames :: MonadClientUI m => LevelId -> PreFrames3 -> m () Source #

Push frames or delays to the frame queue. The frames depict the `lid` level.

connFrontendFrontKey :: MonadClientUI m => [KM] -> PreFrame3 -> m KM Source #

Write `FrontKey` UI request to the frontend, read the reply, set pointer, return key.

setFrontAutoYes :: MonadClientUI m => Bool -> m () Source #

frontendShutdown :: MonadClientUI m => m () Source #

printScreen :: MonadClientUI m => m () Source #

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

Initialize the frontend chosen by the player via client options.

anyKeyPressed :: MonadClientUI m => m Bool Source #

discardPressedKey :: MonadClientUI m => m () Source #

resetPressedKeys :: MonadClientUI m => m () Source #

revCmdMap :: MonadClientUI m => m (HumanCmd -> KM) Source #

getReportUI :: MonadClientUI m => Bool -> m Report Source #

getMiniHintAiming :: MonadClientUI m => m Text Source #

computeChosenLore :: MonadClientUI m => m ([(ActorId, Actor)], [(ItemId, ItemQuant)]) Source #

getArenaUI :: MonadClientUI m => m LevelId Source #

viewedLevelUI :: MonadClientUI m => m LevelId Source #

mxhairToPos :: MonadClientUI m => m (Maybe Point) Source #

xhairToPos :: MonadClientUI m => m Point Source #

setXHairFromGUI :: MonadClientUI m => Maybe Target -> m () Source #

clearAimMode :: MonadClientUI m => m () Source #

getFontSetup :: MonadClientUI m => m FontSetup Source #

scoreToSlideshow :: MonadClientUI m => Int -> Status -> m Slideshow Source #

defaultHistory :: MonadClientUI m => m History Source #

tellAllClipPS :: MonadClientUI m => m () Source #

tellGameClipPS :: MonadClientUI m => m () Source #

elapsedSessionTimeGT :: MonadClientRead m => POSIXTime -> Int -> m Bool Source #

resetSessionStart :: MonadClientUI m => m () Source #

resetGameStart :: MonadClientUI m => m () Source #

partActorLeader :: MonadClientUI m => ActorId -> m Part Source #

The part of speech describing the actor or the "you" pronoun if he is the leader of the observer's faction.

partPronounLeader :: MonadClientUI m => ActorId -> m Part Source #

The part of speech with the actor's pronoun or "you" if a leader of the client's faction.

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

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

rndToActionUI :: MonadClientUI m => Rnd a -> m a Source #

Invoke pseudo-random computation with the generator kept in the session.

tryOpenBrowser :: MonadClientUI m => String -> m Bool Source #

# Internal operations

connFrontend :: MonadClientUI m => FrontReq a -> m a Source #

Write a UI request to the frontend and read a corresponding reply.

displayFrame :: MonadClientUI m => Maybe Frame -> m () Source #