Skip to content

Comments

Add slider menu item, configuring on-screen controls size#3021

Open
provigz wants to merge 12 commits intoSuperTux:masterfrom
provigz:slider-menu-item
Open

Add slider menu item, configuring on-screen controls size#3021
provigz wants to merge 12 commits intoSuperTux:masterfrom
provigz:slider-menu-item

Conversation

@provigz
Copy link
Member

@provigz provigz commented Jul 15, 2024

Adds the ItemSlider menu item. It allows selecting an integer value between a minimum and a maximum value. It can be used with the left mouse button, left/right arrow keys or scroll wheel. The slider step (interval between values when using the arrow keys or scroll wheel) is configurable from "Options" -> "Advanced".

The sound volume, music volume and flash intensity options now utilize a slider. The on-screen controls scale option was added back in "Options" -> "Controls" and utilizes a slider as well.

Supertux.Menu.Sliders-1.mp4

Additionally:

  • The on-screen controls toggle has also been re-added in "Options" -> "Controls".
  • The on-screen controls configuration values were changed to allow for broader scale customization.

Closes #3010.
Closes #3033.

provigz added 2 commits July 15, 2024 18:31
Adds the `ItemSlider` menu item. It allows selecting an integer value between a minimum and a maximum value. It can be used with the left mouse button and the left/right arrow keys.

The sound volume, music volume and flash intensity options now utilize a slider. The on-screen controls scale option was added back in "Options" -> "Controls" and utilizes a slider as well.

Additionally:

* The on-screen controls toggle has also been re-added in "Options" -> "Controls".
* The on-screen controls configuration values were changed to allow for broader scale customization.

Closes SuperTux#3010.
Copy link
Contributor

@MatusGuy MatusGuy left a comment

Choose a reason for hiding this comment

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

This is ideal for the volume sliders! Just make sure there's a way to specify the step.

@provigz
Copy link
Member Author

provigz commented Jul 15, 2024

Just make sure there's a way to specify the step.

What step?

@MatusGuy
Copy link
Contributor

The step is the interval between values.
For example, if the step is 5, each time you press the right key, instead of increasing by 1 it increases by 5. And when using a cursor it snaps to the right place.

@provigz
Copy link
Member Author

provigz commented Jul 15, 2024

Sure, will make an option for it.

@tobbi
Copy link
Member

tobbi commented Jul 15, 2024

I haven't tested it yet but... Many of the sliders in UI Frameworks have the option of increasing / decreasing when the user hovers over the slider and uses the mouse wheel. Any plans on implementing that?

@provigz
Copy link
Member Author

provigz commented Jul 15, 2024

Will do, I forgot they had that.

@provigz
Copy link
Member Author

provigz commented Jul 15, 2024

Added customizable slider steps and scroll wheel support.

@CranialTyrant
Copy link

CranialTyrant commented Jul 16, 2024

@Vankata453 Awesome work! Will these features be added to the Android version?

@provigz
Copy link
Member Author

provigz commented Jul 16, 2024

Will these features be added to the Android version?

After this is merged, they will.

@tobbi
Copy link
Member

tobbi commented Jul 16, 2024

/home/runner/work/supertux/supertux/src/gui/item_slider.cpp:90:96: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
        *m_value = static_cast<int>(((mouse_pos.x - m_slider_x) / SLIDER_WIDTH) * (m_max_value - m_min_value)) + m_min_value;
                                                                                ~  ~~~~~~~~~~~~^~~~~~~~~~~~~
/home/runner/work/supertux/supertux/src/gui/item_slider.cpp:114:96: error: implicit conversion from 'int' to 'float' may lose precision [-Werror,-Wimplicit-int-float-conversion]
        *m_value = static_cast<int>(((mouse_pos.x - m_slider_x) / SLIDER_WIDTH) * (m_max_value - m_min_value)) + m_min_value;
                                                                                ~  ~~~~~~~~~~~~^~~~~~~~~~~~~
2 errors generated.

Copy link
Contributor

@MatusGuy MatusGuy left a comment

Choose a reason for hiding this comment

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

Will test this pretty soon.

Copy link
Contributor

@MatusGuy MatusGuy left a comment

Choose a reason for hiding this comment

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

I really don't like the step option in the config menu. First time mobile port users will be extremely confused when they see the slider going from min to max instantly when using the left/right buttons because they don't know what a "slider step" is (and they're not supposed to).

When using the slider with the mouse on the volume controls, it lags the game. If you want I will investigate this.

I gotta say. I really like how the mouse can be used for precision and the arrows can be used for bringing up quick values. But I think the roles should be switched. When using the mouse, the value should be snapped to the defined step, and the arrow keys should be used for precision values, because if the mouse is somewhat defective, that "precision" is lost.

I'm excited for this!

@provigz provigz added this to the 0.7.0 milestone Jan 25, 2025
@Alasdairbugs
Copy link
Contributor

Moving to 0.7.1

@Alasdairbugs Alasdairbugs modified the milestones: 0.7.0, 0.7.1 Nov 17, 2025
@swagtoy
Copy link
Member

swagtoy commented Nov 18, 2025

Why?

@Alasdairbugs
Copy link
Contributor

This isn't crucial for 0.7.0

@tobbi
Copy link
Member

tobbi commented Nov 18, 2025

@provigz Please rebase.

@swagtoy
Copy link
Member

swagtoy commented Nov 18, 2025

This isn't crucial for 0.7.0

But it works, and it's pretty harmless. What is the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add touch controls for Windows and Linux based tablets [Feature Request]: Size slider for on-screen controls

6 participants