Module

Graphics.Glapple.GlappleM

Package
purescript-glapple
Repository
yukikurage/purescript-glapple

#InternalState Source

type InternalState (s :: Type) g (i :: Type) o = { eventEmitter :: EmitterId Effect Event, gameStateRef :: Ref (Maybe g), initTimeRef :: Ref (Maybe Time), internalRegistrationIdsRef :: Ref (Maybe (InternalRegistrationIds s i o)), keyStateRef :: Ref (Set KeyCode), localInitTimeRef :: Ref (Maybe Time), mousePositionRef :: Ref (Maybe { mouseX :: Number, mouseY :: Number }), outputEmitter :: EmitterId Effect o }

Instances

#GlappleM Source

newtype GlappleM s g i o a

Constructors

Instances

#runGlappleM Source

runGlappleM :: forall s g i o a. GlappleM s g i o a -> InternalState s g i o -> Effect (Maybe a)

#getGameState Source

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

Get current game state.

#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

#getGlobalTime Source

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

Get the time since the root game was started.

#getLocalTime Source

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

Get the time since the current game was started.

#raise Source

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

Raise output to the parent game.

#destroy Source

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

Destroy the game.

#getKeyState Source

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

Gets the current key press 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.

#break Source

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

Stop the current process.

#toEffect Source

toEffect :: forall s g i o a x. (x -> GlappleM s g i o a) -> GlappleM s g i o (x -> Effect (Maybe a))

Express the process of GlappleM by Effect.