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.SlideshowM

Contents

- Internal operations

Description

Monadic operations on slideshows and related data.

Synopsis

- overlayToSlideshow :: MonadClientUI m => Int -> [KM] -> OKX -> m Slideshow
- reportToSlideshow :: MonadClientUI m => [KM] -> m Slideshow
- reportToSlideshowKeepHalt :: MonadClientUI m => Bool -> [KM] -> m Slideshow
- displaySpaceEsc :: MonadClientUI m => ColorMode -> Text -> m Bool
- displayMore :: MonadClientUI m => ColorMode -> Text -> m ()
- displayMoreKeep :: MonadClientUI m => ColorMode -> Text -> m ()
- displayYesNo :: MonadClientUI m => ColorMode -> Text -> m Bool
- getConfirms :: MonadClientUI m => ColorMode -> [KM] -> Slideshow -> m KM
- displayChoiceScreen :: MonadClientUI m => String -> ColorMode -> Bool -> Slideshow -> [KM] -> m KeyOrSlot
- displayChoiceScreenWithRightPane :: MonadClientUI m => (KeyOrSlot -> m OKX) -> Bool -> String -> ColorMode -> Bool -> Slideshow -> [KM] -> m KeyOrSlot
- displayChoiceScreenWithDefItemKey :: MonadClientUI m => (Int -> MenuSlot -> m OKX) -> Slideshow -> [KM] -> String -> m KeyOrSlot
- displayChoiceScreenWithRightPaneKMKM :: MonadClientUI m => (KeyOrSlot -> m OKX) -> Bool -> String -> ColorMode -> Bool -> Slideshow -> [KM] -> m (Either (KM, KeyOrSlot) MenuSlot)
- pushFrame :: MonadClientUI m => Bool -> m ()
- pushReportFrame :: MonadClientUI m => m ()
- getMenuIx :: MonadClientUI m => String -> Int -> Int -> Int -> m Int
- saveMenuIx :: MonadClientUI m => String -> Int -> Int -> m ()
- stepChoiceScreen :: MonadClientUI m => Bool -> ColorMode -> Bool -> Slideshow -> [KM] -> m (Int, Int, Int, Int -> OKX -> m (Bool, Either (KM, KeyOrSlot) MenuSlot, Int))
- navigationKeys :: [KM]
- findKYX :: Int -> [OKX] -> Maybe (OKX, KYX, Int)
- drawHighlight :: Int -> ButtonWidth -> Int -> AttrString -> AttrString
- basicFrameWithoutReport :: MonadClientUI m => LevelId -> Maybe Bool -> m PreFrame3

# 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).

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

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.

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

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

Display a, potentially, multi-screen menu and return the chosen key or menu slot (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 :: MonadClientUI m => (KeyOrSlot -> m OKX) -> Bool -> String -> ColorMode -> Bool -> Slideshow -> [KM] -> m KeyOrSlot Source #

Display a, potentially, multi-screen menu and return the chosen key or menu slot (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.

displayChoiceScreenWithDefItemKey :: MonadClientUI m => (Int -> MenuSlot -> m OKX) -> Slideshow -> [KM] -> String -> m KeyOrSlot Source #

A specialized variant of `displayChoiceScreenWithRightPane`.

displayChoiceScreenWithRightPaneKMKM :: MonadClientUI m => (KeyOrSlot -> m OKX) -> Bool -> String -> ColorMode -> Bool -> Slideshow -> [KM] -> m (Either (KM, KeyOrSlot) MenuSlot) Source #

A variant providing for a keypress the information about the label of the menu slot which was selected during the keypress.

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

Push the frame depicting the current level to the frame queue. Only one line of the report is shown, as in animations, because it may not be our turn, so we can't clear the message to see what is underneath.

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

# Internal operations

getMenuIx :: MonadClientUI m => String -> Int -> Int -> Int -> m Int Source #

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

stepChoiceScreen :: MonadClientUI m => Bool -> ColorMode -> Bool -> Slideshow -> [KM] -> m (Int, Int, Int, Int -> OKX -> m (Bool, Either (KM, KeyOrSlot) MenuSlot, 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.

navigationKeys :: [KM] Source #

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.

drawHighlight :: Int -> ButtonWidth -> Int -> AttrString -> AttrString Source #

basicFrameWithoutReport :: MonadClientUI m => LevelId -> Maybe Bool -> m PreFrame3 Source #