[Solved] How to know if a screen or vpgrid has focus or mouse focus?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
henvu50
Veteran
Posts: 337
Joined: Wed Aug 22, 2018 1:22 am
Contact:

[Solved] How to know if a screen or vpgrid has focus or mouse focus?

#1 Post by henvu50 »

How to know if a screen or vpgrid has focus or mouse focus?

Here is how I did it. If anyone know a better way please let me know.

Code: Select all

# How to know if mouse is over a screen?
screen50():
     mousearea:
          # set area to be size and position of vpgrid
          area (500, 500, 500, 500)
             hovered SetVariable("hoveredorNot", "true")
             unhovered SetVariable("hoveredorNot", "false")
     vpgrid:
          area (500, 500, 500, 500)
          
# output variable hoveredorNot in a text field in another screen, so you can instantly see if it's hovered or not

Post Reply

Who is online

Users browsing this forum: No registered users