-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Input handling abstractions for netwire
--
@package netwire-input
@version 0.0.4
-- | This module contains definitions for typeclasses and wires to be used
-- in FRP programs that use netwire. In order to use this module, an
-- implementation that provides an instance of one of the underlying
-- typeclasses MonadMouse or MonadKeyboard must be used. In
-- order to not require the GLFW or SDL libraries as dependencies, these
-- instances are provided in separate libraries.
module FRP.Netwire.Input
-- | Mouse button typeclass. This is used to constrain the type of Monad
-- used | to provide mouse input.
class MouseButton a
-- | The mouse cursor mode. This mode is usually dependent on whether or
-- not the mouse is in the bounds of the application window.
data CursorMode
-- | The mouse cursor is disabled
CursorMode'Disabled :: CursorMode
-- | Reset the cursor to zero between computations
CursorMode'Reset :: CursorMode
-- | The mouse cursor is hidden when over the application
CursorMode'Hidden :: CursorMode
-- | The mouse cursor is enabed and visible over the application
CursorMode'Enabled :: CursorMode
-- | This monad describes computations that involve mouse input.
class (MouseButton mb, Monad m) => MonadMouse mb m | m -> mb
setCursorMode :: MonadMouse mb m => CursorMode -> m ()
mbIsPressed :: MonadMouse mb m => mb -> m (Bool)
releaseButton :: MonadMouse mb m => mb -> m ()
cursor :: MonadMouse mb m => m (Float, Float)
scroll :: MonadMouse mb m => m (Double, Double)
-- | Ignores its input and returns the current normalized mouse
-- coordinates. Regardless of window size, each of the returned
-- coordinates will be in the range [-1, 1].
--
--
-- - Depends: now
-- - Inhibits: never
--
mouseCursor :: MonadMouse mb m => Wire s e m a (Float, Float)
-- | Returns the change in mouse coordinates between subsequent time
-- instants
--
--
-- - Depends: before now
-- - Inhibits: never
--
mouseDelta :: (MonadFix m, MonadMouse mb m) => Wire s e m a (Float, Float)
-- | The mouse mickies are the offset from zero at each time instant. If
-- this wire is being used, then it is assuming that the cursor mode is
-- set to CursorMode'Reset
--
--
-- - Depends: now
-- - Inhibits: never
--
mouseMickies :: MonadMouse mb m => Wire s e m a (Float, Float)
-- | Behaves like the identity wire when the mouse button is pressed and
-- inhibits otherwise
--
--
-- - Inhibits: when the mouse button is not pressed
--
mousePressed :: (Monoid e, MonadMouse mb m) => mb -> Wire s e m a a
-- | Ignores its input and returns True whenever the mouse button is
-- pressed
--
--
isMousePressed :: (Monoid e, MonadMouse mb m) => mb -> Wire s e m a Bool
-- | Behaves like the identity wire for a signle instant when the mouse
-- button is pressed and otherwise inhibits
--
--
-- - Depends: the instant at which the mouse button is pressed
-- - Inhibits: when the mouse button is not pressed or after it has
-- been pressed
--
mouseDebounced :: (Monoid e, MonadMouse mb m) => mb -> Wire s e m a a
-- | The mouse scroll is the offset from zero at each time instant.
--
--
-- - Depends: now
-- - Inhibits: never
--
mouseScroll :: (Monoid e, MonadMouse mb m) => Wire s e m a (Double, Double)
-- | The amount that the mouse has scrolled over the course of the entire
-- wire.
--
--
-- - Depends: now
-- - Inhibits: never
--
mouseScrolled :: (Monoid e, MonadMouse mb m) => Wire s e m a (Double, Double)
-- | Behaves like the identity wire, and inhibits immediately after setting
-- the cursor mode. Common uses of this wire are to switch it to the
-- identity wire: cursorMode CursorMode'Disabled --> mkId
--
--
-- - Inhibits: after now
--
cursorMode :: (MonadMouse mb m, Monoid e) => CursorMode -> Wire s e m a a
-- | Key typeclass. This is used to constrain the type of Monad used | to
-- provide keyboard input.
class Key a
-- | This monad describes computations that involve keyboard input.
class (Key k, Monad m) => MonadKeyboard k m | m -> k
keyIsPressed :: MonadKeyboard k m => k -> m (Bool)
releaseKey :: MonadKeyboard k m => k -> m ()
-- | Behaves like the identity wire when the key is pressed and inhibits
-- otherwise
--
--
-- - Inhibits: when the key is not pressed
--
keyPressed :: (Monoid e, MonadKeyboard k m) => k -> Wire s e m a a
-- | Ignores its input and returns True whenever the key is pressed
--
--
isKeyPressed :: (Monoid e, MonadKeyboard k m) => k -> Wire s e m a Bool
-- | Behaves like the identity wire when the key is not pressed and
-- inhibits otherwise
--
--
-- - Inhibits: when the key is pressed
--
keyNotPressed :: (Monoid e, MonadKeyboard k m) => k -> Wire s e m a a
-- | Behaves like the identity wire for a signle instant when the key is
-- pressed and otherwise inhibits
--
--
-- - Inhibits: when the key is not pressed or after it has been
-- pressed
--
keyDebounced :: (Monoid e, MonadKeyboard k m) => k -> Wire s e m a a
instance Ord CursorMode
instance Enum CursorMode
instance Eq CursorMode
instance Show CursorMode
instance Read CursorMode