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

Game.LambdaHack.Client.UI.SlideshowM

Description

Monadic operations on slideshows and related data.

Synopsis

Documentation

overlayToSlideshow :: MonadClientUI m => Int -> [KM] -> OKX -> m Slideshow Source #

Add current report to the overlay, split the result and produce, possibly, many slides.

reportToSlideshow :: MonadClientUI m => [KM] -> m Slideshow Source #

Split current report into a slideshow.

reportToSlideshowKeepHalt :: MonadClientUI m => Bool -> [KM] -> m Slideshow Source #

Split current report into a slideshow. Keep report unchanged. Assume the game either halts waiting for a key after this is shown, or many slides are produced, all but the last are displayed with player promts between and the last is either shown in full or ignored if inside macro (can be recovered from history, if important). Unless the prompts interrupt the macro, which is as well.

displaySpaceEsc :: MonadClientUI m => ColorMode -> Text -> m Bool Source #

Display a message. Return value indicates if the player wants to continue. Feature: if many pages, only the last SPACE exits (but first ESC).

displayMore :: MonadClientUI m => ColorMode -> Text -> m () Source #

Display a message. Ignore keypresses. Feature: if many pages, only the last SPACE exits (but first ESC).

displayYesNo :: MonadClientUI m => ColorMode -> Text -> m Bool Source #

Print a yes/no question and return the player's answer. Use black and white colours to turn player's attention to the choice.

displayChoiceScreen :: forall m. MonadClientUI m => String -> ColorMode -> Bool -> Slideshow -> [KM] -> m KeyOrSlot Source #

Display a, potentially, multi-screen menu and return the chosen key or item slot label (and save the index in the whole menu so that the cursor can again be placed at that spot next time menu is displayed).

This function is one of only two sources of menus and so, effectively, UI modes.

displayChoiceScreenWithRightPane :: forall m. MonadClientUI m => (KeyOrSlot -> m OKX) -> String -> ColorMode -> Bool -> Slideshow -> [KM] -> m KeyOrSlot Source #

Display a, potentially, multi-screen menu and return the chosen key or item slot label (and save the index in the whole menu so that the cursor can again be placed at that spot next time menu is displayed). Additionally, display something on the right half of the screen, depending on which menu item is currently highlighted

This function is one of only two sources of menus and so, effectively, UI modes.

Internal operations

saveMenuIx :: MonadClientUI m => String -> Int -> Int -> m () Source #

stepChoiceScreen :: forall m. MonadClientUI m => String -> ColorMode -> Bool -> Slideshow -> [KM] -> m (Int, Int, Int, Int -> OKX -> m (Bool, KeyOrSlot, Int)) Source #

This is one step of UI menu management user session.

There is limited looping involved to return a changed position in the menu each time so that the surrounding code has anything interesting to do. The exception is when finally confirming a selection, in which case it's usually not changed compared to last step, but it's presented differently to indicate it was confirmed.

Any extra keys in the OKX argument on top of the those in Slideshow argument need to be contained in the [K.KM] argument. Otherwise they are not accepted.

findKYX :: Int -> [OKX] -> Maybe (OKX, KYX, Int) Source #

Find a position in a menu. The arguments go from first menu line and menu page to the last, in order. Their indexing is from 0. We select the nearest item with the index equal or less to the pointer.