reflex-gloss-scene-0.1.2: A simple scene-graph using reflex and gloss

Safe HaskellNone
LanguageHaskell2010

Reflex.Gloss.Scene

Description

Reflex.Gloss.Scene A simple scene graph implementation rendered using gloss. Contains functionality for picking and transformations. Implements interfaces for MonadSwitch (see reflex-transformers) and MonadTime (see reflex-animations) for switching, and animation support respectively.

Synopsis

Documentation

playSceneGraph :: Display -> Color -> Int -> (forall t. Reflex t => Scene t ()) -> IO () Source

Run a scenegraph in IO

rotation :: Reflex t => Float -> Scene t a -> Scene t a Source

Rotate a child widget using a constant

activeRotation :: Reflex t => Behavior t Float -> Scene t a -> Scene t a Source

Rotate a child widget actively using a Behavior

translation :: Reflex t => Vector -> Scene t a -> Scene t a Source

Translate a child widget using a constant

activeTranslation :: Reflex t => Behavior t Vector -> Scene t a -> Scene t a Source

Translate a child widget actively using a Behavior

render :: Reflex t => Behavior t Picture -> Scene t () Source

Render a picture in the current widget

data Scene t a Source

Scene Monad, passes down the scene graph a SceneNode, passes back up the scene graph renderings (Behavior t Picture) Implements MonadSwitch and MonadTime abstractions.

type Time = Float Source

Time is just a float!

targetRect :: Reflex t => Behavior t Vector -> Scene t (Target t) Source

Make a rectangular picking target

targetCircle :: Reflex t => Behavior t Float -> Scene t (Target t) Source

Make a circular picking target

makeTarget :: Reflex t => Behavior t (Vector -> Bool) -> Scene t (Target t) Source

Make a target from an intersection function

data Target t Source

Type for picking targets

localMouse :: Reflex t => Scene t (Behavior t Point) Source

Local mouse position relative to the widget

globalMouse :: Reflex t => Scene t (Behavior t Point) Source

Get the global mouse position in the window

mouseUp :: Reflex t => MouseButton -> Target t -> Event t () Source

Mouse up event on a picking target

mouseDown :: Reflex t => MouseButton -> Target t -> Event t () Source

Mouse down event on a picking target

clicked :: Reflex t => MouseButton -> Target t -> Scene t (Event t (), Behavior t Bool) Source

Mouse click event for picking target, returns click event and behavior indicating current clicking

keyDown :: Reflex t => KeyEvents t -> Char -> Event t () Source

Key event queries

keyUp :: Reflex t => KeyEvents t -> Char -> Event t () Source

mouseOver :: Reflex t => Target t -> Scene t (Event t (), Event t ()) Source

Mouse over event on a picking target, returns events for (entering, leaving)

observe :: Reflex t => Behavior t a -> Scene t (Event t a) Source

observeChanges :: (Eq a, Reflex t) => Behavior t a -> Scene t (Event t a) Source

Observe changes in a 'Behavior a' it's Eq a instance

integrate :: (VectorSpace v, Scalar v ~ Time, Reflex t) => v -> Behavior t v -> Scene t (Dynamic t v) Source

integrateDyn :: (VectorSpace v, Scalar v ~ Time, Reflex t) => v -> Dynamic t v -> Scene t (Dynamic t v) Source

data Input Source

Input data type more covenient for splitting than the Gloss Input type