GLFW-b 1.4.8.3 → 1.4.8.4
raw patch · 2 files changed
+52/−59 lines, 2 filesdep ~bindings-GLFWPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: bindings-GLFW
API changes (from Hackage documentation)
Files
- GLFW-b.cabal +7/−6
- Graphics/UI/GLFW/C.hs +45/−53
GLFW-b.cabal view
@@ -1,5 +1,5 @@ name: GLFW-b-version: 1.4.8.3+version: 1.4.8.4 category: Graphics author: Brian Lewis <brian@lorf.org>@@ -16,9 +16,10 @@ . GLFW-b depends on bindings-GLFW (<http://hackage.haskell.org/package/bindings-GLFW>), which, as of the time- of this writing, binds to GLFW 3.1, released 2015-01-18- (<http://www.glfw.org/Version-3.1-released.html>- <http://www.glfw.org/changelog.html>).+ of this writing, binds to GLFW 3.2.1, released 2016-08-18+ (<http://www.glfw.org/Version-3.2.1-released.html>+ <http://www.glfw.org/changelog.html>). However, these high-level bindings only+ point to some of the new features in 3.1 and 3.2. . If you've used GLFW < 3 before, you should read the transition guide (<http://www.glfw.org/docs/3.0/moving.html>).@@ -51,7 +52,7 @@ build-depends: base < 5 , deepseq >= 1.1.0.0- , bindings-GLFW >= 3.1.2.3 && < 3.2.1.0+ , bindings-GLFW >= 3.2.1.0 -------------------------------------------------------------------------------- @@ -72,7 +73,7 @@ build-depends: base < 5 , HUnit >= 1.3 && < 1.7- , bindings-GLFW >= 3.1.2.3 && < 3.2.1.0+ , bindings-GLFW >= 3.2.1.0 , deepseq >= 1.1.0.0 , test-framework == 0.8.* , test-framework-hunit == 0.3.*
Graphics/UI/GLFW/C.hs view
@@ -12,7 +12,7 @@ import Data.Bits ((.&.)) import Data.Char (chr, ord)-import Foreign.C.Types (CDouble, CFloat, CInt, CChar, CUChar, CUInt, CUShort)+import Foreign.C.Types (CDouble, CFloat, CInt, CUChar, CUInt, CUShort) import Foreign.Ptr (Ptr) import Bindings.GLFW@@ -26,10 +26,6 @@ -------------------------------------------------------------------------------- -instance C CChar Char where- fromC = chr . fromIntegral- toC = fromIntegral . ord- instance C CInt Char where fromC = chr . fromIntegral toC = fromIntegral . ord@@ -86,15 +82,31 @@ } toC = undefined +instance C CInt StandardCursorShape where+ fromC v+ | v == c'GLFW_ARROW_CURSOR = StandardCursorShape'Arrow+ | v == c'GLFW_IBEAM_CURSOR = StandardCursorShape'IBeam+ | v == c'GLFW_CROSSHAIR_CURSOR = StandardCursorShape'Crosshair+ | v == c'GLFW_HAND_CURSOR = StandardCursorShape'Hand+ | v == c'GLFW_HRESIZE_CURSOR = StandardCursorShape'HResize+ | v == c'GLFW_VRESIZE_CURSOR = StandardCursorShape'VResize+ | otherwise = error $ "C CInt StandardCursorShape fromC: " ++ show v+ toC StandardCursorShape'Arrow = c'GLFW_ARROW_CURSOR+ toC StandardCursorShape'IBeam = c'GLFW_IBEAM_CURSOR+ toC StandardCursorShape'Crosshair = c'GLFW_CROSSHAIR_CURSOR+ toC StandardCursorShape'Hand = c'GLFW_HAND_CURSOR+ toC StandardCursorShape'HResize = c'GLFW_HRESIZE_CURSOR+ toC StandardCursorShape'VResize = c'GLFW_VRESIZE_CURSOR+ -------------------------------------------------------------------------------- instance C CInt Bool where fromC v- | v == c'GL_FALSE = False- | v == c'GL_TRUE = True+ | v == c'GLFW_FALSE = False+ | v == c'GLFW_TRUE = True | otherwise = error $ "C CInt Bool fromC: " ++ show v- toC False = c'GL_FALSE- toC True = c'GL_TRUE+ toC False = c'GLFW_FALSE+ toC True = c'GLFW_TRUE instance C CInt Error where fromC v@@ -120,27 +132,27 @@ instance C CInt MonitorState where fromC v- | v == c'GL_TRUE = MonitorState'Connected- | v == c'GL_FALSE = MonitorState'Disconnected+ | v == c'GLFW_TRUE = MonitorState'Connected+ | v == c'GLFW_FALSE = MonitorState'Disconnected | otherwise = error $ "C CInt MonitorState fromC: " ++ show v- toC MonitorState'Connected = c'GL_TRUE- toC MonitorState'Disconnected = c'GL_FALSE+ toC MonitorState'Connected = c'GLFW_TRUE+ toC MonitorState'Disconnected = c'GLFW_FALSE instance C CInt FocusState where fromC v- | v == c'GL_TRUE = FocusState'Focused- | v == c'GL_FALSE = FocusState'Defocused+ | v == c'GLFW_TRUE = FocusState'Focused+ | v == c'GLFW_FALSE = FocusState'Defocused | otherwise = error $ "C CInt FocusState fromC: " ++ show v- toC FocusState'Focused = c'GL_TRUE- toC FocusState'Defocused = c'GL_FALSE+ toC FocusState'Focused = c'GLFW_TRUE+ toC FocusState'Defocused = c'GLFW_FALSE instance C CInt IconifyState where fromC v- | v == c'GL_TRUE = IconifyState'Iconified- | v == c'GL_FALSE = IconifyState'NotIconified+ | v == c'GLFW_TRUE = IconifyState'Iconified+ | v == c'GLFW_FALSE = IconifyState'NotIconified | otherwise = error $ "C CInt IconifyState fromC: " ++ show v- toC IconifyState'Iconified = c'GL_TRUE- toC IconifyState'NotIconified = c'GL_FALSE+ toC IconifyState'Iconified = c'GLFW_TRUE+ toC IconifyState'NotIconified = c'GLFW_FALSE instance C CInt ContextRobustness where fromC v@@ -500,11 +512,11 @@ instance C CInt CursorState where fromC v- | v == c'GL_TRUE = CursorState'InWindow- | v == c'GL_FALSE = CursorState'NotInWindow+ | v == c'GLFW_TRUE = CursorState'InWindow+ | v == c'GLFW_FALSE = CursorState'NotInWindow | otherwise = error $ "C CInt CursorState fromC: " ++ show v- toC CursorState'InWindow = c'GL_TRUE- toC CursorState'NotInWindow = c'GL_FALSE+ toC CursorState'InWindow = c'GLFW_TRUE+ toC CursorState'NotInWindow = c'GLFW_FALSE instance C CInt CursorInputMode where fromC v@@ -518,39 +530,19 @@ instance C CInt StickyKeysInputMode where fromC v- | v == c'GL_TRUE = StickyKeysInputMode'Enabled- | v == c'GL_FALSE = StickyKeysInputMode'Disabled+ | v == c'GLFW_TRUE = StickyKeysInputMode'Enabled+ | v == c'GLFW_FALSE = StickyKeysInputMode'Disabled | otherwise = error $ "C CInt StickyKeysInputMode fromC: " ++ show v- toC StickyKeysInputMode'Enabled = c'GL_TRUE- toC StickyKeysInputMode'Disabled = c'GL_FALSE+ toC StickyKeysInputMode'Enabled = c'GLFW_TRUE+ toC StickyKeysInputMode'Disabled = c'GLFW_FALSE instance C CInt StickyMouseButtonsInputMode where fromC v- | v == c'GL_TRUE = StickyMouseButtonsInputMode'Enabled- | v == c'GL_FALSE = StickyMouseButtonsInputMode'Disabled+ | v == c'GLFW_TRUE = StickyMouseButtonsInputMode'Enabled+ | v == c'GLFW_FALSE = StickyMouseButtonsInputMode'Disabled | otherwise = error $ "C CInt StickyMouseButtonsInputMode fromC: " ++ show v- toC StickyMouseButtonsInputMode'Enabled = c'GL_TRUE- toC StickyMouseButtonsInputMode'Disabled = c'GL_FALSE------------------------------------------------------------------------------------- 3.1 Additions-----------------------------------------------------------------------------------instance C CInt StandardCursorShape where- fromC v- | v == c'GLFW_ARROW_CURSOR = StandardCursorShape'Arrow- | v == c'GLFW_IBEAM_CURSOR = StandardCursorShape'IBeam- | v == c'GLFW_CROSSHAIR_CURSOR = StandardCursorShape'Crosshair- | v == c'GLFW_HAND_CURSOR = StandardCursorShape'Hand- | v == c'GLFW_HRESIZE_CURSOR = StandardCursorShape'HResize- | v == c'GLFW_VRESIZE_CURSOR = StandardCursorShape'VResize- | otherwise = error $ "C CInt StandardCursorShape fromC: " ++ show v- toC StandardCursorShape'Arrow = c'GLFW_ARROW_CURSOR- toC StandardCursorShape'IBeam = c'GLFW_IBEAM_CURSOR- toC StandardCursorShape'Crosshair = c'GLFW_CROSSHAIR_CURSOR- toC StandardCursorShape'Hand = c'GLFW_HAND_CURSOR- toC StandardCursorShape'HResize = c'GLFW_HRESIZE_CURSOR- toC StandardCursorShape'VResize = c'GLFW_VRESIZE_CURSOR+ toC StickyMouseButtonsInputMode'Enabled = c'GLFW_TRUE+ toC StickyMouseButtonsInputMode'Disabled = c'GLFW_FALSE --------------------------------------------------------------------------------