Copyright | (c) Pavel Krajcevski 2014 |
---|---|
License | MIT |
Maintainer | Krajcevski@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
FRP.Netwire.Input.GLFW
Description
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 GLFWInputT
which has instances of MonadKeyboard
and
MonadMouse
- type GLFWInput = GLFWInputT Identity
- runGLFWInput :: GLFWInput a -> GLFWInputState -> (a, GLFWInputState)
- data GLFWInputT m a
- runGLFWInputT :: GLFWInputT m a -> GLFWInputState -> m (a, GLFWInputState)
- data GLFWInputControl
- data GLFWInputState
- getInput :: GLFWInputControl -> IO GLFWInputState
- mkInputControl :: Window -> IO GLFWInputControl
- pollGLFW :: GLFWInputState -> GLFWInputControl -> IO GLFWInputState
GLFW Input
Basic Input Monad
type GLFWInput = GLFWInputT Identity #
The GLFWInput
monad is simply the GLFWInputT transformer around the
identity monad.
runGLFWInput :: GLFWInput a -> GLFWInputState -> (a, GLFWInputState) #
Monad Transformer
data GLFWInputT m a #
The GLFWInputT
monad transformer is simply a state monad transformer using
GLFWInputState
Instances
MonadTrans GLFWInputT # | |
MonadError e m => MonadError e (GLFWInputT m) # | |
MonadReader r m => MonadReader r (GLFWInputT m) # | |
MonadWriter w m => MonadWriter w (GLFWInputT m) # | |
Monad m => MonadMouse MouseButton (GLFWInputT m) # | |
Monad m => MonadKeyboard Key (GLFWInputT m) # | |
Monad m => Monad (GLFWInputT m) # | |
Functor m => Functor (GLFWInputT m) # | |
MonadFix m => MonadFix (GLFWInputT m) # | |
Monad m => Applicative (GLFWInputT m) # | |
MonadIO m => MonadIO (GLFWInputT m) # | |
MonadPlus m => Alternative (GLFWInputT m) # | |
MonadPlus m => MonadPlus (GLFWInputT m) # | |
MonadCont m => MonadCont (GLFWInputT m) # | |
runGLFWInputT :: GLFWInputT m a -> GLFWInputState -> m (a, GLFWInputState) #
State Types
data GLFWInputControl #
data GLFWInputState #
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.
Instances
getInput :: GLFWInputControl -> IO GLFWInputState #
Returns a current snapshot of the input
mkInputControl :: Window -> IO GLFWInputControl #
Creates and returns an STM
variable for the window that holds all of the
most recent input state information
pollGLFW :: GLFWInputState -> GLFWInputControl -> IO GLFWInputState #
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 getInput
right after a call to pollEvents