Giter VIP home page Giter VIP logo

Comments (5)

Kryptos-FR avatar Kryptos-FR commented on June 25, 2024 2

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.

MechWarrior99 avatar MechWarrior99 commented on June 25, 2024 1

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 be ButtonState 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.

Basewq avatar Basewq commented on June 25, 2024

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.

Eideren avatar Eideren commented on June 25, 2024

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 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.

Fydar avatar Fydar commented on June 25, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.