{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} -------------------------------------------------------------------------------- #include #include #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 #endif -------------------------------------------------------------------------------- module Bindings.GLFW where import Prelude (Eq, IO, Num, Show) import Prelude (($), return) import Data.Data (Data) import Data.Typeable (Typeable) import Foreign.C.Types (CChar, CUChar, CUShort) import Foreign.C.Types (CDouble(..), CFloat(..), CInt(..), CUInt(..)) 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 #num GL_TRUE #num GLFW_VERSION_MAJOR #num GLFW_VERSION_MINOR #num GLFW_VERSION_REVISION #num GLFW_RELEASE #num GLFW_PRESS #num GLFW_REPEAT #num GLFW_KEY_UNKNOWN #num GLFW_KEY_SPACE #num GLFW_KEY_APOSTROPHE #num GLFW_KEY_COMMA #num GLFW_KEY_MINUS #num GLFW_KEY_PERIOD #num GLFW_KEY_SLASH #num GLFW_KEY_0 #num GLFW_KEY_1 #num GLFW_KEY_2 #num GLFW_KEY_3 #num GLFW_KEY_4 #num GLFW_KEY_5 #num GLFW_KEY_6 #num GLFW_KEY_7 #num GLFW_KEY_8 #num GLFW_KEY_9 #num GLFW_KEY_SEMICOLON #num GLFW_KEY_EQUAL #num GLFW_KEY_A #num GLFW_KEY_B #num GLFW_KEY_C #num GLFW_KEY_D #num GLFW_KEY_E #num GLFW_KEY_F #num GLFW_KEY_G #num GLFW_KEY_H #num GLFW_KEY_I #num GLFW_KEY_J #num GLFW_KEY_K #num GLFW_KEY_L #num GLFW_KEY_M #num GLFW_KEY_N #num GLFW_KEY_O #num GLFW_KEY_P #num GLFW_KEY_Q #num GLFW_KEY_R #num GLFW_KEY_S #num GLFW_KEY_T #num GLFW_KEY_U #num GLFW_KEY_V #num GLFW_KEY_W #num GLFW_KEY_X #num GLFW_KEY_Y #num GLFW_KEY_Z #num GLFW_KEY_LEFT_BRACKET #num GLFW_KEY_BACKSLASH #num GLFW_KEY_RIGHT_BRACKET #num GLFW_KEY_GRAVE_ACCENT #num GLFW_KEY_WORLD_1 #num GLFW_KEY_WORLD_2 #num GLFW_KEY_ESCAPE #num GLFW_KEY_ENTER #num GLFW_KEY_TAB #num GLFW_KEY_BACKSPACE #num GLFW_KEY_INSERT #num GLFW_KEY_DELETE #num GLFW_KEY_RIGHT #num GLFW_KEY_LEFT #num GLFW_KEY_DOWN #num GLFW_KEY_UP #num GLFW_KEY_PAGE_UP #num GLFW_KEY_PAGE_DOWN #num GLFW_KEY_HOME #num GLFW_KEY_END #num GLFW_KEY_CAPS_LOCK #num GLFW_KEY_SCROLL_LOCK #num GLFW_KEY_NUM_LOCK #num GLFW_KEY_PRINT_SCREEN #num GLFW_KEY_PAUSE #num GLFW_KEY_F1 #num GLFW_KEY_F2 #num GLFW_KEY_F3 #num GLFW_KEY_F4 #num GLFW_KEY_F5 #num GLFW_KEY_F6 #num GLFW_KEY_F7 #num GLFW_KEY_F8 #num GLFW_KEY_F9 #num GLFW_KEY_F10 #num GLFW_KEY_F11 #num GLFW_KEY_F12 #num GLFW_KEY_F13 #num GLFW_KEY_F14 #num GLFW_KEY_F15 #num GLFW_KEY_F16 #num GLFW_KEY_F17 #num GLFW_KEY_F18 #num GLFW_KEY_F19 #num GLFW_KEY_F20 #num GLFW_KEY_F21 #num GLFW_KEY_F22 #num GLFW_KEY_F23 #num GLFW_KEY_F24 #num GLFW_KEY_F25 #num GLFW_KEY_KP_0 #num GLFW_KEY_KP_1 #num GLFW_KEY_KP_2 #num GLFW_KEY_KP_3 #num GLFW_KEY_KP_4 #num GLFW_KEY_KP_5 #num GLFW_KEY_KP_6 #num GLFW_KEY_KP_7 #num GLFW_KEY_KP_8 #num GLFW_KEY_KP_9 #num GLFW_KEY_KP_DECIMAL #num GLFW_KEY_KP_DIVIDE #num GLFW_KEY_KP_MULTIPLY #num GLFW_KEY_KP_SUBTRACT #num GLFW_KEY_KP_ADD #num GLFW_KEY_KP_ENTER #num GLFW_KEY_KP_EQUAL #num GLFW_KEY_LEFT_SHIFT #num GLFW_KEY_LEFT_CONTROL #num GLFW_KEY_LEFT_ALT #num GLFW_KEY_LEFT_SUPER #num GLFW_KEY_RIGHT_SHIFT #num GLFW_KEY_RIGHT_CONTROL #num GLFW_KEY_RIGHT_ALT #num GLFW_KEY_RIGHT_SUPER #num GLFW_KEY_MENU #num GLFW_KEY_LAST #num GLFW_MOD_SHIFT #num GLFW_MOD_CONTROL #num GLFW_MOD_ALT #num GLFW_MOD_SUPER #num GLFW_MOUSE_BUTTON_1 #num GLFW_MOUSE_BUTTON_2 #num GLFW_MOUSE_BUTTON_3 #num GLFW_MOUSE_BUTTON_4 #num GLFW_MOUSE_BUTTON_5 #num GLFW_MOUSE_BUTTON_6 #num GLFW_MOUSE_BUTTON_7 #num GLFW_MOUSE_BUTTON_8 #num GLFW_MOUSE_BUTTON_LAST #num GLFW_MOUSE_BUTTON_LEFT #num GLFW_MOUSE_BUTTON_RIGHT #num GLFW_MOUSE_BUTTON_MIDDLE #num GLFW_JOYSTICK_1 #num GLFW_JOYSTICK_2 #num GLFW_JOYSTICK_3 #num GLFW_JOYSTICK_4 #num GLFW_JOYSTICK_5 #num GLFW_JOYSTICK_6 #num GLFW_JOYSTICK_7 #num GLFW_JOYSTICK_8 #num GLFW_JOYSTICK_9 #num GLFW_JOYSTICK_10 #num GLFW_JOYSTICK_11 #num GLFW_JOYSTICK_12 #num GLFW_JOYSTICK_13 #num GLFW_JOYSTICK_14 #num GLFW_JOYSTICK_15 #num GLFW_JOYSTICK_16 #num GLFW_JOYSTICK_LAST #num GLFW_NOT_INITIALIZED #num GLFW_NO_CURRENT_CONTEXT #num GLFW_INVALID_ENUM #num GLFW_INVALID_VALUE #num GLFW_OUT_OF_MEMORY #num GLFW_API_UNAVAILABLE #num GLFW_VERSION_UNAVAILABLE #num GLFW_PLATFORM_ERROR #num GLFW_FORMAT_UNAVAILABLE #num GLFW_FOCUSED #num GLFW_ICONIFIED #num GLFW_RESIZABLE #num GLFW_VISIBLE #num GLFW_DECORATED #num GLFW_RED_BITS #num GLFW_GREEN_BITS #num GLFW_BLUE_BITS #num GLFW_ALPHA_BITS #num GLFW_DEPTH_BITS #num GLFW_STENCIL_BITS #num GLFW_ACCUM_RED_BITS #num GLFW_ACCUM_GREEN_BITS #num GLFW_ACCUM_BLUE_BITS #num GLFW_ACCUM_ALPHA_BITS #num GLFW_AUX_BUFFERS #num GLFW_STEREO #num GLFW_SAMPLES #num GLFW_SRGB_CAPABLE #num GLFW_REFRESH_RATE #num GLFW_CLIENT_API #num GLFW_CONTEXT_VERSION_MAJOR #num GLFW_CONTEXT_VERSION_MINOR #num GLFW_CONTEXT_REVISION #num GLFW_CONTEXT_ROBUSTNESS #num GLFW_OPENGL_FORWARD_COMPAT #num GLFW_OPENGL_DEBUG_CONTEXT #num GLFW_OPENGL_PROFILE #num GLFW_OPENGL_API #num GLFW_OPENGL_ES_API #num GLFW_NO_ROBUSTNESS #num GLFW_NO_RESET_NOTIFICATION #num GLFW_LOSE_CONTEXT_ON_RESET #num GLFW_OPENGL_ANY_PROFILE #num GLFW_OPENGL_CORE_PROFILE #num GLFW_OPENGL_COMPAT_PROFILE #num GLFW_CURSOR #num GLFW_STICKY_KEYS #num GLFW_STICKY_MOUSE_BUTTONS #num GLFW_CURSOR_NORMAL #num GLFW_CURSOR_HIDDEN #num GLFW_CURSOR_DISABLED #num GLFW_CONNECTED #num GLFW_DISCONNECTED #callback GLFWglproc , IO () #opaque_t GLFWmonitor deriving instance Typeable C'GLFWmonitor deriving instance Data C'GLFWmonitor #opaque_t GLFWwindow deriving instance Typeable C'GLFWwindow deriving instance Data C'GLFWwindow #callback GLFWerrorfun , CInt -> Ptr CChar -> IO () #callback GLFWwindowposfun , Ptr -> CInt -> CInt -> IO () #callback GLFWwindowsizefun , Ptr -> CInt -> CInt -> IO () #callback GLFWwindowclosefun , Ptr -> IO () #callback GLFWwindowrefreshfun , Ptr -> IO () #callback GLFWwindowfocusfun , Ptr -> CInt -> IO () #callback GLFWwindowiconifyfun , Ptr -> CInt -> IO () #callback GLFWframebuffersizefun , Ptr -> CInt -> CInt -> IO () #callback GLFWmousebuttonfun , Ptr -> CInt -> CInt -> CInt -> IO () #callback GLFWcursorposfun , Ptr -> CDouble -> CDouble -> IO () #callback GLFWcursorenterfun , Ptr -> CInt -> IO () #callback GLFWscrollfun , Ptr -> CDouble -> CDouble -> IO () #callback GLFWkeyfun , Ptr -> CInt -> CInt -> CInt -> CInt -> IO () #callback GLFWcharfun , Ptr -> CUInt -> IO () #callback GLFWmonitorfun , Ptr -> CInt -> IO () #starttype GLFWvidmode #field width , CInt #field height , CInt #field redBits , CInt #field greenBits , CInt #field blueBits , CInt #field refreshRate , CInt #stoptype #starttype GLFWgammaramp #field red , Ptr CUShort #field green , Ptr CUShort #field blue , Ptr CUShort #field size , CUInt #stoptype #ccall glfwInit , IO CInt #ccall glfwTerminate , IO () #ccall glfwGetVersion , Ptr CInt -> Ptr CInt -> Ptr CInt -> IO () #ccall glfwGetVersionString , IO (Ptr CChar) #ccall glfwSetErrorCallback , -> IO #ccall glfwGetMonitors , Ptr CInt -> IO (Ptr (Ptr )) #ccall glfwGetPrimaryMonitor , IO (Ptr ) #ccall glfwGetMonitorPos , Ptr -> Ptr CInt -> Ptr CInt -> IO () #ccall glfwGetMonitorPhysicalSize , Ptr -> Ptr CInt -> Ptr CInt -> IO () #ccall glfwGetMonitorName , Ptr -> IO (Ptr CChar) #ccall glfwSetMonitorCallback , -> IO #ccall glfwGetVideoModes , Ptr -> Ptr CInt -> IO (Ptr ) #ccall glfwGetVideoMode , Ptr -> IO (Ptr ) #ccall glfwSetGamma , Ptr -> CFloat -> IO () #ccall glfwGetGammaRamp , Ptr -> IO (Ptr ) #ccall glfwSetGammaRamp , Ptr -> Ptr -> IO () #ccall glfwDefaultWindowHints , IO () #ccall glfwWindowHint , CInt -> CInt -> IO () #ccall glfwCreateWindow , CInt -> CInt -> Ptr CChar -> Ptr -> Ptr -> IO (Ptr ) #ccall glfwDestroyWindow , Ptr -> IO () #ccall glfwWindowShouldClose , Ptr -> IO CInt #ccall glfwSetWindowShouldClose , Ptr -> CInt -> IO () #ccall glfwSetWindowTitle , Ptr -> Ptr CChar -> IO () #ccall glfwGetWindowPos , Ptr -> Ptr CInt -> Ptr CInt -> IO () #ccall glfwSetWindowPos , Ptr -> CInt -> CInt -> IO () #ccall glfwGetWindowSize , Ptr -> Ptr CInt -> Ptr CInt -> IO () #ccall glfwSetWindowSize , Ptr -> CInt -> CInt -> IO () #ccall glfwGetFramebufferSize , Ptr -> Ptr CInt -> Ptr CInt -> IO () #ccall glfwIconifyWindow , Ptr -> IO () #ccall glfwRestoreWindow , Ptr -> IO () #ccall glfwShowWindow , Ptr -> IO () #ccall glfwHideWindow , Ptr -> IO () #ccall glfwGetWindowMonitor , Ptr -> IO (Ptr ) #ccall glfwGetWindowAttrib , Ptr -> CInt -> IO CInt #ccall glfwSetWindowUserPointer , Ptr -> Ptr () -> IO () #ccall glfwGetWindowUserPointer , Ptr -> IO (Ptr ()) #ccall glfwSetWindowPosCallback , Ptr -> -> IO #ccall glfwSetWindowSizeCallback , Ptr -> -> IO #ccall glfwSetWindowCloseCallback , Ptr -> -> IO #ccall glfwSetWindowRefreshCallback , Ptr -> -> IO #ccall glfwSetWindowFocusCallback , Ptr -> -> IO #ccall glfwSetWindowIconifyCallback , Ptr -> -> IO #ccall glfwSetFramebufferSizeCallback , Ptr -> -> IO #ccall glfwPollEvents , IO () #ccall glfwWaitEvents , IO () #ccall glfwPostEmptyEvent , IO () #ccall glfwGetInputMode , Ptr -> CInt -> IO CInt #ccall glfwSetInputMode , Ptr -> CInt -> CInt -> IO () #ccall glfwGetKey , Ptr -> CInt -> IO CInt #ccall glfwGetMouseButton , Ptr -> CInt -> IO CInt #ccall glfwGetCursorPos , Ptr -> Ptr CDouble -> Ptr CDouble -> IO () #ccall glfwSetCursorPos , Ptr -> CDouble -> CDouble -> IO () #ccall glfwSetKeyCallback , Ptr -> -> IO #ccall glfwSetCharCallback , Ptr -> -> IO #ccall glfwSetMouseButtonCallback , Ptr -> -> IO #ccall glfwSetCursorPosCallback , Ptr -> -> IO #ccall glfwSetCursorEnterCallback , Ptr -> -> IO #ccall glfwSetScrollCallback , Ptr -> -> IO #ccall glfwJoystickPresent , CInt -> IO CInt #ccall glfwGetJoystickAxes , CInt -> Ptr CInt -> IO (Ptr CFloat) #ccall glfwGetJoystickButtons , CInt -> Ptr CInt -> IO (Ptr CUChar) #ccall glfwGetJoystickName , CInt -> IO (Ptr CChar) #ccall glfwSetClipboardString , Ptr -> Ptr CChar -> IO () #ccall glfwGetClipboardString , Ptr -> IO (Ptr CChar) #ccall glfwGetTime , IO CDouble #ccall glfwSetTime , CDouble -> IO () #ccall glfwMakeContextCurrent , Ptr -> IO () #ccall glfwGetCurrentContext , IO (Ptr ) #ccall glfwSwapBuffers , Ptr -> IO () #ccall glfwSwapInterval , CInt -> IO () #ccall glfwExtensionSupported , Ptr CChar -> IO CInt #ccall glfwGetProcAddress , Ptr CChar -> IO -------------------------------------------------------------------------------- -- 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 -> CInt -> Ptr (Ptr CChar) -> IO () #ccall glfwCreateCursor , Ptr -> CInt -> CInt -> IO (Ptr ) #ccall glfwCreateStandardCursor , CInt -> IO (Ptr ) #ccall glfwSetCursor , Ptr -> Ptr -> IO () #ccall glfwDestroyCursor , Ptr -> IO () #ccall glfwSetDropCallback , Ptr -> -> IO