File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -571,6 +571,24 @@ impl GameController {
571
571
Ok ( ( ) )
572
572
}
573
573
}
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
+ }
574
592
}
575
593
576
594
#[ cfg( feature = "hidapi" ) ]
Original file line number Diff line number Diff line change @@ -464,6 +464,24 @@ impl Joystick {
464
464
Ok ( ( ) )
465
465
}
466
466
}
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
+ }
467
485
}
468
486
469
487
impl Drop for Joystick {
You can’t perform that action at this time.
0 commit comments