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

Contents

- Connection and initialization
- Re-exported part of the raw frontend
- Internal operations

Description

Display game data on the screen and receive user input using one of the available raw frontends and derived operations.

Synopsis

- data FrontReq a where
  - FrontFrame :: Frame -> FrontReq ()
  - FrontDelay :: Int -> FrontReq ()
  - FrontKey :: [KM] -> Frame -> FrontReq KMP
  - FrontPressed :: FrontReq Bool
  - FrontDiscardKey :: FrontReq ()
  - FrontResetKeys :: FrontReq ()
  - FrontShutdown :: FrontReq ()
  - FrontPrintScreen :: FrontReq ()
- newtype ChanFrontend = ChanFrontend (forall a. FrontReq a -> IO a)
- chanFrontendIO :: ScreenContent -> ClientOptions -> IO ChanFrontend
- frontendName :: ClientOptions -> String
- data FrontSetup
- getKey :: FrontSetup -> RawFrontend -> [KM] -> Frame -> IO KMP
- fchanFrontend :: FrontSetup -> RawFrontend -> ChanFrontend
- display :: RawFrontend -> Frame -> IO ()
- defaultMaxFps :: Double
- microInSec :: Int
- frameTimeoutThread :: Int -> MVar Int -> RawFrontend -> IO ()
- lazyStartup :: ScreenContent -> IO RawFrontend
- nullStartup :: ScreenContent -> IO RawFrontend
- seqFrame :: SingleFrame -> IO ()

# Connection and initialization

data FrontReq a where Source #

The instructions sent by clients to the raw frontend, indexed by the returned value.

Constructors

FrontFrame :: Frame -> FrontReq () | Show a frame.
FrontDelay :: Int -> FrontReq () | Perform an explicit delay of the given length.
FrontKey :: [KM] -> Frame -> FrontReq KMP | Flush frames, display a frame and ask for a keypress.
FrontPressed :: FrontReq Bool | Tell if a keypress is pending.
FrontDiscardKey :: FrontReq () | Discard a single key in the queue, if any.
FrontResetKeys :: FrontReq () | Discard all keys in the queue.
FrontShutdown :: FrontReq () | Shut the frontend down.
FrontPrintScreen :: FrontReq () | Take screenshot.

newtype ChanFrontend Source #

Connection channel between a frontend and a client. Frontend acts as a server, serving keys, etc., when given frames to display.

Constructors

ChanFrontend (forall a. FrontReq a -> IO a) |

chanFrontendIO :: ScreenContent -> ClientOptions -> IO ChanFrontend Source #

Initialize the frontend chosen by the player via client options.

# Re-exported part of the raw frontend

frontendName :: ClientOptions -> String Source #

The name of the chosen frontend.

# Internal operations

data FrontSetup Source #

Machinery allocated for an individual frontend at its startup, unchanged for its lifetime.

getKey :: FrontSetup -> RawFrontend -> [KM] -> Frame -> IO KMP Source #

fchanFrontend :: FrontSetup -> RawFrontend -> ChanFrontend Source #

display :: RawFrontend -> Frame -> IO () Source #

defaultMaxFps :: Double Source #

microInSec :: Int Source #

frameTimeoutThread :: Int -> MVar Int -> RawFrontend -> IO () Source #

lazyStartup :: ScreenContent -> IO RawFrontend Source #

nullStartup :: ScreenContent -> IO RawFrontend Source #

seqFrame :: SingleFrame -> IO () Source #