swarm-0.6.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.TUI.Model.UI

Description

 
Synopsis

Documentation

data UIGameplay Source #

The main record holding the gameplay UI state. For access to the fields, see the lenses below.

data GoalDisplay Source #

Constructors

GoalDisplay 

Fields

uiGameplay :: Lens' UIState UIGameplay Source #

UI active during live gameplay

uiPopups :: Lens' UIState PopupState Source #

Queue of popups to display

uiTiming :: Lens' UIGameplay UITiming Source #

Temporal information for gameplay UI

uiInventory :: Lens' UIGameplay UIInventory Source #

Inventory information for gameplay UI

uiMenu :: Lens' UIState Menu Source #

The current menu state.

uiPlaying :: Lens' UIState Bool Source #

Are we currently playing the game?

  • True = we are playing, and should thus display a world, REPL, etc.
  • False = we should display the current menu.

uiCheatMode :: Lens' UIState Bool Source #

Cheat mode, i.e. are we allowed to turn creative mode on and off?

uiFocusRing :: Lens' UIGameplay (FocusRing Name) Source #

The focus ring is the set of UI panels we can cycle among using the Tab key.

uiLaunchConfig :: Lens' UIState LaunchOptions Source #

Configuration modal when launching a scenario

uiWorldCursor :: Lens' UIGameplay (Maybe (Cosmic Coords)) Source #

The last clicked position on the world view.

uiWorldEditor :: Lens' UIGameplay (WorldEditor Name) Source #

State of all World Editor widgets

uiREPL :: Lens' UIGameplay REPLState Source #

The state of REPL panel.

uiInventoryList :: Lens' UIInventory (Maybe (Int, List Name InventoryListEntry)) Source #

The hash value of the focused robot entity (so we can tell if its inventory changed) along with a list of the items in the focused robot's inventory.

uiInventorySort :: Lens' UIInventory InventorySortOptions Source #

The order and direction of sorting inventory list.

uiInventorySearch :: Lens' UIInventory (Maybe Text) Source #

The current search string used to narrow the inventory view.

uiScrollToEnd :: Lens' UIGameplay Bool Source #

A flag telling the UI to scroll the info panel to the very end (used when a new log message is appended).

uiModal :: Lens' UIGameplay (Maybe Modal) Source #

When this is Just, it represents a modal to be displayed on top of the UI, e.g. for the Help screen.

uiGoal :: Lens' UIGameplay GoalDisplay Source #

Status of the scenario goal: whether there is one, and whether it has been displayed to the user initially.

uiStructure :: Lens' UIGameplay StructureDisplay Source #

Definition and status of a recognizable structure

uiHideGoals :: Lens' UIGameplay Bool Source #

When running with --autoplay, suppress the goal dialogs.

For development, the --cheat flag shows goals again.

uiAchievements :: Lens' UIState (Map CategorizedAchievement Attainment) Source #

Map of achievements that were attained

lgTicksPerSecond :: Lens' UITiming Int Source #

The base-2 logarithm of the current game speed in ticks/second. Note that we cap this value to the range of +/- log2 INTMAX.

lastFrameTime :: Lens' UITiming TimeSpec Source #

The time of the last Frame event.

accumulatedTime :: Lens' UITiming TimeSpec Source #

The amount of accumulated real time. Every time we get a Frame event, we accumulate the amount of real time that happened since the last frame, then attempt to take an appropriate number of ticks to "catch up", based on the target tick rate.

See https://gafferongames.com/post/fix_your_timestep/ .

tickCount :: Lens' UITiming Int Source #

A counter used to track how many ticks have happened since the last time we updated the ticks/frame statistics.

frameCount :: Lens' UITiming Int Source #

A counter used to track how many frames have been rendered since the last time we updated the ticks/frame statistics.

frameTickCount :: Lens' UITiming Int Source #

A counter used to track how many ticks have happened in the current frame, so we can stop when we get to the tick cap.

lastInfoTime :: Lens' UITiming TimeSpec Source #

The time of the last info widget update

uiShowFPS :: Lens' UITiming Bool Source #

A toggle to show the FPS by pressing f

uiShowREPL :: Lens' UIGameplay Bool Source #

A toggle to expand or collapse the REPL by pressing Ctrl-k

uiShowZero :: Lens' UIInventory Bool Source #

A toggle to show or hide inventory items with count 0 by pressing 0

uiShowDebug :: Lens' UIGameplay Bool Source #

A toggle to show debug.

TODO: #1112 use record for selection of debug features?

uiShowRobots :: Getter UIGameplay Bool Source #

Whether to show or hide robots on the world map.

uiHideRobotsUntil :: Lens' UIGameplay TimeSpec Source #

Hide robots on the world map.

uiInventoryShouldUpdate :: Lens' UIInventory Bool Source #

Whether the Inventory ui panel should update

uiTPF :: Lens' UITiming Double Source #

Computed ticks per milliseconds

uiFPS :: Lens' UITiming Double Source #

Computed frames per milliseconds

scenarioRef :: Lens' UIGameplay (Maybe ScenarioInfoPair) Source #

The currently active Scenario description, useful for starting over.

Initialization

initFocusRing :: FocusRing Name Source #

The initial state of the focus ring. NOTE: Normally, the Tab key might cycle through the members of the focus ring. However, the REPL already uses Tab. So, to is not used at all right now for navigating the toplevel focus ring.

defaultInitLgTicksPerSecond :: Int Source #

The initial tick speed.

initUIState :: (Has (Accum (Seq SystemFailure)) sig m, Has (Lift IO) sig m) => Int -> Bool -> Bool -> m UIState Source #

Initialize the UI state. This needs to be in the IO monad since it involves reading a REPL history file, getting the current time, and loading text files from the data directory. The Bool parameter indicates whether we should start off by showing the main menu.