License | BSD-3-Clause |
---|---|
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Synopsis
- data UIState = UIState {
- _uiMenu :: Menu
- _uiPlaying :: Bool
- _uiCheatMode :: Bool
- _uiFocusRing :: FocusRing Name
- _uiLaunchConfig :: LaunchOptions
- _uiWorldCursor :: Maybe (Cosmic Coords)
- _uiWorldEditor :: WorldEditor Name
- _uiREPL :: REPLState
- _uiInventory :: Maybe (Int, List Name InventoryListEntry)
- _uiInventorySort :: InventorySortOptions
- _uiInventorySearch :: Maybe Text
- _uiScrollToEnd :: Bool
- _uiModal :: Maybe Modal
- _uiGoal :: GoalDisplay
- _uiHideGoals :: Bool
- _uiAchievements :: Map CategorizedAchievement Attainment
- _uiShowFPS :: Bool
- _uiShowREPL :: Bool
- _uiShowZero :: Bool
- _uiShowDebug :: Bool
- _uiHideRobotsUntil :: TimeSpec
- _uiInventoryShouldUpdate :: Bool
- _uiTPF :: Double
- _uiFPS :: Double
- _lgTicksPerSecond :: Int
- _tickCount :: Int
- _frameCount :: Int
- _frameTickCount :: Int
- _lastFrameTime :: TimeSpec
- _accumulatedTime :: TimeSpec
- _lastInfoTime :: TimeSpec
- _uiAttrMap :: AttrMap
- _scenarioRef :: Maybe ScenarioInfoPair
- data GoalDisplay = GoalDisplay {}
- uiMenu :: Lens' UIState Menu
- uiPlaying :: Lens' UIState Bool
- uiCheatMode :: Lens' UIState Bool
- uiFocusRing :: Lens' UIState (FocusRing Name)
- uiLaunchConfig :: Lens' UIState LaunchOptions
- uiWorldCursor :: Lens' UIState (Maybe (Cosmic Coords))
- uiWorldEditor :: Lens' UIState (WorldEditor Name)
- uiREPL :: Lens' UIState REPLState
- uiInventory :: Lens' UIState (Maybe (Int, List Name InventoryListEntry))
- uiInventorySort :: Lens' UIState InventorySortOptions
- uiInventorySearch :: Lens' UIState (Maybe Text)
- uiScrollToEnd :: Lens' UIState Bool
- uiModal :: Lens' UIState (Maybe Modal)
- uiGoal :: Lens' UIState GoalDisplay
- uiHideGoals :: Lens' UIState Bool
- uiAchievements :: Lens' UIState (Map CategorizedAchievement Attainment)
- lgTicksPerSecond :: Lens' UIState Int
- lastFrameTime :: Lens' UIState TimeSpec
- accumulatedTime :: Lens' UIState TimeSpec
- tickCount :: Lens' UIState Int
- frameCount :: Lens' UIState Int
- frameTickCount :: Lens' UIState Int
- lastInfoTime :: Lens' UIState TimeSpec
- uiShowFPS :: Lens' UIState Bool
- uiShowREPL :: Lens' UIState Bool
- uiShowZero :: Lens' UIState Bool
- uiShowDebug :: Lens' UIState Bool
- uiShowRobots :: Getter UIState Bool
- uiHideRobotsUntil :: Lens' UIState TimeSpec
- uiInventoryShouldUpdate :: Lens' UIState Bool
- uiTPF :: Lens' UIState Double
- uiFPS :: Lens' UIState Double
- uiAttrMap :: Lens' UIState AttrMap
- scenarioRef :: Lens' UIState (Maybe ScenarioInfoPair)
- initFocusRing :: FocusRing Name
- defaultInitLgTicksPerSecond :: Int
- initUIState :: (Has (Accum (Seq SystemFailure)) sig m, Has (Lift IO) sig m) => Int -> Bool -> Bool -> m UIState
Documentation
The main record holding the UI state. For access to the fields, see the lenses below.
UIState | |
|
data GoalDisplay Source #
GoalDisplay | |
|
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' UIState (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' UIState (Maybe (Cosmic Coords)) Source #
The last clicked position on the world view.
uiWorldEditor :: Lens' UIState (WorldEditor Name) Source #
State of all World Editor widgets
uiInventory :: Lens' UIState (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' UIState InventorySortOptions Source #
The order and direction of sorting inventory list.
uiInventorySearch :: Lens' UIState (Maybe Text) Source #
The current search string used to narrow the inventory view.
uiScrollToEnd :: Lens' UIState 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' UIState (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' UIState GoalDisplay Source #
Status of the scenario goal: whether there is one, and whether it has been displayed to the user initially.
uiHideGoals :: Lens' UIState 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' UIState 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.
accumulatedTime :: Lens' UIState 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.
tickCount :: Lens' UIState Int Source #
A counter used to track how many ticks have happened since the last time we updated the ticks/frame statistics.
frameCount :: Lens' UIState 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' UIState 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.
uiShowZero :: Lens' UIState Bool Source #
A toggle to show or hide inventory items with count 0 by pressing 0
uiShowDebug :: Lens' UIState Bool Source #
A toggle to show debug.
TODO: #1112 use record for selection of debug features?
scenarioRef :: Lens' UIState (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.