rhine-gloss-1.3: 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 #

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

Defined in FRP.Rhine.Gloss.IO

Methods

schedule :: NonEmpty (GlossConcT m a) -> GlossConcT m (NonEmpty 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

launchInGlossThread :: 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.

launchGlossThread :: MonadIO m => GlossSettings -> m GlossEnv 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.

runGlossEnvClock :: GlossEnv -> cl -> RunGlossEnvClock m cl Source #

Apply to a gloss clock to remove a GlossConcT layer. You will have to have initialized a GlossEnv, for example by calling launchGlossThread.

type RunGlossEnvClock m cl = HoistClock (GlossConcT m) m cl Source #

Apply this wrapper to your clock type cl in order to escape the GlossConcT transformer. The resulting clock will be in m, not 'GlossConcT m' anymore. Typically, m will have the MonadIO constraint.