I'd like to add some custom tooltips to my imagebutton. The example below works fine, except that I would have to punch in the same x- and ypos for every tooltip. Is it possible to pass the x- and ypos of the imagebutton itself to my 's_tt'-screen automatically?
I don't know how to replace the hard-coded 500, 400. How to I get the position of the imagebutton here? Is that even possible since it is in the imagebutton-definition itself?
Code: Select all
## TOOLTIP SCREEN
screen s_tt(_text="tooltip", _x=0, _y=0):
# TODO: adjust position to be centered always (assuming fixed size buttons 64x64)
fixed:
xpos _x
ypos _y
frame:
# make frame background translucent
background "#000A"
# show tooltip text
text _text
screen s_test_tooltip():
imagebutton auto "gui/imagebutton_%s64.png" xpos config.screen_width/2-32 ypos config.screen_height/2-32 action NullAction() hovered Function(renpy.show_screen,"s_tt", "tooltip text", 500, 400) unhovered Hide("s_tt")
label start:
show screen s_test_tooltip
"This is just some dummy-text to block and prevent an infite loop ..."
"An this is a second dummy-text to clearly show the screen was updated."
jump start