bindings-GLFW 3.1.1.4 → 3.1.2.0
raw patch · 3 files changed
+79/−3 lines, 3 filesdep +template-haskell
Dependencies added: template-haskell
Files
- Bindings/GLFW.hsc +59/−1
- Bindings/Helpers.hs +6/−0
- bindings-GLFW.cabal +14/−2
Bindings/GLFW.hsc view
@@ -1,12 +1,35 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TemplateHaskell #-} -------------------------------------------------------------------------------- #include <bindings.dsl.h> #include <GLFW/glfw3.h>+#ifdef ExposeNative + #if defined(_WIN32)++ #define GLFW_EXPOSE_NATIVE_WIN32+ #define GLFW_EXPOSE_NATIVE_WGL++ #elif defined(__APPLE__)++ #define GLFW_EXPOSE_NATIVE_COCOA+ #define GLFW_EXPOSE_NATIVE_NSGL++ #elif defined(__linux__)++ #define GLFW_EXPOSE_NATIVE_X11+ #define GLFW_EXPOSE_NATIVE_GLX++ #endif++ #include <GLFW/glfw3native.h>++#endif+ -------------------------------------------------------------------------------- module Bindings.GLFW where@@ -21,6 +44,12 @@ import Foreign.Ptr (FunPtr, Ptr, plusPtr) import Foreign.Storable (Storable(..)) +#ifdef ExposeNative+import Bindings.Helpers++$(warn "You are compiling glfw using the native access functions. BEWARE.")+#endif+ -------------------------------------------------------------------------------- #num GL_FALSE@@ -310,7 +339,7 @@ #ccall glfwGetMonitorPos , Ptr <GLFWmonitor> -> Ptr CInt -> Ptr CInt -> IO () #ccall glfwGetMonitorPhysicalSize , Ptr <GLFWmonitor> -> Ptr CInt -> Ptr CInt -> IO () #ccall glfwGetMonitorName , Ptr <GLFWmonitor> -> IO (Ptr CChar)-#ccall glfwSetMonitorCallback , <GLFWmonitorfun> -> IO <GLFWmonitorfun>+#ccall glfwSetMonitorCallback , <GLFWmonitorfun> -> IO <GLFWmonitorfun> #ccall glfwGetVideoModes , Ptr <GLFWmonitor> -> Ptr CInt -> IO (Ptr <GLFWvidmode>) #ccall glfwGetVideoMode , Ptr <GLFWmonitor> -> IO (Ptr <GLFWvidmode>) #ccall glfwSetGamma , Ptr <GLFWmonitor> -> CFloat -> IO ()@@ -372,3 +401,32 @@ #ccall glfwSwapInterval , CInt -> IO () #ccall glfwExtensionSupported , Ptr CChar -> IO CInt #ccall glfwGetProcAddress , Ptr CChar -> IO <GLFWglproc>++--------------------------------------------------------------------------------+-- GLFW 3.1 additions+--------------------------------------------------------------------------------++#num GLFW_ARROW_CURSOR+#num GLFW_IBEAM_CURSOR+#num GLFW_CROSSHAIR_CURSOR+#num GLFW_HAND_CURSOR+#num GLFW_HRESIZE_CURSOR+#num GLFW_VRESIZE_CURSOR++#starttype GLFWimage+#field width , CInt+#field height , CInt+#field pixels , Ptr CUChar+#stoptype++#opaque_t GLFWcursor+deriving instance Typeable C'GLFWcursor+deriving instance Data C'GLFWcursor++#callback GLFWdropfun , Ptr <GLFWwindow> -> CInt -> Ptr (Ptr CChar) -> IO ()++#ccall glfwCreateCursor , Ptr <GLFWimage> -> CInt -> CInt -> IO (Ptr <GLFWcursor>)+#ccall glfwCreateStandardCursor , CInt -> IO (Ptr <GLFWcursor>)+#ccall glfwSetCursor , Ptr <GLFWwindow> -> Ptr <GLFWcursor> -> IO ()+#ccall glfwDestroyCursor , Ptr <GLFWcursor> -> IO ()+#ccall glfwSetDropCallback , Ptr <GLFWwindow> -> <GLFWdropfun> -> IO <GLFWdropfun>
+ Bindings/Helpers.hs view
@@ -0,0 +1,6 @@+module Bindings.Helpers where++import Language.Haskell.TH (DecsQ, reportWarning)++warn :: String -> DecsQ+warn str = reportWarning str >> return []
bindings-GLFW.cabal view
@@ -1,5 +1,5 @@ name: bindings-GLFW-version: 3.1.1.4+version: 3.1.2.0 category: Graphics author: Brian Lewis <brian@lorf.org>@@ -80,6 +80,12 @@ Linux only. Determines whether to target the Mir display server. default: False +flag ExposeNative+ description:+ Whether or not to use the native access functions. You most likely do not+ want to do this. You may if you're coding for the Rift, perhaps.+ default: False+ -------------------------------------------------------------------------------- library@@ -97,7 +103,8 @@ build-depends: base < 5,- bindings-DSL == 1.0.*+ bindings-DSL == 1.0.*,+ template-haskell >= 2.10 && < 2.11 include-dirs: glfw/include/GLFW@@ -183,6 +190,11 @@ extra-libraries: opengl32 Gdi32++ if flag(ExposeNative)+ cc-options: -DExposeNative+ exposed-modules:+ Bindings.Helpers --------------------------------------------------------------------------------