-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | GLFW instance of netwire-input
--   
--   This package contains the necessary glue to allow the use of wires
--   from the netwire-input package. In general, the types associated here
--   should be used only sparingly to plumb the input state through your
--   netwire program. Otherwise, the state should not be modified directly.
@package netwire-input-glfw
@version 0.0.10


-- | This module contains data types with instances needed to create wires
--   that can be used with the netwire-input combinators. In particular,
--   this package implements <a>GLFWInputT</a> which has instances of
--   <a>MonadKeyboard</a> and <a>MonadMouse</a>
module FRP.Netwire.Input.GLFW

-- | The <a>GLFWInput</a> monad is simply the <a>GLFWInputT</a> transformer
--   around the identity monad.
type GLFWInput = GLFWInputT Identity

-- | Runs the <a>GLFWInput</a> computation with a current input snapshot
--   and returns the potentially modified input.
runGLFWInput :: GLFWInput a -> GLFWInputState -> (a, GLFWInputState)

-- | The <a>GLFWInputT</a> monad transformer is simply a state monad
--   transformer using <a>GLFWInputState</a>
data GLFWInputT m a

-- | To execute a computation with the current input snapshot, we need to
--   give supply the current <a>GLFWInputState</a>. This comes from the
--   <a>GLFWInputControl</a> associated with the given window.
runGLFWInputT :: GLFWInputT m a -> GLFWInputState -> m (a, GLFWInputState)

-- | Describes a monad that provides stateful access to a
--   <a>GLFWInputState</a>. By being able to modify the state, the context
--   that satisfies this typeclass can decide to debounce or "take
--   ownership" of the button presses at a specific point of the
--   computation. This should be done via the <tt>MonadKey</tt> and
--   <a>MonadMouse</a> instances.
class Monad m => MonadGLFWInput m

-- | Retrieves the current input state
getGLFWInput :: MonadGLFWInput m => m GLFWInputState

-- | Places a modified input state back into the context. This should
--   probably not be called directly.
putGLFWInput :: MonadGLFWInput m => GLFWInputState -> m ()

-- | This is an <a>STM</a> variable that holds the current input state. It
--   cannot be manipulated directly, but it is updated by GLFW each time
--   <a>pollGLFW</a> is called.
data GLFWInputControl

-- | The GLFW input state is a record that keeps track of which buttons and
--   keys are currently pressed. Because GLFW works with callbacks, a call
--   to pollEvents must be made in order to process any of the events. At
--   this time, all of the appropriate callbacks are fired in order of the
--   events received, and this record is updated to reflect the most recent
--   input state.
data GLFWInputState

-- | Returns a current snapshot of the input
getInput :: GLFWInputControl -> IO GLFWInputState

-- | Creates and returns an <a>STM</a> variable for the window that holds
--   all of the most recent input state information
mkInputControl :: Window -> IO GLFWInputControl

-- | Allows GLFW to interact with the windowing system to update the
--   current state. The old state must be passed in order to properly reset
--   certain properties such as the scroll wheel. The returned input state
--   is identical to a subsequent call to <a>getInput</a> right after a
--   call to <a>pollEvents</a>
pollGLFW :: GLFWInputState -> GLFWInputControl -> IO GLFWInputState
instance Control.Monad.Trans.Class.MonadTrans FRP.Netwire.Input.GLFW.GLFWInputT
instance Control.Monad.Cont.Class.MonadCont m => Control.Monad.Cont.Class.MonadCont (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance GHC.Base.MonadPlus m => GHC.Base.MonadPlus (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance Control.Monad.Error.Class.MonadError e m => Control.Monad.Error.Class.MonadError e (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance Control.Monad.Reader.Class.MonadReader r m => Control.Monad.Reader.Class.MonadReader r (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance Control.Monad.Writer.Class.MonadWriter w m => Control.Monad.Writer.Class.MonadWriter w (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance Control.Monad.IO.Class.MonadIO m => Control.Monad.IO.Class.MonadIO (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance Control.Monad.Fix.MonadFix m => Control.Monad.Fix.MonadFix (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance GHC.Base.Monad m => GHC.Base.Monad (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance GHC.Base.MonadPlus m => GHC.Base.Alternative (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance GHC.Base.Monad m => GHC.Base.Applicative (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance GHC.Base.Functor m => GHC.Base.Functor (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance GHC.Generics.Generic FRP.Netwire.Input.GLFW.GLFWInputState
instance GHC.Show.Show FRP.Netwire.Input.GLFW.GLFWInputState
instance GHC.Base.Monad m => FRP.Netwire.Input.GLFW.MonadGLFWInput (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance FRP.Netwire.Input.GLFW.MonadGLFWInput m => FRP.Netwire.Input.MonadKeyboard Graphics.UI.GLFW.Types.Key m
instance FRP.Netwire.Input.GLFW.MonadGLFWInput m => FRP.Netwire.Input.MonadMouse Graphics.UI.GLFW.Types.MouseButton m
instance Control.Monad.State.Class.MonadState s m => Control.Monad.State.Class.MonadState s (FRP.Netwire.Input.GLFW.GLFWInputT m)
instance Control.DeepSeq.NFData FRP.Netwire.Input.GLFW.GLFWInputState
instance FRP.Netwire.Input.Key Graphics.UI.GLFW.Types.Key
instance FRP.Netwire.Input.MouseButton Graphics.UI.GLFW.Types.MouseButton
