Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdl2.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ library
else
if flag(pkgconfig)
pkgconfig-depends:
sdl2 >= 2.0.6
sdl2 >= 2.0.9

build-depends:
base >= 4.7 && < 5,
Expand Down
6 changes: 6 additions & 0 deletions src/SDL/Raw/Event.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ module SDL.Raw.Event (
gameControllerNameForIndex,
gameControllerOpen,
gameControllerUpdate,
gameControllerRumble,
isGameController,
eventBuffer,
eventBufferSize
Expand Down Expand Up @@ -235,6 +236,7 @@ foreign import ccall "SDL.h SDL_GameControllerName" gameControllerNameFFI :: Gam
foreign import ccall "SDL.h SDL_GameControllerNameForIndex" gameControllerNameForIndexFFI :: CInt -> IO CString
foreign import ccall "SDL.h SDL_GameControllerOpen" gameControllerOpenFFI :: CInt -> IO GameController
foreign import ccall "SDL.h SDL_GameControllerUpdate" gameControllerUpdateFFI :: IO ()
foreign import ccall "SDL.h SDL_GameControllerRumble" gameControllerRumbleFFI :: GameController -> CUShort -> CUShort -> CUInt -> IO CInt
foreign import ccall "SDL.h SDL_IsGameController" isGameControllerFFI :: CInt -> IO Bool

foreign import ccall "sdlhelper.c SDLHelper_GetEventBufferSize" eventBufferSize :: CInt
Expand Down Expand Up @@ -675,6 +677,10 @@ gameControllerUpdate :: MonadIO m => m ()
gameControllerUpdate = liftIO gameControllerUpdateFFI
{-# INLINE gameControllerUpdate #-}

gameControllerRumble :: MonadIO m => GameController -> CUShort -> CUShort -> CUInt -> m CInt
gameControllerRumble v1 v2 v3 v4 = liftIO $ gameControllerRumbleFFI v1 v2 v3 v4
{-# INLINE gameControllerRumble #-}

isGameController :: MonadIO m => CInt -> m Bool
isGameController v1 = liftIO $ isGameControllerFFI v1
{-# INLINE isGameController #-}
Loading