Code: Select all
define xSize = 400
define ySize = 540
label start:
call screen button_screen
screen button_screen():
default coord = ()
grid 2 1:
spacing 20
align (0.5, 0.5)
button:
background Color("#FF0000")
xysize(xSize, ySize)
hovered Show("preview_screen", name = "Steve", coord = renpy.focus_coordinates())
unhovered Hide("preview_screen")
action [Hide("preview_screen"), Jump("steve")]
button:
background Color("#00FF00")
xysize(xSize, ySize)
hovered Show("preview_screen", name = "Tristan", coord = renpy.focus_coordinates())
unhovered Hide("preview_screen")
action [Hide("preview_screen"), Jump("tristan")]
screen preview_screen(name, coord = ()):
frame:
# renpy.focus_coordinates() should return tuple of (x, y, w, h) of focused displayable
xpos coord[0]
ypos coord[1]
xysize(xSize, ySize)
background Color("#FFFFFF7F")
text name:
color("#0000FF")
align (0.5, 1.0)
label steve:
pause
label tristan:
pause
The docs for renpy.focus_coordinates() indicate that it returns coordinates of a focused object:hovered
An action to run when the button gains focus.
Is my button not actually focused? What am I missing here?This attempts to find the coordinates of the currently-focused displayable. If it can, it will return them as a (x, y, w, h) tuple. If not, it will return a (None, None, None, None) tuple.