-
-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fully expose InputBindings to Lua #5965
Merged
sturnclaw
merged 10 commits into
pioneerspacesim:master
from
sturnclaw:lua-input-bindings
Nov 14, 2024
Merged
Fully expose InputBindings to Lua #5965
sturnclaw
merged 10 commits into
pioneerspacesim:master
from
sturnclaw:lua-input-bindings
Nov 14, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mwerle
reviewed
Nov 13, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't pretend to understand half of this, and haven't actually tried it, but looking good.
Otsukaresamadeshita!
- Migrated from ui.keys, kept redirection assignment - Functions querying UI key state remain in the pigui namespace
- These callbacks are unused and we typically do not have a need for an input frame owner to be notified of when someone else pushes an input frame to the stack
- Allows better identifying which input frame is currently active and is responsible for registering specific inputs
- Allows Lua to create and register InputFrames and associate input bindings with those frames - InputFrames are automatically removed from the input stack if they go out-of-scope and are cleaned up by Lua GC
- AddActionBinding / AddAxisBinding always overwrite existing bindings - Add separate query functions to allow determining the existence of a binding before clobbering it
- Lua can now create and register axis and action bindings. - A warning message will be logged if a binding is attempted to be registered twice (i.e. hot-reload)
- These functions are not callbacks and are used to artificially toggle the state of an action binding from Lua
- Lua callbacks for action press/release and axis value-change events are supported - Multiple callbacks can be registered per binding, and support is present to unregister a callback from all associated bindings
sturnclaw
force-pushed
the
lua-input-bindings
branch
from
November 13, 2024 17:56
357de78
to
69af3a8
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since the Input subsystem was written, we've had partial support for interacting with it from Lua code. Over time, those capabilities have been expanded, but have remained strictly read-only.
This PR changes that, providing a proper way for Lua code to register input bindings, make those bindings active and able to receive input, and listen for input events coming from those bindings.
Now, Lua code can register Action/AxisBindings at startup, create an InputFrame to make those bindings active, push that frame when appropriate, register callbacks to be called from C++ when the input binding is activated, and then pop the input frame when the bindings should no longer be receiving input.
This PR does not:
Further work by other developers would be very much appreciated to move old code using the
ui.isKeyPressed()
API to the new Input API, and to provide keybindings to otherwise un-bindable actions that are currently only accessible through the UI.