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

Add a mouse mode that disables mouse input entirely #10170

Open
vvvvvvitor opened this issue Jul 11, 2024 · 6 comments
Open

Add a mouse mode that disables mouse input entirely #10170

vvvvvvitor opened this issue Jul 11, 2024 · 6 comments

Comments

@vvvvvvitor
Copy link

vvvvvvitor commented Jul 11, 2024

Describe the project you are working on

UI for a 2D metroidvania game.

Describe the problem or limitation you are having in your project

I'd like to disable mouse input for the UI but the only way to do so is by setting the mouse filter to "Ignore" on every element that can be interacted with the mouse, which can take some time or is outright impossible in some cases without doing a hack.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

A way to globally disable mouse input without setting the mouse_mode to captured or hidden would solve the issue.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

A new mouse_mode could work, something like:

Input.mouse_mode = Input.MOUSE_MODE_DISABLED

If this enhancement will not be used often, can it be worked around with a few lines of script?

As mentioned by @dalexeev, you can cover the viewport with a Control node to stop mouse events.

Is there a reason why this should be core and not an add-on in the asset library?

I don't think this can be done with an addon.

@dalexeev
Copy link
Member

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

You can cover the entire screen with an empty control. This will stop all mouse events.

@Calinou
Copy link
Member

Calinou commented Jul 11, 2024

I don't think we should make it easier to disable mouse input entirely, as it leads to bad accessibility. Menus ought to be accessible with a mouse whenever possible; don't force players to use a keyboard or gamepad to navigate them.

@dalexeev's workaround should already do the trick if you really need this.

@Calinou Calinou changed the title Disable mouse input for the whole project Add a mouse mode that disables mouse input entirely Jul 11, 2024
@vvvvvvitor
Copy link
Author

vvvvvvitor commented Jul 11, 2024

I don't think we should make it easier to disable mouse input entirely, as it leads to bad accessibility. Menus ought to be accessible with a mouse whenever possible; don't force players to use a keyboard or gamepad to navigate them.

I do agree with the accessibility argument, but some games just aren't designed with mouse controls in mind or don't work well with them and adding support for it can mean doing unnecessary work for something that isn't even needed.

There are also other cases where you may want to disable mouse input like in cutscenes.

@dalexeev's workaround should already do the trick if you really need this.

I didn't know about @dalexeev's solution, I'll update the proposal.

@AThousandShips
Copy link
Member

People are free to design their games in what ever way they want, even if they violate standard good practices and accessibility principles, but if the main purpose of this proposed feature is to enable users to do so I don't think it's a good idea

If there are other reasons to add this feature that's another matter IMO, but I don't think we should add a feature specifically for that, i.e. just disabling mouse input instead of disabling all input

@vvvvvvitor
Copy link
Author

vvvvvvitor commented Jul 12, 2024

People are free to design their games in what ever way they want, even if they violate standard good practices and accessibility principles, but if the main purpose of this proposed feature is to enable users to do so I don't think it's a good idea

If there are other reasons to add this feature that's another matter IMO, but I don't think we should add a feature specifically for that, i.e. just disabling mouse input instead of disabling all input

Maybe a better proposal would be to let users disable InputEvents? (Ie.:
Input.disable(InputEventMouse) ) If so, I can close this one and make a new one.

@AThousandShips
Copy link
Member

As long as the proposed use is a different one, but I don't how the way it's implemented changes anything if the same underlying reason is the same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants