Position of the mouse on the screen

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

I have a game where the window moves around the computer screen, something similar to Desktop Goose, I wish the game window would move towards the mouse position, the problem is I can’t find a way to take the mouse position on the computer screen . Is there any way to do this?

I don’t know if I have explained myself well, I would like to know the position of the mouse relative to that of the screen, even when the mouse is out of the program window

VitusVeit | 2021-12-17 15:41

:bust_in_silhouette: Reply From: aadyainfotainment

Check if this discussion could help you:


The problem is that this solution only works when the mouse is in the window, because if the mouse is out of the window Godot says the mouse position is (0,0). I have an image here to explain myself better.

VitusVeit | 2021-12-20 15:18

Maximize the “that black” screen.
but if the size of the “that black” screen has to be, add another screen like a hidden “that black” screen at the back. transparent. (sory google translate)

ramazan | 2021-12-21 12:50

Yes, I think it should go

VitusVeit | 2021-12-22 22:36