Gamgine-0.5: Some kind of game library or set of utilities.

Safe HaskellNone
LanguageHaskell98

Gamgine.State.StateTreeZipper

Synopsis

Documentation

data Zipper a Source

a zipper for the state tree

Constructors

Zipper 

Fields

path :: [Step a]
 
current :: StateTree a
 

data Step a Source

represents a step walking the state tree

Constructors

Step 

Fields

parent :: (State a, EnterWhen, LeaveWhen)
 
siblings :: ([StateTree a], [StateTree a])
 

zipper :: StateTree a -> Zipper a Source

create a zipper from a StateTree

handleKeyEvent :: KeyInfo -> a -> Zipper a -> (a, Zipper a) Source

checks if a state transition should occur, otherwise calls the keyEvent function of the current state

handleMouseEvent :: MouseInfo -> a -> Zipper a -> (a, Zipper a) Source

checks if a state transition should occur, otherwise calls the mouseEvent function of the current state

goUp :: MousePos -> a -> Zipper a -> (a, Zipper a) Source

leave the current state and enter the parent state

goDown :: Int -> MousePos -> a -> Zipper a -> (a, Zipper a) Source

leave the current state and enter the adjacent state with index adjIdx

replace :: State a -> Zipper a -> Zipper a Source

replace the current state

transitionAppliesKI :: KeyInfo -> StateTransition -> Bool Source

checks if the KeyInfo matches the StateTransition

transitionAppliesMI :: MouseInfo -> StateTransition -> Bool Source

checks of the MouseInfo matches the StateTransition