You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
Add support for joypad LED lights
This commit is contained in:
@@ -301,6 +301,19 @@ void JoypadSDL::close_joypad(int p_pad_idx) {
|
||||
}
|
||||
}
|
||||
|
||||
bool JoypadSDL::Joypad::has_joy_light() const {
|
||||
SDL_PropertiesID properties_id = SDL_GetJoystickProperties(get_sdl_joystick());
|
||||
if (properties_id == 0) {
|
||||
return false;
|
||||
}
|
||||
return SDL_GetBooleanProperty(properties_id, SDL_PROP_JOYSTICK_CAP_RGB_LED_BOOLEAN, false) || SDL_GetBooleanProperty(properties_id, SDL_PROP_JOYSTICK_CAP_MONO_LED_BOOLEAN, false);
|
||||
}
|
||||
|
||||
bool JoypadSDL::Joypad::set_joy_light(const Color &p_color) {
|
||||
Color linear = p_color.srgb_to_linear();
|
||||
return SDL_SetJoystickLED(get_sdl_joystick(), linear.get_r8(), linear.get_g8(), linear.get_b8());
|
||||
}
|
||||
|
||||
SDL_Joystick *JoypadSDL::Joypad::get_sdl_joystick() const {
|
||||
return SDL_GetJoystickFromID(sdl_instance_idx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user