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

Description

Screen frames and animations.

Synopsis

- data RawFrontend = RawFrontend {
  - fdisplay :: SingleFrame -> IO ()
  - fshutdown :: IO ()
  - fshowNow :: MVar ()
  - fchanKey :: TQueue KMP
  - fprintScreen :: IO ()
  - fcoscreen :: ScreenContent
  }
- startupBound :: (MVar RawFrontend -> IO ()) -> IO RawFrontend
- createRawFrontend :: ScreenContent -> (SingleFrame -> IO ()) -> IO () -> IO RawFrontend
- resetChanKey :: TQueue KMP -> IO ()
- saveKMP :: RawFrontend -> Modifier -> Key -> PointUI -> IO ()
- modifierTranslate :: Bool -> Bool -> Bool -> Bool -> Modifier

# Documentation

data RawFrontend Source #

Raw frontend definition. The minimal closed set of values that need to depend on the specifics of the chosen frontend.

Constructors

RawFrontend |

Fields

- fdisplay :: SingleFrame -> IO ()
- fshutdown :: IO ()
- fshowNow :: MVar ()
- fchanKey :: TQueue KMP
- fprintScreen :: IO ()
- fcoscreen :: ScreenContent

startupBound :: (MVar RawFrontend -> IO ()) -> IO RawFrontend Source #

Start up a frontend on a bound thread.

In fact, it is started on the very main thread, via a hack, because apparently some SDL backends are not thread-safe (https://wiki.libsdl.org/FAQDevelopment; "this should only be run in the thread that initialized the video subsystem, and for extra safety, you should consider only doing those things on the main thread in any case") and at least the newer OS X obtusely requires the main thread, see https://github.com/AllureOfTheStars/Allure/issues/79 In case any other exotic architecture requires the main thread, we make the hack the default for all (on frontends that require a bound thread, e.g., SLD2).

createRawFrontend :: ScreenContent -> (SingleFrame -> IO ()) -> IO () -> IO RawFrontend Source #

resetChanKey :: TQueue KMP -> IO () Source #

Empty the keyboard channel.

saveKMP :: RawFrontend -> Modifier -> Key -> PointUI -> IO () Source #

modifierTranslate :: Bool -> Bool -> Bool -> Bool -> Modifier Source #

Translates modifiers to our own encoding.