module Graphics.GPipe.Context.GLFW.Input
(
getCursorPos,
getMouseButton,
getKey,
windowShouldClose,
MouseButtonState(..), MouseButton(..), KeyState(..), Key(..)
) where
import Graphics.GPipe.Context.GLFW.Unsafe (GLFWWindow(..))
import Control.Monad.IO.Class (MonadIO)
import Graphics.GPipe.Context (ContextT, withContextWindow)
import qualified Graphics.UI.GLFW as GLFW (getCursorPos, getMouseButton, getKey, windowShouldClose)
import Graphics.UI.GLFW (MouseButtonState(..), MouseButton(..), KeyState(..), Key(..))
getCursorPos :: MonadIO m => ContextT GLFWWindow os f m (Double, Double)
getCursorPos = withContextWindow (GLFW.getCursorPos . getGLFWWindow)
getMouseButton :: MonadIO m => MouseButton -> ContextT GLFWWindow os f m MouseButtonState
getMouseButton mb = withContextWindow (\(GLFWWindow w) -> GLFW.getMouseButton w mb)
getKey :: MonadIO m => Key -> ContextT GLFWWindow os f m KeyState
getKey k = withContextWindow (\(GLFWWindow w) -> GLFW.getKey w k)
windowShouldClose :: MonadIO m => ContextT GLFWWindow os f m Bool
windowShouldClose = withContextWindow (GLFW.windowShouldClose . getGLFWWindow)