packages feed

sdl2 2.5.2.0 → 2.5.3.0

raw patch · 8 files changed

+73/−10 lines, 8 files

Files

ChangeLog.md view
@@ -1,3 +1,11 @@+2.5.3.0+=======++* Correct the Storable instance for SDL.Raw.Types.Event to correctly convert+  SDL_CONTROLLERAXISMOTION to a ControllerAxisEvent (it was previously+  ControllerButtonEvent). See https://github.com/haskell-game/sdl2/pull/218 for+  more details.+ 2.5.2.0 ======= 
examples/AudioExample.hs view
@@ -13,8 +13,8 @@ sinSamples =   map (\n ->          let t = fromIntegral n / 48000 :: Double-             freq = 440 * 4-         in round (fromIntegral (maxBound `div` 2 :: Int16) * sin (t * freq)))+             freq = 440+         in round (fromIntegral (maxBound `div` 2 :: Int16) * sin (2 * pi * freq * t)))       [0 :: Int32 ..]  audioCB :: IORef [Int16] -> AudioFormat sampleType -> V.IOVector sampleType -> IO ()
sdl2.cabal view
@@ -1,5 +1,5 @@ name:                sdl2-version:             2.5.2.0+version:             2.5.3.0 synopsis:            Both high- and low-level bindings to the SDL library (version 2.0.6+). description:   This package contains bindings to the SDL 2 library, in both high- and
src/SDL/Event.hs view
@@ -744,7 +744,8 @@ convertRaw (Raw.UnknownEvent t ts) =   return (Event ts (UnknownEvent (UnknownEventData t))) --- | Poll for currently pending events. You can only call this function in the thread that set the video mode.+-- | Poll for currently pending events. You can only call this function in the+-- OS thread that set the video mode. pollEvent :: MonadIO m => m (Maybe Event) pollEvent =   liftIO $ do@@ -760,6 +761,9 @@                else fmap Just (peek e >>= convertRaw)  -- | Clear the event queue by polling for all pending events.+--+-- Like 'pollEvent' this function should only be called in the OS thread which+-- set the video mode. pollEvents :: (Functor m, MonadIO m) => m [Event] pollEvents =   do e <- pollEvent@@ -868,7 +872,7 @@ -- -- This function updates the event queue and internal input device state. ----- This should only be run in the thread that initialized the video subsystem, and for extra safety, you should consider only doing those things on the main thread in any case.+-- This should only be run in the OS thread that initialized the video subsystem, and for extra safety, you should consider only doing those things on the main thread in any case. -- -- 'pumpEvents' gathers all the pending input information from devices and places it in the event queue. Without calls to 'pumpEvents' no events would ever be placed on the queue. Often the need for calls to 'pumpEvents' is hidden from the user since 'pollEvent' and 'waitEvent' implicitly call 'pumpEvents'. However, if you are not polling or waiting for events (e.g. you are filtering them), then you must call 'pumpEvents' to force an event queue update. --
src/SDL/Input/GameController.hs view
@@ -56,6 +56,25 @@     Raw.SDL_CONTROLLER_BUTTON_DPAD_RIGHT -> ControllerButtonDpadRight     _ -> ControllerButtonInvalid +instance ToNumber ControllerButton Int32 where+  toNumber c = case c of+    ControllerButtonA -> Raw.SDL_CONTROLLER_BUTTON_A+    ControllerButtonB -> Raw.SDL_CONTROLLER_BUTTON_B+    ControllerButtonX -> Raw.SDL_CONTROLLER_BUTTON_X+    ControllerButtonY -> Raw.SDL_CONTROLLER_BUTTON_Y+    ControllerButtonBack -> Raw.SDL_CONTROLLER_BUTTON_BACK+    ControllerButtonGuide -> Raw.SDL_CONTROLLER_BUTTON_GUIDE+    ControllerButtonStart -> Raw.SDL_CONTROLLER_BUTTON_START+    ControllerButtonLeftStick -> Raw.SDL_CONTROLLER_BUTTON_LEFTSTICK+    ControllerButtonRightStick -> Raw.SDL_CONTROLLER_BUTTON_RIGHTSTICK+    ControllerButtonLeftShoulder -> Raw.SDL_CONTROLLER_BUTTON_LEFTSHOULDER+    ControllerButtonRightShoulder -> Raw.SDL_CONTROLLER_BUTTON_RIGHTSHOULDER+    ControllerButtonDpadUp -> Raw.SDL_CONTROLLER_BUTTON_DPAD_UP+    ControllerButtonDpadDown -> Raw.SDL_CONTROLLER_BUTTON_DPAD_DOWN+    ControllerButtonDpadLeft -> Raw.SDL_CONTROLLER_BUTTON_DPAD_LEFT+    ControllerButtonDpadRight -> Raw.SDL_CONTROLLER_BUTTON_DPAD_RIGHT+    ControllerButtonInvalid -> Raw.SDL_CONTROLLER_BUTTON_INVALID+ -- | Identifies the state of a controller button. data ControllerButtonState   = ControllerButtonPressed
src/SDL/Raw/Enum.hsc view
@@ -903,6 +903,22 @@   -- ** Window Positioning   pattern SDL_WINDOWPOS_UNDEFINED,   pattern SDL_WINDOWPOS_CENTERED,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_0,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_1,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_2,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_3,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_4,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_5,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_6,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_7,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_8,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_9,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_10,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_11,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_12,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_13,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_14,+  pattern SDL_WINDOWPOS_CENTERED_DISPLAY_15,    -- ** Haptic Event Types   pattern SDL_HAPTIC_CONSTANT@@ -1772,5 +1788,21 @@  pattern SDL_WINDOWPOS_UNDEFINED = (#const SDL_WINDOWPOS_UNDEFINED) pattern SDL_WINDOWPOS_CENTERED = (#const SDL_WINDOWPOS_CENTERED)+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_0 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(0))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_1 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(1))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_2 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(2))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_3 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(3))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_4 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(4))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_5 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(5))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_6 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(6))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_7 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(7))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_8 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(8))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_9 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(9))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_10 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(10))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_11 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(11))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_12 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(12))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_13 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(13))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_14 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(14))+pattern SDL_WINDOWPOS_CENTERED_DISPLAY_15 = (#const SDL_WINDOWPOS_CENTERED_DISPLAY(15))  pattern SDL_HAPTIC_CONSTANT = (#const SDL_HAPTIC_CONSTANT)
src/SDL/Raw/Types.hsc view
@@ -545,7 +545,7 @@         which <- (#peek SDL_Event, caxis.which) ptr         axis <- (#peek SDL_Event, caxis.axis) ptr         value <- (#peek SDL_Event, caxis.value) ptr-        return $! ControllerButtonEvent typ timestamp which axis value+        return $! ControllerAxisEvent typ timestamp which axis value       (#const SDL_CONTROLLERBUTTONDOWN) -> controllerbutton $ ControllerButtonEvent typ timestamp       (#const SDL_CONTROLLERBUTTONUP) -> controllerbutton $ ControllerButtonEvent typ timestamp       (#const SDL_CONTROLLERDEVICEADDED) -> controllerdevice $ ControllerDeviceEvent typ timestamp
src/SDL/Video.hs view
@@ -225,15 +225,15 @@ instance FromNumber WindowMode Word32 where   fromNumber n = fromMaybe Windowed . getFirst $     foldMap First [-        sdlWindowFullscreen-      , sdlWindowFullscreenDesktop+        sdlWindowFullscreenDesktop+      , sdlWindowFullscreen       , sdlWindowMaximized       , sdlWindowMinimized       ]     where-      maybeBit val msk = if n .&. msk > 0 then Just val else Nothing-      sdlWindowFullscreen        = maybeBit Fullscreen Raw.SDL_WINDOW_FULLSCREEN+      maybeBit val msk = if n .&. msk == msk then Just val else Nothing       sdlWindowFullscreenDesktop = maybeBit FullscreenDesktop Raw.SDL_WINDOW_FULLSCREEN_DESKTOP+      sdlWindowFullscreen        = maybeBit Fullscreen Raw.SDL_WINDOW_FULLSCREEN       sdlWindowMaximized         = maybeBit Maximized Raw.SDL_WINDOW_MAXIMIZED       sdlWindowMinimized         = maybeBit Minimized Raw.SDL_WINDOW_MINIMIZED