You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Working with scancodes makes it much harder to have configurable input, so being able to use actions would be helpful. InputEventKey provides the function (from the base class InputEvent) is_action(String action) that could be checked instead of checking solely the scancode.
Proposal
Exports
Export an enum to determine whether actions, scancodes, or both should be used to check input. If more input types are to be added, booleans for each type should replace this. Note also that instead of the break scancode being a private variable, it will be exported in this proposal, along with the action.
The keys for scrolling + accepting input text will also be added as exports.
All instances of checking scancodes will be replaced by the helper function (except for backspace)
func_input(event):
if(eventisInputEventKeyandevent.pressed):
if(SCROLL_SKIPPED_LINESand (_is_input_active(event, UP_SCANCODE, UP_ACTION) or_is_input_active(event, DOWN_SCANCODE, DOWN_ACTION))): # User is just scrolling the textif(_is_input_active(event, UP_SCANCODE, UP_ACTION)):
# ...else:
# ...elif(_state==1and_on_break): # If its on a breakif(_is_input_active(event, BREAK_SCANCODE, BREAK_ACTION)):
# ...elif(_state==2): # If its on the input state# ...if(event.scancode==KEY_BACKSPACE): # Delete last character# ...elif(_is_input_active(event, ACCEPT_SCANCODE, ACCEPT_ACTION)): # Finish input# ...
The text was updated successfully, but these errors were encountered:
Working with scancodes makes it much harder to have configurable input, so being able to use actions would be helpful.
InputEventKey
provides the function (from the base classInputEvent
)is_action(String action)
that could be checked instead of checking solely the scancode.Proposal
Exports
Export an enum to determine whether actions, scancodes, or both should be used to check input. If more input types are to be added, booleans for each type should replace this. Note also that instead of the break scancode being a private variable, it will be exported in this proposal, along with the action.
The keys for scrolling + accepting input text will also be added as exports.
Helper functions
Add a function to check if the event corresponds to the action/scancode while also taking into consideration the
INPUT_TYPE
selected.2 helper functions will be added to more concisely check if the
INPUT_TYPE
includes action or scancode._input
FunctionAll instances of checking scancodes will be replaced by the helper function (except for backspace)
The text was updated successfully, but these errors were encountered: