swarm-0.5.0.0: 2D resource gathering game with programmable robots
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.TUI.View.CellDisplay

Description

Rendering of cells in the map view

SPDX-License-Identifier: BSD-3-Clause

Synopsis

Documentation

renderDisplay :: Display -> Widget n Source #

Render a display as a UI widget.

drawLoc :: UIState -> GameState -> Cosmic Coords -> Widget Name Source #

Render the Display for a specific location.

data RenderingInput Source #

Subset of the game state needed to render the world

mkEntityKnowledge :: GameState -> EntityKnowledgeDependencies Source #

Extract the relevant subset of information from the GameState to be able to compute whether an entity is "known".

data EntityKnowledgeDependencies Source #

The subset of information required to compute whether an entity is "known", and therefore should be rendered normally vs as a question mark.

getEntityIsKnown :: EntityKnowledgeDependencies -> EntityPaint -> Bool Source #

Determines whether an entity should be rendered normally vs as a question mark.

displayLoc :: Bool -> WorldOverdraw -> GameState -> Cosmic Coords -> Display Source #

Get the Display for a specific location, by combining the Displays for the terrain, entity, and robots at the location, and taking into account "static" based on the distance to the robot being viewed.

displayLocRaw Source #

Arguments

:: WorldOverdraw 
-> RenderingInput 
-> [Display]

Robot displays

-> Cosmic Coords 
-> Display 

Get the Display for a specific location, by combining the Displays for the terrain, entity, and robots at the location.

staticDisplay :: GameState -> Coords -> Display Source #

Random "static" based on the distance to the robot being viewed.

displayStatic :: Word32 -> Display Source #

Draw static given a number from 0-15 representing the state of the four quarter-pixels in a cell

staticChar :: Word32 -> Char Source #

Given a value from 0--15, considered as 4 bits, pick the character with the corresponding quarter pixels turned on.

getStatic :: GameState -> Coords -> Maybe Word32 Source #

Random "static" based on the distance to the robot being viewed. A cell can either be static-free (represented by Nothing) or can have one of sixteen values (representing the state of the four quarter-pixels in one cell).