sdl2 1.0.2 → 1.1.0
raw patch · 5 files changed
+66/−21 lines, 5 files
Files
- Graphics/UI/SDL/Enum.hsc +47/−13
- Graphics/UI/SDL/Event.hs +9/−3
- Graphics/UI/SDL/Types.hsc +5/−2
- Graphics/UI/SDL/Video.hs +2/−0
- sdl2.cabal +3/−3
Graphics/UI/SDL/Enum.hsc view
@@ -388,6 +388,18 @@ -- * Miscellaneous Enumerations -- | These enumerations are not used directly by any SDL function, thus they have a polymorphic type. + -- ** Button+ buttonLeft,+ buttonMiddle,+ buttonRight,+ buttonX1,+ buttonX2,+ buttonLMask,+ buttonMMask,+ buttonRMask,+ buttonX1Mask,+ buttonX2Mask,+ -- ** Event Type eventTypeFirstEvent, eventTypeQuit,@@ -532,7 +544,7 @@ import Data.Int import Data.Word -type AudioStatus = Word32 -- (#type SDL_AudioStatus)+type AudioStatus = (#type SDL_AudioStatus) audioStatusStopped :: AudioStatus audioStatusPlaying :: AudioStatus@@ -542,7 +554,7 @@ audioStatusPlaying = (#const SDL_AUDIO_PLAYING) audioStatusPaused = (#const SDL_AUDIO_PAUSED) -type BlendMode = Word32 -- (#type SDL_BlendMode)+type BlendMode = (#type SDL_BlendMode) blendModeNone :: BlendMode blendModeBlend :: BlendMode@@ -554,7 +566,7 @@ blendModeAdd = (#const SDL_BLENDMODE_ADD) blendModeMod = (#const SDL_BLENDMODE_MOD) -type EventAction = Word32 -- (#type SDL_eventaction)+type EventAction = (#type SDL_eventaction) eventActionAddEvent :: EventAction eventActionPeekEvent :: EventAction@@ -564,7 +576,7 @@ eventActionPeekEvent = (#const SDL_PEEKEVENT) eventActionGetEvent = (#const SDL_GETEVENT) -type GameControllerAxis = Int32 -- (#type SDL_GameControllerAxis)+type GameControllerAxis = (#type SDL_GameControllerAxis) gameControllerAxisInvalid :: GameControllerAxis gameControllerAxisLeftX :: GameControllerAxis@@ -584,7 +596,7 @@ gameControllerAxisTriggerRight = (#const SDL_CONTROLLER_AXIS_TRIGGERRIGHT) gameControllerAxisMax = (#const SDL_CONTROLLER_AXIS_MAX) -type GameControllerButton = Int32 -- (#type SDL_GameControllerButton)+type GameControllerButton = (#type SDL_GameControllerButton) gameControllerButtonInvalid :: GameControllerButton gameControllerButtonA :: GameControllerButton@@ -622,7 +634,7 @@ gameControllerButtonDPadRight = (#const SDL_CONTROLLER_BUTTON_DPAD_RIGHT) gameControllerButtonMax = (#const SDL_CONTROLLER_BUTTON_MAX) -type GLattr = Word32 -- (#type SDL_GLattr)+type GLattr = (#type SDL_GLattr) glAttrRedSize :: GLattr glAttrGreenSize :: GLattr@@ -674,7 +686,7 @@ glAttrShareWithCurrentContext = (#const SDL_GL_SHARE_WITH_CURRENT_CONTEXT) glAttrFramebufferSRGBCapable = (#const SDL_GL_FRAMEBUFFER_SRGB_CAPABLE) -type HintPriority = Word32 -- (#type SDL_HintPriority)+type HintPriority = (#type SDL_HintPriority) hintPriorityDefault :: HintPriority hintPriorityNormal :: HintPriority@@ -684,7 +696,7 @@ hintPriorityNormal = (#const SDL_HINT_NORMAL) hintPriorityOverride = (#const SDL_HINT_OVERRIDE) -type Keymod = Word32 -- (#type SDL_Keymod)+type Keymod = (#type SDL_Keymod) keymodNone :: Keymod keymodLShift :: Keymod@@ -714,7 +726,7 @@ keymodMode = (#const KMOD_MODE) keymodReserved = (#const KMOD_RESERVED) -type LogPriority = Word32 -- (#type SDL_LogPriority)+type LogPriority = (#type SDL_LogPriority) logPriorityVerbose :: LogPriority logPriorityDebug :: LogPriority@@ -732,7 +744,7 @@ logPriorityCritical = (#const SDL_LOG_PRIORITY_CRITICAL) logPriorityPriorities = (#const SDL_NUM_LOG_PRIORITIES) -type PowerState = Word32 -- (#type SDL_PowerState)+type PowerState = (#type SDL_PowerState) powerStateUnknown :: PowerState powerStateOnBattery :: PowerState@@ -746,7 +758,7 @@ powerStateCharging = (#const SDL_POWERSTATE_CHARGING) powerStateCharged = (#const SDL_POWERSTATE_CHARGED) -type RendererFlip = Word32 -- (#type SDL_RendererFlip)+type RendererFlip = (#type SDL_RendererFlip) rendererFlipNone :: RendererFlip rendererFlipHorizontal :: RendererFlip@@ -756,7 +768,7 @@ rendererFlipHorizontal = (#const SDL_FLIP_HORIZONTAL) rendererFlipVertical = (#const SDL_FLIP_VERTICAL) -type Scancode = Word32 -- (#type SDL_Scancode)+type Scancode = (#type SDL_Scancode) scancodeUnknown :: Scancode scancodeA :: Scancode@@ -1244,7 +1256,7 @@ scancodeApp2 = (#const SDL_SCANCODE_APP2) scancodeNum = (#const SDL_NUM_SCANCODES) -type SystemCursor = Word32 -- (#type SDL_SystemCursor)+type SystemCursor = (#type SDL_SystemCursor) systemCursorArrow :: SystemCursor systemCursorIBeam :: SystemCursor@@ -1273,6 +1285,28 @@ systemCursorNo = (#const SDL_SYSTEM_CURSOR_NO) systemCursorHand = (#const SDL_SYSTEM_CURSOR_HAND) systemCursorNum = (#const SDL_NUM_SYSTEM_CURSORS)++buttonLeft :: (Num a) => a+buttonMiddle :: (Num a) => a+buttonRight :: (Num a) => a+buttonX1 :: (Num a) => a+buttonX2 :: (Num a) => a+buttonLMask :: (Num a) => a+buttonMMask :: (Num a) => a+buttonRMask :: (Num a) => a+buttonX1Mask :: (Num a) => a+buttonX2Mask :: (Num a) => a++buttonLeft = (#const SDL_BUTTON_LEFT)+buttonMiddle = (#const SDL_BUTTON_MIDDLE)+buttonRight = (#const SDL_BUTTON_RIGHT)+buttonX1 = (#const SDL_BUTTON_X1)+buttonX2 = (#const SDL_BUTTON_X2)+buttonLMask = (#const SDL_BUTTON_LMASK)+buttonMMask = (#const SDL_BUTTON_MMASK)+buttonRMask = (#const SDL_BUTTON_RMASK)+buttonX1Mask = (#const SDL_BUTTON_X1MASK)+buttonX2Mask = (#const SDL_BUTTON_X2MASK) eventTypeFirstEvent :: (Num a) => a eventTypeQuit :: (Num a) => a
Graphics/UI/SDL/Event.hs view
@@ -86,7 +86,8 @@ -- * Game Controller Support gameControllerAddMapping,- -- gameControllerAddMappingsFromFile,+ gameControllerAddMappingsFromFile,+ gameControllerAddMappingsFromRW, gameControllerClose, gameControllerEventState, gameControllerGetAttached,@@ -116,6 +117,7 @@ import Foreign.Ptr import Foreign.Storable import Graphics.UI.SDL.Enum+import Graphics.UI.SDL.Filesystem import Graphics.UI.SDL.Types foreign import ccall "SDL.h SDL_AddEventWatch" addEventWatch :: EventFilter -> Ptr () -> IO ()@@ -136,7 +138,6 @@ foreign import ccall "SDL.h SDL_PollEvent" pollEvent :: Ptr Event -> IO CInt foreign import ccall "SDL.h SDL_PumpEvents" pumpEvents :: IO () foreign import ccall "SDL.h SDL_PushEvent" pushEvent :: Ptr Event -> IO CInt--- foreign import ccall "SDL.h SDL_QuitRequested" quitRequested :: IO Bool foreign import ccall "SDL.h SDL_RecordGesture" recordGesture :: TouchID -> IO CInt foreign import ccall "SDL.h SDL_RegisterEvents" registerEvents :: CInt -> IO Word32 foreign import ccall "SDL.h SDL_SaveAllDollarTemplates" saveAllDollarTemplates :: Ptr RWops -> IO CInt@@ -200,7 +201,7 @@ foreign import ccall "SDL.h SDL_NumJoysticks" numJoysticks :: IO CInt foreign import ccall "SDL.h SDL_GameControllerAddMapping" gameControllerAddMapping :: CString -> IO CInt--- foreign import ccall "SDL.h SDL_GameControllerAddMappingsFromFile" gameControllerAddMappingsFromFile :: CString -> IO CInt -- Available in SDL 2.0.2+foreign import ccall "SDL.h SDL_GameControllerAddMappingsFromRW" gameControllerAddMappingsFromRW :: Ptr RWops -> CInt -> IO CInt foreign import ccall "SDL.h SDL_GameControllerClose" gameControllerClose :: GameController -> IO () foreign import ccall "SDL.h SDL_GameControllerEventState" gameControllerEventState :: CInt -> IO CInt foreign import ccall "SDL.h SDL_GameControllerGetAttached" gameControllerGetAttached :: GameController -> IO Bool@@ -246,6 +247,11 @@ joystickGetGUIDString guid pszGUID cbGUID = alloca $ \ptr -> do poke ptr guid joystickGetGUIDString' ptr pszGUID cbGUID++gameControllerAddMappingsFromFile :: CString -> IO CInt+gameControllerAddMappingsFromFile file = do+ rw <- withCString "rb" $ rwFromFile file+ gameControllerAddMappingsFromRW rw 1 gameControllerGetBindForAxis :: GameController -> GameControllerAxis -> IO GameControllerButtonBind gameControllerGetBindForAxis gamecontroller axis = alloca $ \ptr -> do
Graphics/UI/SDL/Types.hsc view
@@ -249,6 +249,7 @@ , mouseButtonEventWhich :: Word32 , mouseButtonEventButton :: Word8 , mouseButtonEventState :: Word8+ , mouseButtonEventClicks :: Word8 , mouseButtonEventX :: Int32 , mouseButtonEventY :: Int32 }@@ -481,9 +482,10 @@ which <- (#peek SDL_Event, button.which) ptr button <- (#peek SDL_Event, button.button) ptr state <- (#peek SDL_Event, button.state) ptr+ clicks <- (#peek SDL_Event, button.clicks) ptr x <- (#peek SDL_Event, button.x) ptr y <- (#peek SDL_Event, button.y) ptr- return $! f wid which button state x y+ return $! f wid which button state clicks x y joybutton f = do which <- (#peek SDL_Event, jbutton.which) ptr@@ -560,13 +562,14 @@ (#poke SDL_Event, motion.y) ptr y (#poke SDL_Event, motion.xrel) ptr xrel (#poke SDL_Event, motion.yrel) ptr yrel- MouseButtonEvent typ timestamp wid which button state x y -> do+ MouseButtonEvent typ timestamp wid which button state clicks x y -> do (#poke SDL_Event, common.type) ptr typ (#poke SDL_Event, common.timestamp) ptr timestamp (#poke SDL_Event, button.windowID) ptr wid (#poke SDL_Event, button.which) ptr which (#poke SDL_Event, button.button) ptr button (#poke SDL_Event, button.state) ptr state+ (#poke SDL_Event, button.clicks) ptr clicks (#poke SDL_Event, button.x) ptr x (#poke SDL_Event, button.y) ptr y MouseWheelEvent typ timestamp wid which x y -> do
Graphics/UI/SDL/Video.hs view
@@ -18,6 +18,7 @@ glGetSwapInterval, glLoadLibrary, glMakeCurrent,+ glResetAttributes, glSetAttribute, glSetSwapInterval, glSwapWindow,@@ -220,6 +221,7 @@ foreign import ccall "SDL.h SDL_GL_GetSwapInterval" glGetSwapInterval :: IO CInt foreign import ccall "SDL.h SDL_GL_LoadLibrary" glLoadLibrary :: CString -> IO CInt foreign import ccall "SDL.h SDL_GL_MakeCurrent" glMakeCurrent :: Window -> GLContext -> IO CInt+foreign import ccall "SDL.h SDL_GL_ResetAttributes" glResetAttributes :: IO () foreign import ccall "SDL.h SDL_GL_SetAttribute" glSetAttribute :: GLattr -> CInt -> IO CInt foreign import ccall "SDL.h SDL_GL_SetSwapInterval" glSetSwapInterval :: CInt -> IO CInt foreign import ccall "SDL.h SDL_GL_SwapWindow" glSwapWindow :: Window -> IO ()
sdl2.cabal view
@@ -1,7 +1,7 @@ name: sdl2-version: 1.0.2+version: 1.1.0 synopsis: Bindings to SDL2-description: Bindings to the SDL2 library, version 2.0.1.+description: Low-level bindings to the SDL2 library, version 2.0.3. license: BSD3 license-file: LICENSE author: Gabríel Arthúr Pétursson@@ -45,7 +45,7 @@ SDL2 pkgconfig-depends:- sdl2 >= 2.0.1+ sdl2 >= 2.0.3 build-depends: base == 4.*