Comments (5)
Down
is standard in UI frameworks (Winforms, WPF, egui, ImGui, Swift, Web). I don't know of any that uses the word Held
. I'd prefer we stick to what people might recognize.
from stride.
Held - was Down in the previous frame, and still Down now
I think we should avoid discussing this specific implementation, as you said, the specifics of it is just not that useful and may introduce an unwanted delay to inputs as users may think this would be similar to the Down you described, increasing confusion even more.
I would agree, not that useful and may introduce unexpected and unwanted behavior. Though was worth bringing up still I think.
Maybe
Held
/Down
should beButtonState
instead. It sure is not as nice but I don't think users could misinterpret its specifics
I have always really disliked Unity's Input.GetButton
as to me it doesn't convay well that it is returning the button's current state, and not an actual button object of some kind.
Godot:
Bevy:
Adding the just
infront makes sense, but also feels really clunky to me, and 'un C#', plus then you get Input.WasVirtualButtonJustPressed
which is starting to get pretty long. (Not that it is everything, but I think worth considering and making note of)
A note on how the input actually works right now.
For VirtualButtons all states are processed once each update. For low-level device inputs, the Down
state is update immediatly, while the Pressed
and Released
is update once each update. So, technically, depending on the call order, it might be possible for Down
to be called before Pressed
, but I am not completly sure on this.
Not sure how relevent it is, but wanted to add a bit of clarification if it was needed.
from stride.
Having thought about this myself a while back, I didn't reach quite your conclusion. I think adding 'Held' would be nice to have but not remove 'Down'.
Unfortunately the difficulty is due to what the previous button's state was, which may be important.
The states I think are of interest are:
- Pressed - "just pressed", ie. was Up in the previous frame, but now Down (
IsButtonPressed(...)
) - Held - was Down in the previous frame, and still Down now
- Released - "just released", ie. was Down in the previous frame, but now Up (
IsButtonReleased(...)
)
But there's two more other states to think about:
- Down - is Down now, the previous frame does not matter (this is the current behavior of
IsButtonDown(...)
) - Up - is Up now, the previous frame does not matter (basically just
!IsButtonDown(...)
)
So, 'Down' would actually mean either 'Pressed' or 'Held'.
Or if you want to add 'Held' as a new state, then 'Held' would mean 'Down' and not 'Pressed'.
Though to be honest, I'm not really sure if I can think of a scenario where you really need to know if a button is 'held' (ie both previous frame & current frame down), I'm sure someone can point out a situation though.
from stride.
Held - was Down in the previous frame, and still Down now
I think we should avoid discussing this specific implementation, as you said, the specifics of it is just not that useful and may introduce an unwanted delay to inputs as users may think this would be similar to theDown
you described, increasing confusion even more.
I prefer Held
over Down
as it is more specific, but it's still not perfect; @Basewq going over his implementation does show that it could be interpreted in that way as well.
Maybe Held
/Down
should be ButtonState
instead. It sure is not as nice but I don't think users could misinterpret its specifics ?
Unity has this naming scheme:
Input.GetButton
Input.GetButtonDown
Input.GetButtonUp
myInput.isPressed
myInput.wasPressedThisFrame
myInput.wasReleasedThisFrame
Godot:
is_action_pressed
is_action_just_pressed
is_action_just_released
Bevy:
pressed
just_pressed
just_released
UE is all event based, so not really applicable here.
from stride.
My personal preference is press/release naming in line with John Carmack's description on UI design:
https://x.com/ID_AA_Carmack/status/1787850053912064005
And then "Down" would refer to the current state of the key, whether it is "down" or not. I also believe that this naming convention translates well to analogue keyboards.
from stride.
Related Issues (20)
- Overflow Exception when getting SoundInstance position
- Current Stride.Native.targets file prevents from using modern NET MSBuild
- Can't load assets when the root asset/folder name has # prefix HOT 4
- OpenGL ES 2 support dropped without official notice
- Potential skin/bone animation bug HOT 1
- Android crashes when clicking into EditText UI control HOT 1
- Setup VirtualButtons, configs and config sets from the editor
- Proposal - Migrate PVRTC in favor of more modern ASTC or other compression format HOT 1
- Add ExpDecay function for framerate independent damping HOT 2
- PublishSingleFile removes icon HOT 5
- Linux build does not include necessary library (freetype) HOT 1
- [Docs] GraphicsCompositor - Add XML summary HOT 1
- FBX Import Child Of Modifier is ignored HOT 1
- FBX Bone Start is root for bone links HOT 3
- UI Stack panels in Visual Tree not updating order
- FindName Mention that it may return the parent object of same name
- Nagivation doesnt work with static meshes HOT 2
- An error occurred while updating the launche
- Stride doesn't start HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stride.