module Graphics.UI.FunGEn.Fun_Input (
InputConfig,
Key(..), KeyEvent(..), SpecialKey(..), MouseButton(..),
funBinding
) where
import Graphics.UI.FunGEn.Fun_Game
import Graphics.UI.FunGEn.UserInput
import Graphics.UI.GLUT
type InputConfig t s u v = (Key,KeyEvent,IOGame t s u v ())
funBinding :: [InputConfig t s u v] -> Game t s u v -> IO (KeyBinder, StillDownHandler)
funBinding inputs g = do
(bindKey, stillDown) <- initUserInput
mapM (userBinding g bindKey) inputs
return (bindKey, stillDown)
userBinding :: Game t s u v -> KeyBinder -> InputConfig t s u v -> IO ()
userBinding g bindKey (key,keyEvent,gameAction) = bindKey key keyEvent (Just (runIOGameM gameAction g))