rhine-gloss-1.0: Gloss backend for Rhine
Safe HaskellSafe-Inferred
LanguageHaskell2010

FRP.Rhine.Gloss.Pure

Description

A pure gloss backend for Rhine.

To run pure Rhine apps with gloss, write a clocked signal function (ClSF) in the GlossClock and use flowGloss.

Synopsis

Documentation

data GlossM a Source #

A pure monad in which all effects caused by the gloss backend take place.

Instances

Instances details
Applicative GlossM Source # 
Instance details

Defined in FRP.Rhine.Gloss.Pure

Methods

pure :: a -> GlossM a #

(<*>) :: GlossM (a -> b) -> GlossM a -> GlossM b #

liftA2 :: (a -> b -> c) -> GlossM a -> GlossM b -> GlossM c #

(*>) :: GlossM a -> GlossM b -> GlossM b #

(<*) :: GlossM a -> GlossM b -> GlossM a #

Functor GlossM Source # 
Instance details

Defined in FRP.Rhine.Gloss.Pure

Methods

fmap :: (a -> b) -> GlossM a -> GlossM b #

(<$) :: a -> GlossM b -> GlossM a #

Monad GlossM Source # 
Instance details

Defined in FRP.Rhine.Gloss.Pure

Methods

(>>=) :: GlossM a -> (a -> GlossM b) -> GlossM b #

(>>) :: GlossM a -> GlossM b -> GlossM b #

return :: a -> GlossM a #

MonadSchedule GlossM Source # 
Instance details

Defined in FRP.Rhine.Gloss.Pure

Methods

schedule :: NonEmpty (GlossM a) -> GlossM (NonEmpty a, [GlossM a]) #

Clock GlossM GlossClock Source # 
Instance details

Defined in FRP.Rhine.Gloss.Pure

Associated Types

type Time GlossClock #

type Tag GlossClock #

paint :: Picture -> GlossM () Source #

Add a picture to the canvas.

clear :: GlossM () Source #

Clear the canvas.

paintAll :: Picture -> GlossM () Source #

Clear the canvas and then paint.

data GlossClock Source #

The overall clock of a pure rhine ClSF that can be run by gloss. It ticks both on events (tag = Just Event) and simulation steps (tag = Nothing).

Constructors

GlossClock 

Instances

Instances details
Semigroup GlossClock Source # 
Instance details

Defined in FRP.Rhine.Gloss.Pure

GetClockProxy GlossClock Source # 
Instance details

Defined in FRP.Rhine.Gloss.Pure

Clock GlossM GlossClock Source # 
Instance details

Defined in FRP.Rhine.Gloss.Pure

Associated Types

type Time GlossClock #

type Tag GlossClock #

type Tag GlossClock Source # 
Instance details

Defined in FRP.Rhine.Gloss.Pure

type Time GlossClock Source # 
Instance details

Defined in FRP.Rhine.Gloss.Pure

type GlossClSF = ClSF GlossM GlossClock () Picture Source #

The type of a ClSF you can implement to get a gloss app, if you chose to handle events and simulation steps in the same subsystem.

You can, but don't need to paint via GlossM: You can also simply output the picture and it will be painted on top.

currentEvent :: ClSF GlossM GlossClock () (Maybe Event) Source #

Observe whether there was an event this tick, and which one.

flowGloss :: (Clock GlossM cl, GetClockProxy cl) => GlossSettings -> Rhine GlossM cl () () -> IO () Source #

The main function that will start the gloss backend and run the Rhine

flowGlossClSF Source #

Arguments

:: GlossSettings 
-> GlossClSF

The gloss-compatible ClSF.

-> IO () 

Specialisation of flowGloss to a GlossClSF