Module

Graphics.Glapple

Package
purescript-glapple
Repository
yukikurage/purescript-glapple

Re-exports from Graphics.Glapple.Data.Event

#MouseButton Source

#KeyState Source

data KeyState

Constructors

Instances

#Event Source

data Event

Constructors

Instances

Re-exports from Graphics.Glapple.Data.GameId

#GameId Source

data GameId s i

Used for input from outside the game.

Constructors

#tell Source

tell :: forall s i m. MonadEffect m => GameId s i -> i -> m Unit

Tell input to the game.

#renderGame Source

renderGame :: forall s i. GameId s i -> Picture s

Draw the game.

#null Source

null :: forall s i m. MonadEffect m => GameId s i -> m Boolean

Returns True if GameId is empty.

#emptyGameId Source

emptyGameId :: forall m s i. Bind m => MonadEffect m => m (GameId s i)

Empty GameId.

Re-exports from Graphics.Glapple.Data.GameSpec

#GameSpec Source

newtype GameSpec sprite gameState input

A pure version of GameSpecM.

Constructors

  • GameSpec { eventHandler :: Event -> gameState -> gameState, initGameState :: gameState, inputHandler :: input -> gameState -> gameState, render :: { globalTime :: Number, localTime :: Number } -> gameState -> Picture sprite }

#mkRenderM Source

mkRenderM :: forall sprite gameState i output. ({ globalTime :: Number, localTime :: Number } -> gameState -> Picture sprite) -> GlappleM sprite gameState i output (Picture sprite)

#mkInitGameStateM Source

mkInitGameStateM :: forall f a. Applicative f => a -> f a

#mkHandlerM Source

mkHandlerM :: forall a sprite gameState i output. (a -> gameState -> gameState) -> a -> GlappleM sprite gameState i output Unit

#mkGameSpecM Source

mkGameSpecM :: forall gameState sprite input output. GameSpec sprite gameState input -> GameSpecM sprite gameState input output

Convert GameSpec to GameSpecM.

Re-exports from Graphics.Glapple.Data.GameSpecM

#GameSpecM Source

newtype GameSpecM s g i o

runGameM to run the game.

Constructors

#CanvasSpec Source

type CanvasSpec = { height :: Number, width :: Number }

#defaultRender Source

defaultRender :: forall m s. Applicative m => m (Picture s)

#defaultHandler Source

defaultHandler :: forall m a. Applicative m => a -> m Unit

Re-exports from Graphics.Glapple.GameRunner

#runGame Source

runGame :: forall sprite gameState input. Ord sprite => Number -> CanvasElement -> CanvasSpec -> Array (SpriteData sprite) -> GameSpec sprite gameState input -> Effect (GameId sprite input)

A pure version of runGame.

#runChildGame Source

runChildGame :: forall s g i o childG childI. GameSpec s childG childI -> GlappleM s g i o (GameId s childI)

A pure version of runChildGame.

Re-exports from Graphics.Glapple.GameRunnerM

#runGameWithM_ Source

runGameWithM_ :: forall s g i o childG childI childO. GameId s childI -> GameSpecM s childG childI childO -> GlappleM s g i o Unit

runGameWithM without outputHandler

#runGameWithM Source

runGameWithM :: forall s g i o childG childI childO. GameId s childI -> GameSpecM s childG childI childO -> (childO -> GlappleM s g i o Unit) -> GlappleM s g i o Unit

Add a Game to the GameId.

#runGameM_ Source

runGameM_ :: forall s g i o. Ord s => Number -> CanvasElement -> CanvasSpec -> Array (SpriteData s) -> GameSpecM s g i o -> Effect (GameId s i)

runGameM without outputHandler

#runGameM Source

runGameM :: forall s g i o. Ord s => Number -> CanvasElement -> CanvasSpec -> Array (SpriteData s) -> GameSpecM s g i o -> (o -> Effect Unit) -> Effect (GameId s i)

Making Games at the Top Level.

#runChildGameM_ Source

runChildGameM_ :: forall s g i o childG childI childO. GameSpecM s childG childI childO -> GlappleM s g i o (GameId s childI)

#runChildGameM Source

runChildGameM :: forall s g i o childG childI childO. GameSpecM s childG childI childO -> (childO -> GlappleM s g i o Unit) -> GlappleM s g i o (GameId s childI)

Create a new child game within the current game.

Re-exports from Graphics.Glapple.GlappleM

#GlappleM Source

newtype GlappleM s g i o a

Instances

#raise Source

raise :: forall s g i o. o -> GlappleM s g i o Unit

Raise output to the parent game.

#putGameState Source

putGameState :: forall s g i o. g -> GlappleM s g i o Unit

Put game state

#modifyGameState Source

modifyGameState :: forall s g i o. (g -> g) -> GlappleM s g i o Unit

Modify function to game state

#getMousePosition Source

getMousePosition :: forall s g i o. GlappleM s g i o (Maybe { mouseX :: Number, mouseY :: Number })

Gets the current mouse position. Returns Nothing if the mouse position cannot be obtained because the user has not moved the mouse yet.

#getLocalTime Source

getLocalTime :: forall s g i o. GlappleM s g i o Number

Get the time since the current game was started.

#getKeyState Source

getKeyState :: forall s g i o. KeyCode -> GlappleM s g i o Boolean

Gets the current key press state.

#getGlobalTime Source

getGlobalTime :: forall s g i o. GlappleM s g i o Number

Get the time since the root game was started.

#getGameState Source

getGameState :: forall s g i o. GlappleM s g i o g

Get current game state.

#destroy Source

destroy :: forall s g i o. GlappleM s g i o Unit

Destroy the game.

#break Source

break :: forall s g i o a. GlappleM s g i o a

Stop the current process.