Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Event Press vs Hold #439

Open
Cullen-Enerdyne opened this issue Jun 26, 2022 · 7 comments
Open

Event Press vs Hold #439

Cullen-Enerdyne opened this issue Jun 26, 2022 · 7 comments
Assignees
Labels
Events Issues related to the event system

Comments

@Cullen-Enerdyne
Copy link
Collaborator

Currently we have event types EventType_MousePress and EventType_MouseRelease, as well as EventType_KeyPress and EventType_KeyRelease.

It is unclear, however, what is set during a mouse hold. Is the 'press' true the whole time the button is depressed, or is this only true on the press? Additionally, is the release true whenever the key is not depressed, or is this set once on release and then back to false?

My current assumption is that these are only set true on state changes (i.e. both normally false, and both false during a hold).

If this is not the case, we need to be able to differentiate between all these events somehow.
The current API also needs some more clarity.

@Cullen-Enerdyne Cullen-Enerdyne added the Events Issues related to the event system label Jun 26, 2022
@AlexvZyl
Copy link
Owner

AlexvZyl commented Jun 26, 2022

Mouse presses and releases are fired as separate events (this is standard among most frameworks).

For the rest of the events you can get the button state with EventType_MouseButtonXXXX.

What needs clarity? I do not think we need any additional functionality, but we could change some naming.

@AlexvZyl
Copy link
Owner

AlexvZyl commented Jun 26, 2022

Same goes for key events, except we only keep track of very specific keys for general events (Both alts, both controls, both shifts and spacebar). Keys also support repeats (when a key is held down).

@Cullen-Enerdyne
Copy link
Collaborator Author

I think at this stage its most important to know when those special keys are held.
How can I tell if LCTRL is held? Must I keep track between a 'press' and 'release' event myself?

@AlexvZyl
Copy link
Owner

AlexvZyl commented Jun 27, 2022

No, it can be checked by doing event.isType(EventType_LeftCtrl); in any fired events.

@AlexvZyl
Copy link
Owner

AlexvZyl commented Jun 27, 2022

Take a look here:

void EngineCore::onMouseDragEventForce(const MouseDragEvent& event) 
{
    if (event.isType(EventType_MouseButtonMiddle)
     || event.isType(EventType_MouseButtonLeft | EventType_SpaceBar))
    {
        onMouseDragEvent(event);	
    }
}

@AlexvZyl
Copy link
Owner

On a sidenote: I do not think that logic should sit in that function, we might have to move it.

@AlexvZyl
Copy link
Owner

AlexvZyl commented Jul 2, 2022

This issue has made me think how we work with input and spawned #444.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Events Issues related to the event system
Projects
None yet
Development

No branches or pull requests

2 participants