Skip to content
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

Not possible to show secondary inputs #18

Open
rsubtil opened this issue Jan 16, 2023 · 2 comments
Open

Not possible to show secondary inputs #18

rsubtil opened this issue Jan 16, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@rsubtil
Copy link
Owner

rsubtil commented Jan 16, 2023

When an input action has multiple alternative keys/buttons, only the first mapping is shown:
image
There should be a way for developers to:

  • Show both available mappings (maybe cycle between them at fixed times)
  • Show a specific mapping (maybe through the path itself, e.g. my_action{2} to show the second mapping if it exists)
@rsubtil rsubtil added the enhancement New feature or request label Feb 22, 2024
@3ter
Copy link

3ter commented Feb 2, 2025

Thanks a lot for the great efforts that have gone into this addon <3.

I tried to use it to map an input event in my controls menu to remap primary and secondary input bindings. Before I simply had

current_binding_button.text = event.as_text()

which doesn't look as nice as those shiny icons.

So I tried

func update_binding(event: InputEvent) -> void:
	if event is InputEventKey or event is InputEventJoypadButton and event.pressed:
		InputMap.action_erase_event(current_action_to_bind, current_event_to_unbind)
		InputMap.action_add_event(current_action_to_bind, event)

		ControllerIcons.refresh()
		var controller_icon = ControllerIconTexture.new()
		controller_icon.path = current_action_to_bind
		if event is InputEventJoypadButton:
			controller_icon.force_type = ControllerIconTexture.ForceType.CONTROLLER
		elif event is InputEventKey:
			controller_icon.force_type = ControllerIconTexture.ForceType.KEYBOARD_MOUSE
		current_binding_button.icon = controller_icon
		current_binding_button.text = ""

and found out that the addon currently don't support multiple events for one action for the same event type.

Should I use specific paths for the time being? How would I go about the mapping from the InputEvent to the path for the icon? You ought to already have this functionality in your addon.

@3ter
Copy link

3ter commented Feb 2, 2025

I had a closer look at ControllerIcons.gd now. The method I was searching for is _convert_event_to_path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants