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

Contents

- Internal operations

Description

Text frontend based on SDL2.

Synopsis

- startup :: ScreenContent -> ClientOptions -> IO RawFrontend
- frontendName :: String
- type FontAtlas = EnumMap AttrCharW32 Texture
- data FrontendSession = FrontendSession {
  - swindow :: Window
  - srenderer :: Renderer
  - squareFont :: Font
  - squareFontSize :: Int
  - mapFontIsBitmap :: Bool
  - spropFont :: Maybe Font
  - sboldFont :: Maybe Font
  - smonoFont :: Maybe Font
  - squareAtlas :: IORef FontAtlas
  - smonoAtlas :: IORef FontAtlas
  - sbasicTexture :: IORef Texture
  - stexture :: IORef Texture
  - spreviousFrame :: IORef SingleFrame
  - sforcedShutdown :: IORef Bool
  - scontinueSdlLoop :: IORef Bool
  - sframeQueue :: MVar SingleFrame
  - sframeDrawn :: MVar ()
  }
- startupFun :: ScreenContent -> ClientOptions -> MVar RawFrontend -> IO ()
- shutdown :: FrontendSession -> IO ()
- forceShutdown :: FrontendSession -> IO ()
- display :: FrontendSession -> SingleFrame -> IO ()
- drawFrame :: ScreenContent -> ClientOptions -> FrontendSession -> SingleFrame -> IO ()
- printScreen :: FrontendSession -> IO ()
- modTranslate :: KeyModifier -> Modifier
- keyTranslate :: Bool -> Keycode -> Key
- colorToRGBA :: Color -> V4 Word8

# Documentation

startup :: ScreenContent -> ClientOptions -> IO RawFrontend Source #

Set up and start the main loop providing input and output.

Because of Windows and OS X, SDL2 needs to be on a bound thread, so we can't avoid the communication overhead of bound threads.

frontendName :: String Source #

The name of the frontend.

# Internal operations

type FontAtlas = EnumMap AttrCharW32 Texture Source #

data FrontendSession Source #

Session data maintained by the frontend.

Constructors

FrontendSession |

Fields

- swindow :: Window
- srenderer :: Renderer
- squareFont :: Font
- squareFontSize :: Int
- mapFontIsBitmap :: Bool
- spropFont :: Maybe Font
- sboldFont :: Maybe Font
- smonoFont :: Maybe Font
- squareAtlas :: IORef FontAtlas
- smonoAtlas :: IORef FontAtlas
- sbasicTexture :: IORef Texture
- stexture :: IORef Texture
- spreviousFrame :: IORef SingleFrame
- sforcedShutdown :: IORef Bool
- scontinueSdlLoop :: IORef Bool
- sframeQueue :: MVar SingleFrame
- sframeDrawn :: MVar ()

startupFun :: ScreenContent -> ClientOptions -> MVar RawFrontend -> IO () Source #

shutdown :: FrontendSession -> IO () Source #

forceShutdown :: FrontendSession -> IO () Source #

display Source #

Arguments

:: FrontendSession | frontend session data
-> SingleFrame | the screen frame to draw
-> IO () |

Add a frame to be drawn.

drawFrame Source #

Arguments

:: ScreenContent | e.g., game screen size
-> ClientOptions | client options
-> FrontendSession | frontend session data
-> SingleFrame | the screen frame to draw
-> IO () |

printScreen :: FrontendSession -> IO () Source #

modTranslate :: KeyModifier -> Modifier Source #

Translates modifiers to our own encoding.

keyTranslate :: Bool -> Keycode -> Key Source #

colorToRGBA :: Color -> V4 Word8 Source #