GPipe-GLFW 1.1 → 1.2.1
raw patch · 5 files changed
+167/−50 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Graphics.GPipe.Context.GLFW: [Key'0] :: Key
- Graphics.GPipe.Context.GLFW: [Key'1] :: Key
- Graphics.GPipe.Context.GLFW: [Key'2] :: Key
- Graphics.GPipe.Context.GLFW: [Key'3] :: Key
- Graphics.GPipe.Context.GLFW: [Key'4] :: Key
- Graphics.GPipe.Context.GLFW: [Key'5] :: Key
- Graphics.GPipe.Context.GLFW: [Key'6] :: Key
- Graphics.GPipe.Context.GLFW: [Key'7] :: Key
- Graphics.GPipe.Context.GLFW: [Key'8] :: Key
- Graphics.GPipe.Context.GLFW: [Key'9] :: Key
- Graphics.GPipe.Context.GLFW: [Key'A] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Apostrophe] :: Key
- Graphics.GPipe.Context.GLFW: [Key'B] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Backslash] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Backspace] :: Key
- Graphics.GPipe.Context.GLFW: [Key'C] :: Key
- Graphics.GPipe.Context.GLFW: [Key'CapsLock] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Comma] :: Key
- Graphics.GPipe.Context.GLFW: [Key'D] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Delete] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Down] :: Key
- Graphics.GPipe.Context.GLFW: [Key'E] :: Key
- Graphics.GPipe.Context.GLFW: [Key'End] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Enter] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Equal] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Escape] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F10] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F11] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F12] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F13] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F14] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F15] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F16] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F17] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F18] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F19] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F1] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F20] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F21] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F22] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F23] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F24] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F25] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F2] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F3] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F4] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F5] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F6] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F7] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F8] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F9] :: Key
- Graphics.GPipe.Context.GLFW: [Key'F] :: Key
- Graphics.GPipe.Context.GLFW: [Key'G] :: Key
- Graphics.GPipe.Context.GLFW: [Key'GraveAccent] :: Key
- Graphics.GPipe.Context.GLFW: [Key'H] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Home] :: Key
- Graphics.GPipe.Context.GLFW: [Key'I] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Insert] :: Key
- Graphics.GPipe.Context.GLFW: [Key'J] :: Key
- Graphics.GPipe.Context.GLFW: [Key'K] :: Key
- Graphics.GPipe.Context.GLFW: [Key'L] :: Key
- Graphics.GPipe.Context.GLFW: [Key'LeftAlt] :: Key
- Graphics.GPipe.Context.GLFW: [Key'LeftBracket] :: Key
- Graphics.GPipe.Context.GLFW: [Key'LeftControl] :: Key
- Graphics.GPipe.Context.GLFW: [Key'LeftShift] :: Key
- Graphics.GPipe.Context.GLFW: [Key'LeftSuper] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Left] :: Key
- Graphics.GPipe.Context.GLFW: [Key'M] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Menu] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Minus] :: Key
- Graphics.GPipe.Context.GLFW: [Key'N] :: Key
- Graphics.GPipe.Context.GLFW: [Key'NumLock] :: Key
- Graphics.GPipe.Context.GLFW: [Key'O] :: Key
- Graphics.GPipe.Context.GLFW: [Key'P] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Pad0] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Pad1] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Pad2] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Pad3] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Pad4] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Pad5] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Pad6] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Pad7] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Pad8] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Pad9] :: Key
- Graphics.GPipe.Context.GLFW: [Key'PadAdd] :: Key
- Graphics.GPipe.Context.GLFW: [Key'PadDecimal] :: Key
- Graphics.GPipe.Context.GLFW: [Key'PadDivide] :: Key
- Graphics.GPipe.Context.GLFW: [Key'PadEnter] :: Key
- Graphics.GPipe.Context.GLFW: [Key'PadEqual] :: Key
- Graphics.GPipe.Context.GLFW: [Key'PadMultiply] :: Key
- Graphics.GPipe.Context.GLFW: [Key'PadSubtract] :: Key
- Graphics.GPipe.Context.GLFW: [Key'PageDown] :: Key
- Graphics.GPipe.Context.GLFW: [Key'PageUp] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Pause] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Period] :: Key
- Graphics.GPipe.Context.GLFW: [Key'PrintScreen] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Q] :: Key
- Graphics.GPipe.Context.GLFW: [Key'R] :: Key
- Graphics.GPipe.Context.GLFW: [Key'RightAlt] :: Key
- Graphics.GPipe.Context.GLFW: [Key'RightBracket] :: Key
- Graphics.GPipe.Context.GLFW: [Key'RightControl] :: Key
- Graphics.GPipe.Context.GLFW: [Key'RightShift] :: Key
- Graphics.GPipe.Context.GLFW: [Key'RightSuper] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Right] :: Key
- Graphics.GPipe.Context.GLFW: [Key'S] :: Key
- Graphics.GPipe.Context.GLFW: [Key'ScrollLock] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Semicolon] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Slash] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Space] :: Key
- Graphics.GPipe.Context.GLFW: [Key'T] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Tab] :: Key
- Graphics.GPipe.Context.GLFW: [Key'U] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Unknown] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Up] :: Key
- Graphics.GPipe.Context.GLFW: [Key'V] :: Key
- Graphics.GPipe.Context.GLFW: [Key'W] :: Key
- Graphics.GPipe.Context.GLFW: [Key'World1] :: Key
- Graphics.GPipe.Context.GLFW: [Key'World2] :: Key
- Graphics.GPipe.Context.GLFW: [Key'X] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Y] :: Key
- Graphics.GPipe.Context.GLFW: [Key'Z] :: Key
- Graphics.GPipe.Context.GLFW: [KeyState'Pressed] :: KeyState
- Graphics.GPipe.Context.GLFW: [KeyState'Released] :: KeyState
- Graphics.GPipe.Context.GLFW: [KeyState'Repeating] :: KeyState
- Graphics.GPipe.Context.GLFW: [MouseButton'1] :: MouseButton
- Graphics.GPipe.Context.GLFW: [MouseButton'2] :: MouseButton
- Graphics.GPipe.Context.GLFW: [MouseButton'3] :: MouseButton
- Graphics.GPipe.Context.GLFW: [MouseButton'4] :: MouseButton
- Graphics.GPipe.Context.GLFW: [MouseButton'5] :: MouseButton
- Graphics.GPipe.Context.GLFW: [MouseButton'6] :: MouseButton
- Graphics.GPipe.Context.GLFW: [MouseButton'7] :: MouseButton
- Graphics.GPipe.Context.GLFW: [MouseButton'8] :: MouseButton
- Graphics.GPipe.Context.GLFW: [MouseButtonState'Pressed] :: MouseButtonState
- Graphics.GPipe.Context.GLFW: [MouseButtonState'Released] :: MouseButtonState
- Graphics.GPipe.Context.GLFW: data Key :: *
- Graphics.GPipe.Context.GLFW: data KeyState :: *
- Graphics.GPipe.Context.GLFW: data MouseButton :: *
- Graphics.GPipe.Context.GLFW: data MouseButtonState :: *
- Graphics.GPipe.Context.GLFW: getCursorPos :: MonadIO m => ContextT GLFWWindow os f m (Double, Double)
- Graphics.GPipe.Context.GLFW: getKey :: MonadIO m => Key -> ContextT GLFWWindow os f m KeyState
- Graphics.GPipe.Context.GLFW: getMouseButton :: MonadIO m => MouseButton -> ContextT GLFWWindow os f m MouseButtonState
- Graphics.GPipe.Context.GLFW: windowShouldClose :: MonadIO m => ContextT GLFWWindow os f m Bool
+ Graphics.GPipe.Context.GLFW: BadWindowHintsException :: [WindowHint] -> BadWindowHintsException
+ Graphics.GPipe.Context.GLFW: WindowConf :: Int -> Int -> String -> WindowConf
+ Graphics.GPipe.Context.GLFW: [height] :: WindowConf -> Int
+ Graphics.GPipe.Context.GLFW: [title] :: WindowConf -> String
+ Graphics.GPipe.Context.GLFW: [width] :: WindowConf -> Int
+ Graphics.GPipe.Context.GLFW: data BadWindowHintsException
+ Graphics.GPipe.Context.GLFW: data WindowConf
+ Graphics.GPipe.Context.GLFW: defaultWindowConf :: WindowConf
+ Graphics.GPipe.Context.GLFW: instance GHC.Exception.Exception Graphics.GPipe.Context.GLFW.BadWindowHintsException
+ Graphics.GPipe.Context.GLFW: instance GHC.Show.Show Graphics.GPipe.Context.GLFW.BadWindowHintsException
+ Graphics.GPipe.Context.GLFW: newContext' :: [WindowHint] -> WindowConf -> ContextFactory c ds GLFWWindow
+ Graphics.GPipe.Context.GLFW.Input: Key'0 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'1 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'2 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'3 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'4 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'5 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'6 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'7 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'8 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'9 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'A :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Apostrophe :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'B :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Backslash :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Backspace :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'C :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'CapsLock :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Comma :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'D :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Delete :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Down :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'E :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'End :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Enter :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Equal :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Escape :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F1 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F10 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F11 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F12 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F13 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F14 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F15 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F16 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F17 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F18 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F19 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F2 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F20 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F21 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F22 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F23 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F24 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F25 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F3 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F4 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F5 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F6 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F7 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F8 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'F9 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'G :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'GraveAccent :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'H :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Home :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'I :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Insert :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'J :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'K :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'L :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Left :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'LeftAlt :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'LeftBracket :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'LeftControl :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'LeftShift :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'LeftSuper :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'M :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Menu :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Minus :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'N :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'NumLock :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'O :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'P :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Pad0 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Pad1 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Pad2 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Pad3 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Pad4 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Pad5 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Pad6 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Pad7 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Pad8 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Pad9 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'PadAdd :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'PadDecimal :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'PadDivide :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'PadEnter :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'PadEqual :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'PadMultiply :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'PadSubtract :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'PageDown :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'PageUp :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Pause :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Period :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'PrintScreen :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Q :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'R :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Right :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'RightAlt :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'RightBracket :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'RightControl :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'RightShift :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'RightSuper :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'S :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'ScrollLock :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Semicolon :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Slash :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Space :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'T :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Tab :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'U :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Unknown :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Up :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'V :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'W :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'World1 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'World2 :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'X :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Y :: Key
+ Graphics.GPipe.Context.GLFW.Input: Key'Z :: Key
+ Graphics.GPipe.Context.GLFW.Input: KeyState'Pressed :: KeyState
+ Graphics.GPipe.Context.GLFW.Input: KeyState'Released :: KeyState
+ Graphics.GPipe.Context.GLFW.Input: KeyState'Repeating :: KeyState
+ Graphics.GPipe.Context.GLFW.Input: MouseButton'1 :: MouseButton
+ Graphics.GPipe.Context.GLFW.Input: MouseButton'2 :: MouseButton
+ Graphics.GPipe.Context.GLFW.Input: MouseButton'3 :: MouseButton
+ Graphics.GPipe.Context.GLFW.Input: MouseButton'4 :: MouseButton
+ Graphics.GPipe.Context.GLFW.Input: MouseButton'5 :: MouseButton
+ Graphics.GPipe.Context.GLFW.Input: MouseButton'6 :: MouseButton
+ Graphics.GPipe.Context.GLFW.Input: MouseButton'7 :: MouseButton
+ Graphics.GPipe.Context.GLFW.Input: MouseButton'8 :: MouseButton
+ Graphics.GPipe.Context.GLFW.Input: MouseButtonState'Pressed :: MouseButtonState
+ Graphics.GPipe.Context.GLFW.Input: MouseButtonState'Released :: MouseButtonState
+ Graphics.GPipe.Context.GLFW.Input: data Key :: *
+ Graphics.GPipe.Context.GLFW.Input: data KeyState :: *
+ Graphics.GPipe.Context.GLFW.Input: data MouseButton :: *
+ Graphics.GPipe.Context.GLFW.Input: data MouseButtonState :: *
+ Graphics.GPipe.Context.GLFW.Input: getCursorPos :: MonadIO m => ContextT GLFWWindow os f m (Double, Double)
+ Graphics.GPipe.Context.GLFW.Input: getKey :: MonadIO m => Key -> ContextT GLFWWindow os f m KeyState
+ Graphics.GPipe.Context.GLFW.Input: getMouseButton :: MonadIO m => MouseButton -> ContextT GLFWWindow os f m MouseButtonState
+ Graphics.GPipe.Context.GLFW.Input: windowShouldClose :: MonadIO m => ContextT GLFWWindow os f m Bool
+ Graphics.GPipe.Context.GLFW.Unsafe: GLFWWindow :: Window -> GLFWWindow
+ Graphics.GPipe.Context.GLFW.Unsafe: [getGLFWWindow] :: GLFWWindow -> Window
+ Graphics.GPipe.Context.GLFW.Unsafe: newtype GLFWWindow
Files
- GPipe-GLFW.cabal +4/−2
- src/Graphics/GPipe/Context/GLFW.hs +88/−45
- src/Graphics/GPipe/Context/GLFW/Input.hs +37/−0
- src/Graphics/GPipe/Context/GLFW/Resource.hs +18/−3
- src/Graphics/GPipe/Context/GLFW/Unsafe.hs +20/−0
GPipe-GLFW.cabal view
@@ -1,5 +1,5 @@ name: GPipe-GLFW-version: 1.1+version: 1.2.1 cabal-version: >=1.10 build-type: Simple author: Patrick Redmond@@ -26,6 +26,8 @@ ghc-options: -Wall default-language: Haskell2010 exposed-modules: Graphics.GPipe.Context.GLFW+ , Graphics.GPipe.Context.GLFW.Input+ , Graphics.GPipe.Context.GLFW.Unsafe other-modules: Graphics.GPipe.Context.GLFW.Resource Graphics.GPipe.Context.GLFW.Util@@ -40,4 +42,4 @@ type: git location: git@github.com:plredmond/GPipe-GLFW.git subdir: GPipe-GLFW- tag: v1.1+ tag: v1.2.1
src/Graphics/GPipe/Context/GLFW.hs view
@@ -1,22 +1,31 @@-{-# LANGUAGE RankNTypes, GADTs #-}+{-# LANGUAGE RankNTypes, GADTs, DeriveDataTypeable #-} module Graphics.GPipe.Context.GLFW-( newContext,+(+ -- * Creating contexts+ newContext,+ newContext',+ -- * Data types+ BadWindowHintsException(..), GLFWWindow(),- getCursorPos, getMouseButton, getKey, windowShouldClose,- MouseButtonState(..), MouseButton(..), KeyState(..), Key(..),+ WindowConf(..), defaultWindowConf,+ -- * Re-exported window actions+ module Input ) where -import qualified Control.Concurrent as C import qualified Graphics.GPipe.Context.GLFW.Format as Format+import Graphics.GPipe.Context.GLFW.Input as Input import qualified Graphics.GPipe.Context.GLFW.Resource as Resource+import Graphics.GPipe.Context.GLFW.Resource (WindowConf, defaultWindowConf, GLFWWindow(..)) import qualified Graphics.GPipe.Context.GLFW.Util as Util-import qualified Graphics.UI.GLFW as GLFW (getCursorPos, getMouseButton, getKey, windowShouldClose, makeContextCurrent, destroyWindow, pollEvents) -import Control.Monad.IO.Class (MonadIO)-import Graphics.GPipe.Context (ContextFactory, ContextHandle(..),ContextT,withContextWindow)-import Graphics.UI.GLFW (MouseButtonState(..), MouseButton(..), KeyState(..), Key(..))+import qualified Control.Concurrent as C+import qualified Graphics.UI.GLFW as GLFW (makeContextCurrent, destroyWindow, pollEvents)+import Graphics.GPipe.Context (ContextFactory, ContextHandle(..))+import Graphics.UI.GLFW (WindowHint(..)) import Data.IORef-import Control.Monad (when)+import Control.Monad (when, unless)+import Control.Exception (Exception, throwIO)+import Data.Typeable (Typeable) data Message where ReqShutDown :: C.MVar () -> Message@@ -26,27 +35,61 @@ ------------------------------------------------------------------------------ -- Top-level --- | An opaque value representing a GLFW OpenGL context window.-newtype GLFWWindow = GLFWWindow { unGLFWWindow :: Resource.Window }+-- | An exception which is thrown when you try to use 'WindowHint's that need to+-- be controlled by this library. Contains a list of the offending hints.+data BadWindowHintsException = BadWindowHintsException [WindowHint]+ deriving (Show, Typeable) +instance Exception BadWindowHintsException+ -- | The context factory which facilitates use of GLFW with GPipe.--- This has to be run from the main thread.+-- This has to be run from the main thread. newContext :: ContextFactory c ds GLFWWindow-newContext fmt = do+newContext = newContext' [] defaultWindowConf++-- | The context factory which facilitates use of GLFW with GPipe.+-- This has to be run from the main thread.+--+-- Accepts two extra parameters compared to 'newContext': a list of GLFW+-- 'WindowHint's and a 'WindowConf' which determines the width, height and title+-- of the window.+--+-- Throws a 'BadWindowHintsException' if you use hints that need to be+-- controlled by this library. Disallowed hints are:+--+-- > WindowHint'sRGBCapable+-- > WindowHint'Visible+-- > WindowHint'RedBits+-- > WindowHint'GreenBits+-- > WindowHint'BlueBits+-- > WindowHint'AlphaBits+-- > WindowHint'DepthBits+-- > WindowHint'StencilBits+-- > WindowHint'ContextVersionMajor+-- > WindowHint'ContextVersionMinor+-- > WindowHint'OpenGLForwardCompat+-- > WindowHint'OpenGLProfile+--+newContext' :: [WindowHint] -> WindowConf -> ContextFactory c ds GLFWWindow+newContext' extraHints conf fmt = do+ let badHints = filter (not . allowedHint) extraHints+ unless (null badHints) $+ throwIO (BadWindowHintsException badHints)+ chReply <- C.newEmptyMVar _ <- C.forkOS $ begin chReply msgC <- C.takeMVar chReply- h <- createContext msgC Nothing fmt + h <- createContext extraHints conf msgC Nothing fmt contextDoAsync h True (return ()) -- First action on render thread: Just make window current- return h + return h -createContext :: C.Chan Message -> Maybe Resource.Window -> ContextFactory c ds GLFWWindow-createContext msgC share fmt = do+createContext :: [WindowHint] -> WindowConf -> C.Chan Message -> Maybe Resource.Window -> ContextFactory c ds GLFWWindow+createContext extraHints conf msgC share fmt = do w <- makeContext share GLFW.makeContextCurrent Nothing alive <- newIORef True -- This will always be used from render thread so no need to synchronize return ContextHandle- { newSharedContext = mainthreadDoWhileContextUncurrent msgC w . createContext msgC (Just w) -- Create context on this thread while parent is uncurrent, then make parent current+ { newSharedContext = mainthreadDoWhileContextUncurrent msgC w . createContext extraHints conf msgC (Just w) -- Create context on this thread while parent is uncurrent, then make parent current , contextDoSync = contextDoSyncImpl w msgC , contextDoAsync = contextDoAsyncImpl alive w msgC , contextSwap = contextDoSyncImpl w msgC False $ Util.swapBuffers w -- explicitly do it on the render thread to sync properly, GLFW allows this@@ -58,11 +101,26 @@ , contextWindow = GLFWWindow w } where- hints = Format.toHints fmt+ hints = Format.toHints fmt ++ extraHints makeContext :: Maybe Resource.Window -> IO Resource.Window- makeContext Nothing = Resource.newContext Nothing hints Nothing- makeContext (Just s) = Resource.newSharedContext s hints Nothing+ makeContext Nothing = Resource.newContext Nothing hints (Just conf)+ makeContext (Just s) = Resource.newSharedContext s hints (Just conf) +-- | Is the user allowed to use the given WindowHint?+allowedHint :: WindowHint -> Bool+allowedHint (WindowHint'sRGBCapable _) = False+allowedHint (WindowHint'Visible _) = False+allowedHint (WindowHint'RedBits _) = False+allowedHint (WindowHint'GreenBits _) = False+allowedHint (WindowHint'BlueBits _) = False+allowedHint (WindowHint'AlphaBits _) = False+allowedHint (WindowHint'DepthBits _) = False+allowedHint (WindowHint'StencilBits _) = False+allowedHint (WindowHint'ContextVersionMajor _) = False+allowedHint (WindowHint'ContextVersionMinor _) = False+allowedHint (WindowHint'OpenGLForwardCompat _) = False+allowedHint (WindowHint'OpenGLProfile _) = False+allowedHint _ = True ------------------------------------------------------------------------------ -- OpenGL Context thread@@ -93,32 +151,32 @@ C.writeChan msgC $ ReqExecuteSync (do when inwin (GLFW.makeContextCurrent (Just w)) action) reply- GLFW.pollEvents -- Ugly hack, but at least every swapContextBuffers will run this + GLFW.pollEvents -- Ugly hack, but at least every swapContextBuffers will run this C.takeMVar reply -- Dispatch asychronous concurrent IO to the OpenGL context thread contextDoAsyncImpl :: IORef Bool -> Resource.Window -> C.Chan Message -> Bool -> IO () -> IO () contextDoAsyncImpl alive w msgC inwin action =- C.writeChan msgC $ ReqExecuteAsync $ if inwin + C.writeChan msgC $ ReqExecuteAsync $ if inwin then do -- If needed to be run in this window, then only do it if window still exists- alive' <- readIORef alive - when alive' $ do + alive' <- readIORef alive+ when alive' $ do GLFW.makeContextCurrent (Just w) action else action --- Do action while renderhtread is uncurrent +-- Do action while renderhtread is uncurrent mainthreadDoWhileContextUncurrent :: C.Chan Message -> Resource.Window -> IO a -> IO a mainthreadDoWhileContextUncurrent msgC w mainAction = do syncMainWait <- C.newEmptyMVar syncRendWait <- C.newEmptyMVar let m = do GLFW.makeContextCurrent Nothing- C.putMVar syncMainWait () + C.putMVar syncMainWait () C.takeMVar syncRendWait -- Stop other async code from making window current (e.g. finalizers) GLFW.makeContextCurrent (Just w)- - C.writeChan msgC $ ReqExecuteAsync m ++ C.writeChan msgC $ ReqExecuteAsync m C.takeMVar syncMainWait -- Wait for render thread to make window uncurrent ret <- mainAction C.putMVar syncRendWait () -- Release render thread@@ -130,20 +188,5 @@ syncMainWait <- C.newEmptyMVar C.writeChan msgC $ ReqShutDown syncMainWait C.takeMVar syncMainWait----------------------------------------------------------------------------------- Exposed window actions--getCursorPos :: MonadIO m => ContextT GLFWWindow os f m (Double, Double)-getCursorPos = withContextWindow (GLFW.getCursorPos . unGLFWWindow)--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 . unGLFWWindow) -- eof
+ src/Graphics/GPipe/Context/GLFW/Input.hs view
@@ -0,0 +1,37 @@+-- | Window actions, mostly corresponding to user input. Analogous to those from+-- 'Graphics.UI.GLFW', but in the GPipe 'ContextT' monad.+module Graphics.GPipe.Context.GLFW.Input+(+ -- * Exposed actions+ getCursorPos,+ getMouseButton,+ getKey,+ windowShouldClose,+ -- * Re-exported from GLFW+ 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(..))++-- | Gets the current cursor position, in pixels relative to the top-left corner+-- of the window.+getCursorPos :: MonadIO m => ContextT GLFWWindow os f m (Double, Double)+getCursorPos = withContextWindow (GLFW.getCursorPos . getGLFWWindow)++-- | Gets the state of the specified 'MouseButton'.+getMouseButton :: MonadIO m => MouseButton -> ContextT GLFWWindow os f m MouseButtonState+getMouseButton mb = withContextWindow (\(GLFWWindow w) -> GLFW.getMouseButton w mb)++-- | Gets the state of the specified 'Key'.+getKey :: MonadIO m => Key -> ContextT GLFWWindow os f m KeyState+getKey k = withContextWindow (\(GLFWWindow w) -> GLFW.getKey w k)++-- | Returns 'True' if the window should close (e.g. because the user pressed+-- the \'x\' button).+windowShouldClose :: MonadIO m => ContextT GLFWWindow os f m Bool+windowShouldClose = withContextWindow (GLFW.windowShouldClose . getGLFWWindow)
src/Graphics/GPipe/Context/GLFW/Resource.hs view
@@ -1,9 +1,12 @@ {-# LANGUAGE PackageImports #-}--- Bracketed GLFW resource initializers+{-# LANGUAGE CPP #-}+-- | Bracketed GLFW resource initializers. module Graphics.GPipe.Context.GLFW.Resource ( newContext , newSharedContext-, WindowConf+, WindowConf(..)+, GLFWWindow(..)+, defaultWindowConf , Window , ErrorCallback ) where@@ -13,11 +16,19 @@ import qualified Data.Maybe as M import qualified Text.Printf as P +#if __GLASGOW_HASKELL__ < 710 import Control.Applicative ((<$>))+#endif ------------------------------------------------------------------------------ -- Types & Constants +-- | A value representing a GLFW OpenGL context window.+newtype GLFWWindow = GLFWWindow+ {+ getGLFWWindow :: GLFW.Window+ }+ -- reexports type Window = GLFW.Window type ErrorCallback = GLFW.ErrorCallback@@ -26,13 +37,17 @@ defaultOnError :: ErrorCallback defaultOnError err msg = fail $ P.printf "%s: %s" (show err) msg --- initial window size & title suggestions+-- | Initial window size and title suggestions for GLFW. The window will usually+-- be set to the given size with the given title, unless the window manager+-- overrides this. data WindowConf = WindowConf { width :: Int , height :: Int , title :: String } +-- | A set of sensible defaults for the 'WindowConf'. Used by+-- 'Graphics.GPipe.Context.GLFW.newContext'. defaultWindowConf :: WindowConf defaultWindowConf = WindowConf 1024 768 "GLFW Window"
+ src/Graphics/GPipe/Context/GLFW/Unsafe.hs view
@@ -0,0 +1,20 @@+-- | Exposes some underlying implementation details which can be used to+-- gain access to 'Graphics.UI.GLFW' functionality that isn't exposed by this+-- library otherwise, but which can be dangerous if used incorrectly.+--+-- The underlying 'Graphics.UI.GLFW.Window' object can be retrieved from a+-- 'GLFWWindow' using 'getGLFWWindow'.It can be used inside a+-- 'Graphics.GPipe.Context.ContextT' as follows:+--+-- > withContextWindow (\win -> doSomething (getGLFWWindow win))+--+-- Bear in mind that it is possible to do bad things with this. For example, using+-- 'GLFW.makeContextCurrent' could cause GPipe to lose control of the window,+-- and 'GLFW.destroyWindow' is bad for obvious reasons.+--+-- See 'Graphics.GPipe.Context.GLFW.Input' for concrete examples.+module Graphics.GPipe.Context.GLFW.Unsafe+ ( GLFWWindow(..) )+ where++import Graphics.GPipe.Context.GLFW.Resource (GLFWWindow(..))