Skip to content

Added set_led method for Joystick and Controller objects #3507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 29, 2025

Conversation

oddbookworm
Copy link
Member

closes #3506

@oddbookworm oddbookworm requested a review from a team as a code owner June 17, 2025 02:47
@oddbookworm oddbookworm added New API This pull request may need extra debate as it adds a new class or function to pygame joystick pygame.joystick labels Jun 17, 2025
@oddbookworm
Copy link
Member Author

Simple test script:

import pygame.joystick

pygame.joystick.init()

joy = pygame.joystick.Joystick(0)
joy.set_led(pygame.Color(255, 0, 0))

@oddbookworm
Copy link
Member Author

trim.CE315EE5-953B-48EA-A006-A9C5B8149BAE.MOV

@oddbookworm
Copy link
Member Author

I don't currently have a functional SDL3 setup, is someone else able to test it?

@MightyJosip
Copy link
Member

MightyJosip commented Jun 17, 2025

Tested on SDL3, and after fixing different errors (none of them related to your PR), I can confirm it works, so 👍 on that. However, I agree with Ankith comments on what should be fixed

Copy link
Member

@MightyJosip MightyJosip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is also SDL_GameControllerSetLED in controller module so that should be added as well

Copy link
Member

@ankith26 ankith26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the PR 🎉

I do not have the hardware to test this, but I request @zoldalma999 s review on this as our controller/joystick expert.

@ankith26 ankith26 added this to the 2.5.6 milestone Jun 18, 2025
@ankith26 ankith26 requested a review from zoldalma999 June 18, 2025 04:18
Copy link
Member

@MightyJosip MightyJosip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. Thank you for the PR, 👍

@MightyJosip MightyJosip changed the title Added Joystick.set_led Added set_led method for Joystick and Controller objects Jun 18, 2025
@MightyJosip MightyJosip added the controller pygame.controller label Jun 18, 2025
Copy link
Member

@zoldalma999 zoldalma999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, apart from one comment

@oddbookworm
Copy link
Member Author

@zoldalma999 fixed your nitpick (it was a valid nitpick that I overlooked)

@ankith26 ankith26 merged commit 7896a55 into pygame-community:main Jun 29, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
controller pygame.controller joystick pygame.joystick New API This pull request may need extra debate as it adds a new class or function to pygame
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add implementation of JoystickSetLED function.
4 participants