0 votes

how to script " if mouse not inside screen"?

in Engine by (395 points)

2 Answers

+1 vote

MainLoop provides these constants:

  • NOTIFICATIONWMMOUSE_ENTER
  • NOTIFICATIONWMMOUSE_EXIT

You can access them from the SceneTree with get_tree().

by (32 points)
+1 vote

Here's a specific example you can put in your script:

func _notification(what):
    match what:
        MainLoop.NOTIFICATION_WM_MOUSE_EXIT:
            print("Mouse has left game window")
        MainLoop.NOTIFICATION_WM_MOUSE_ENTER:
            print("Mouse has entered the game window")
by (173 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.