Copyright | Brent Yorgey |
---|---|
License | BSD-3-Clause |
Maintainer | byorgey@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Code for drawing the TUI.
Synopsis
- drawUI :: AppState -> [Widget Name]
- drawTPS :: AppState -> Widget Name
- drawDialog :: AppState -> Widget Name
- generateModal :: AppState -> ModalType -> Modal
- chooseCursor :: AppState -> [CursorLocation n] -> Maybe (CursorLocation n)
- drawKeyMenu :: AppState -> Widget Name
- drawModalMenu :: AppState -> Widget Name
- drawKeyCmd :: (KeyHighlight, Text, Text) -> Widget Name
- drawWorld :: Bool -> GameState -> Widget Name
- drawRobotPanel :: AppState -> Widget Name
- drawItem :: Maybe Int -> Int -> Bool -> InventoryListEntry -> Widget Name
- drawLabelledEntityName :: Entity -> Widget Name
- drawInfoPanel :: AppState -> Widget Name
- explainFocusedItem :: AppState -> Widget Name
- drawREPL :: AppState -> Widget Name
Documentation
drawUI :: AppState -> [Widget Name] Source #
The main entry point for drawing the entire UI. Figures out which menu screen we should show (if any), or just the game itself.
Dialog box
drawDialog :: AppState -> Widget Name Source #
Draw the error dialog window, if it should be displayed right now.
generateModal :: AppState -> ModalType -> Modal Source #
Generate a fresh modal window of the requested type.
chooseCursor :: AppState -> [CursorLocation n] -> Maybe (CursorLocation n) Source #
Hide the cursor when a modal is set
Key hint menu
drawKeyMenu :: AppState -> Widget Name Source #
Draw a menu explaining what key commands are available for the current panel. This menu is displayed as a single line in between the world panel and the REPL.
This excludes the F-key modals that are shown elsewhere.
drawModalMenu :: AppState -> Widget Name Source #
Draw the F-key modal menu. This is displayed in the top left world corner.
drawKeyCmd :: (KeyHighlight, Text, Text) -> Widget Name Source #
Draw a single key command in the menu.
World
Robot panel
drawRobotPanel :: AppState -> Widget Name Source #
Draw info about the currently focused robot, such as its name, position, orientation, and inventory.
:: Maybe Int | The index of the currently selected inventory entry |
-> Int | The index of the entry we are drawing |
-> Bool | Whether this entry is selected; we can ignore this because it will automatically have a special attribute applied to it. |
-> InventoryListEntry | The entry to draw. |
-> Widget Name |
Draw an inventory entry.
drawLabelledEntityName :: Entity -> Widget Name Source #
Draw the name of an entity, labelled with its visual representation as a cell in the world.
Info panel
drawInfoPanel :: AppState -> Widget Name Source #
Draw the info panel in the bottom-left corner, which shows info about the currently focused inventory item.
explainFocusedItem :: AppState -> Widget Name Source #
Display info about the currently focused inventory entity, such as its description and relevant recipes.