Skip to content
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

update menu so selection is circular #36

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

didiermichel
Copy link
Contributor

Playing with the badge, I though this could be nice as the number of menu items is growing.

Going down when the last item is selected, selection goes to the fist item
nd going up from first item brings us to the last item.

…em is selected, selection goes to the fist item and going up from first item brings us to the last item)
if released && buttons.Pins[shifter.BUTTON_UP].Get() && selected > 0 {
selected--
if released && buttons.Pins[shifter.BUTTON_UP].Get(){
prevSel := selected
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better if we pre-allocate/define the variable outside the loop (at the same time as selected instead to create it each time.
Also, maybe call it prevSelected to keep the parallelism with selected

what do you thing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants