Shift/Alt/ctrl key support for Menu Sliders/numbers

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Shift/Alt/ctrl key support for Menu Sliders/numbers

Re: Shift/Alt/ctrl key support for Menu Sliders/numbers

by Marisa the Magician » Thu Dec 30, 2021 3:07 am

Relevant code for how I did it here.

It's hacky and there's probably a better way to do this than to pass the modifiers to all items in a loop.

Re: Shift/Alt/ctrl key support for Menu Sliders/numbers

by Major Cooke » Wed Dec 29, 2021 6:12 pm

Marisa Kirisame wrote:I've already implemented something like this myself on one of my mods and it sure helps a lot with the sliders that have really tiny increments.

It requires changes in the options menu itself because items themselves have no way to read the state of those three keys otherwise.
Can you show me in particular? If this can be done, I could reform it and make a proper submission for it, giving credit to you of course.

Re: Shift/Alt/ctrl key support for Menu Sliders/numbers

by Marisa the Magician » Wed Dec 29, 2021 7:19 am

I've already implemented something like this myself on one of my mods and it sure helps a lot with the sliders that have really tiny increments.

It requires changes in the options menu itself because items themselves have no way to read the state of those three keys otherwise.

Re: Shift/Alt/ctrl key support for Menu Sliders/numbers

by yum13241 » Wed Dec 29, 2021 5:25 am

I second this, it would be very useful if it gets added in.

Shift/Alt/ctrl key support for Menu Sliders/numbers

by Major Cooke » Wed Sep 22, 2021 3:18 pm

Some mods like my own have large number scales in their menus. It'd be nice if there could be an implementation within GZDoom's base itself that everyone can take advantage of.

I.e. say a slider has 100 units, and ticks by 1 when moving along with the keyboard. Could we add additional parameters to define when holding the shift/alt/ctrl keys, so I don't have to create duplicates that have bigger scaling units?

This would allow me to change this:

Code: Select all

	Slider "$MCM_HEALTHMUL1_TEXT",		MCC_HealthMul,			0.5, 100.0, 0.1
	Slider "$MCM_HEALTHMUL2_TEXT",		MCC_HealthMul,			1.0, 100.0, 1.0
Into this:

Code: Select all

Slider "$MCM_HEALTHMUL_TEXT",		MCC_HealthMul,			0.5, 100.0, 0.1, 1.0, 0.05, 10.0
In order, left to right:
  • Shift value amount. Programs like Blender tend to use this to amplify the change.
  • Alt value amount. Usually used to reduce the amount changed for precision.
  • Ctrl/cmd value amount. Special case where it's percentage based instead.
So in my example above, when holding one of the keys and changing the value with key arrows:
  • Holding shift would do so by 1.0 instead of 0.1
  • Holding alt would be by 0.05 instead of 0.1
  • Holding ctrl/cmd would go by 10% of the range instead of by value. Limited to range [0.0, 100.0]

Top