File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -571,6 +571,24 @@ impl GameController {
571571 Ok ( ( ) )
572572 }
573573 }
574+
575+ /// Send a controller specific effect packet.
576+ #[ doc( alias = "SDL_GameControllerSendEffect" ) ]
577+ pub fn send_effect ( & mut self , data : & [ u8 ] ) -> Result < ( ) , IntegerOrSdlError > {
578+ let result = unsafe {
579+ sys:: SDL_GameControllerSendEffect (
580+ self . raw ,
581+ data. as_ptr ( ) as * const libc:: c_void ,
582+ data. len ( ) as i32 ,
583+ )
584+ } ;
585+
586+ if result != 0 {
587+ Err ( IntegerOrSdlError :: SdlError ( get_error ( ) ) )
588+ } else {
589+ Ok ( ( ) )
590+ }
591+ }
574592}
575593
576594#[ cfg( feature = "hidapi" ) ]
Original file line number Diff line number Diff line change @@ -464,6 +464,24 @@ impl Joystick {
464464 Ok ( ( ) )
465465 }
466466 }
467+
468+ /// Send a joystick specific effect packet.
469+ #[ doc( alias = "SDL_JoystickSendEffect" ) ]
470+ pub fn send_effect ( & mut self , data : & [ u8 ] ) -> Result < ( ) , IntegerOrSdlError > {
471+ let result = unsafe {
472+ sys:: SDL_JoystickSendEffect (
473+ self . raw ,
474+ data. as_ptr ( ) as * const libc:: c_void ,
475+ data. len ( ) as i32 ,
476+ )
477+ } ;
478+
479+ if result != 0 {
480+ Err ( IntegerOrSdlError :: SdlError ( get_error ( ) ) )
481+ } else {
482+ Ok ( ( ) )
483+ }
484+ }
467485}
468486
469487impl Drop for Joystick {
You can’t perform that action at this time.
0 commit comments