netwire-input-glfw-0.0.4: GLFW instance of netwire-input

Copyright(c) Pavel Krajcevski, 2014
LicenseMIT
MaintainerKrajcevski@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

FRP.Netwire.Input.GLFW

Contents

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

Synopsis

GLFW Input

Basic Input Monad

type GLFWInput = State GLFWInputState Source

The GLFWInput monad is simply a state monad around the GLFWInputState

Monad Transformer

type GLFWInputT m = StateT GLFWInputState m Source

The GLFWInputT monad transformer is simply a state monad transformer using GLFWInputState

State Types

data GLFWInputControl Source

This is an STM variable that holds the current input state. It cannot be manipulated directly, but it is updated by GLFW each time pollGLFW is called.

data GLFWInputState Source

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.

getInput :: GLFWInputControl -> IO GLFWInputState Source

Returns a current snapshot of the input

mkInputControl :: Window -> IO GLFWInputControl Source

Creates and returns an STM variable for the window that holds all of the most recent input state information

pollGLFW :: GLFWInputState -> GLFWInputControl -> IO GLFWInputState Source

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