Skip to content

Commit dfb3195

Browse files
asivitzdpwiz
authored andcommitted
Expose game controller rumble functionality
1 parent 61ecf69 commit dfb3195

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/SDL/Raw/Event.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ module SDL.Raw.Event (
112112
gameControllerNameForIndex,
113113
gameControllerOpen,
114114
gameControllerUpdate,
115+
gameControllerRumble,
115116
isGameController,
116117
eventBuffer,
117118
eventBufferSize
@@ -235,6 +236,7 @@ foreign import ccall "SDL.h SDL_GameControllerName" gameControllerNameFFI :: Gam
235236
foreign import ccall "SDL.h SDL_GameControllerNameForIndex" gameControllerNameForIndexFFI :: CInt -> IO CString
236237
foreign import ccall "SDL.h SDL_GameControllerOpen" gameControllerOpenFFI :: CInt -> IO GameController
237238
foreign import ccall "SDL.h SDL_GameControllerUpdate" gameControllerUpdateFFI :: IO ()
239+
foreign import ccall "SDL.h SDL_GameControllerRumble" gameControllerRumbleFFI :: GameController -> CUShort -> CUShort -> CUInt -> IO CInt
238240
foreign import ccall "SDL.h SDL_IsGameController" isGameControllerFFI :: CInt -> IO Bool
239241

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

680+
gameControllerRumble :: MonadIO m => GameController -> CUShort -> CUShort -> CUInt -> m CInt
681+
gameControllerRumble v1 v2 v3 v4 = liftIO $ gameControllerRumbleFFI v1 v2 v3 v4
682+
{-# INLINE gameControllerRumble #-}
683+
678684
isGameController :: MonadIO m => CInt -> m Bool
679685
isGameController v1 = liftIO $ isGameControllerFFI v1
680686
{-# INLINE isGameController #-}

0 commit comments

Comments
 (0)