module Graphics.UI.Fungen.Input (
        InputConfig,
        Key(..), KeyEvent(..), SpecialKey(..), MouseButton(..),
        funBinding
) where
import Graphics.UI.Fungen.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))