Best way to change mouse DPI in 2D game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Loafman

I am working on a 2D game, and I would like the ability to change the mouse sensitivity in game. From what I’ve seen, Godot gets the mouse input straight from the OS, so there is no way to change sensitivity without changing it in your OS.
One solution to this problem seems to be, to simulate my own mouse using MOUSE_MODE_CAPTURED = 2 and InputEventMouseMotion, similarly to how this person is recommended for a 3D FPS. The only problem with this method is I think it would introduce a one _Physics_Process tick delay in mouse movement, which is not bad, but not ideal.
The only other thing I can think of is to go into the games source code and edit the engine. I am not familiar with any of that, and don’t know if it is possible to introduce mouse sensitivity changes in the engine with less delay than simulating my own mouse.
So my question is, should I just simulate my own mouse, or is going into the engine worth it, or is there another method I don’t know of?

Thank you for your time.

:bust_in_silhouette: Reply From: Calinou

The only problem with this method is I think it would introduce a one PhysicsProcess tick delay in mouse movement, which is not bad, but not ideal.

This is not related to using a captured mouse mode.

If you want to avoid a delay when displaying the cursor, switch to the hidden mouse mode (instead of captured) and set a custom “hardware” mouse cursor instead of moving a sprite every frame to represent the mouse (which is called a “software” mouse cursor). You can use the following method to set a hardware cursor:

Input.set_custom_mouse_cursor(preload("res://my_cursor.png"))

Make sure to use images smaller that are 256×256 or smaller. Otherwise, compatibility issues may occur depending on the OS.

mmk, maybe I’m a bit confused as to the use of that method. Does it do more than replace the mouse cursor image? How would I tie that in with making the mouse sensitivity changeable in game?

Loafman | 2020-12-04 22:23