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

FRP.Rhine.Gloss.IO

Description

Wrapper to write gloss applications in Rhine, using concurrency.

Synopsis

Documentation

data GlossConcT m a Source #

Wraps the concurrent variables needed for communication with the gloss backend.

Instances

Instances details
MMonad GlossConcT Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

Methods

embed :: forall (n :: Type -> Type) m b. Monad n => (forall a. m a -> GlossConcT n a) -> GlossConcT m b -> GlossConcT n b #

MonadTrans GlossConcT Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

Methods

lift :: Monad m => m a -> GlossConcT m a #

MFunctor GlossConcT Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

Methods

hoist :: forall m n (b :: k). Monad m => (forall a. m a -> n a) -> GlossConcT m b -> GlossConcT n b #

MonadIO m => MonadIO (GlossConcT m) Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

Methods

liftIO :: IO a -> GlossConcT m a #

Applicative m => Applicative (GlossConcT m) Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

Methods

pure :: a -> GlossConcT m a #

(<*>) :: GlossConcT m (a -> b) -> GlossConcT m a -> GlossConcT m b #

liftA2 :: (a -> b -> c) -> GlossConcT m a -> GlossConcT m b -> GlossConcT m c #

(*>) :: GlossConcT m a -> GlossConcT m b -> GlossConcT m b #

(<*) :: GlossConcT m a -> GlossConcT m b -> GlossConcT m a #

Functor m => Functor (GlossConcT m) Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

Methods

fmap :: (a -> b) -> GlossConcT m a -> GlossConcT m b #

(<$) :: a -> GlossConcT m b -> GlossConcT m a #

Monad m => Monad (GlossConcT m) Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

Methods

(>>=) :: GlossConcT m a -> (a -> GlossConcT m b) -> GlossConcT m b #

(>>) :: GlossConcT m a -> GlossConcT m b -> GlossConcT m b #

return :: a -> GlossConcT m a #

MonadIO m => Clock (GlossConcT m) GlossEventClockIO Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

Associated Types

type Time GlossEventClockIO #

type Tag GlossEventClockIO #

MonadIO m => Clock (GlossConcT m) GlossSimClockIO Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

Associated Types

type Time GlossSimClockIO #

type Tag GlossSimClockIO #

paintIO :: MonadIO m => Picture -> GlossConcT m () Source #

Add a picture to the canvas.

clearIO :: MonadIO m => GlossConcT m () Source #

Clear the canvas.

paintAllIO :: MonadIO m => Picture -> GlossConcT m () Source #

Clear the canvas and then paint.

data GlossEventClockIO Source #

Concurrently block on gloss events.

Constructors

GlossEventClockIO 

data GlossSimClockIO Source #

Concurrently block on gloss simulation ticks.

Constructors

GlossSimClockIO 

Instances

Instances details
GetClockProxy GlossSimClockIO Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

MonadIO m => Clock (GlossConcT m) GlossSimClockIO Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

Associated Types

type Time GlossSimClockIO #

type Tag GlossSimClockIO #

type Tag GlossSimClockIO Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

type Time GlossSimClockIO Source # 
Instance details

Defined in FRP.Rhine.Gloss.IO

launchGlossThread :: MonadIO m => GlossSettings -> GlossConcT m a -> m a Source #

Apply this to supply the GlossConcT effect. Creates a new thread in which gloss is run, and feeds the clocks GlossEventClockIO and GlossSimClockIO.

Usually, this function is applied to the result of flow, so you can handle all occurring effects as needed. If you only use gloss in your whole signal network, you can use flowGlossIO instead.

flowGlossIO :: (MonadIO m, Clock (GlossConcT m) cl, GetClockProxy cl, Time cl ~ Time (In cl), Time cl ~ Time (Out cl)) => GlossSettings -> Rhine (GlossConcT m) cl () () -> m () Source #

Run a Rhine in the GlossConcT monad by launching a separate thread for the gloss backend, and reactimate in the foreground.

glossConcurrently :: (Clock (GlossConcT IO) cl1, Clock (GlossConcT IO) cl2, Time cl1 ~ Time cl2) => Schedule (GlossConcT IO) cl1 cl2 Source #

A schedule in the GlossConcT transformer, supplying the same backend connection to its scheduled clocks.