I'm on Renpy version 7.3.5.606. I renamed the folder originally titled demo to game, and the following files are in that folder: cache folder, saves folder, icon8-heart-outline-48.png, mouse_tooltip.rpy, mouse_tooltip.rpyc, script.rpy, script.rpyc.
Maybe I changed something in the code or something, either way, it doesn't seem to work for me. I'll copy and paste the code I have in both files here, starting with script.rpy:
Code: Select all
#this is script.rpy
default mtt = MouseTooltip(Text("No button selected."), padding={"x": 10, "y": -10})
label start:
call screen tooltip_test
return
screen tooltip_test:
add mtt
vbox:
textbutton "One.":
action Return(1)
hovered mtt.Action(Text("The loneliest number."))
textbutton "Two.":
action Return(2)
hovered mtt.Action(Text("Is what it takes."))
textbutton "Three.":
action Return(3)
hovered mtt.Action(Text("A crowd."))
textbutton "Hearts.":
action Return(3)
hovered mtt.Action(Image("icons8-heart-outline-48.png"))
And here is mouse_tooltip.rpy:
Code: Select all
#this is mouse_tooltip.rpy
init -1500 python:
class MouseTooltip(Tooltip, renpy.Displayable):
"""A Tooltip whose x/y position follows the mouse's."""
action = Action
def __init__(self, default, padding=None, *args, **kwargs):
super(renpy.Displayable, self).__init__(*args, **kwargs)
self.default = default
self.value = default
self.padding = padding or {}
self.pad_x = padding.get('x', 0)
self.pad_y = padding.get('y', 0)
self.x = 0
self.y = 0
self._redraw = False
@property
def redraw(self):
return self._redraw
@redraw.setter
def redraw(self, new_value):
self._redraw = new_value
renpy.redraw(self, 0)
def render(self, width, height, st, at):
# Only Text() displayables have a size method
try:
w, h = self.value.size()
except AttributeError:
child_render = renpy.render(self.value, width, height, st, at)
w, h = child_render.get_size()
render = renpy.Render(w, h)
render.place(self.value, x=self.x + self.pad_x, y=self.y + self.pad_y)
return render
def event(self, ev, x, y, st):
self.x = x
self.y = y
if self.redraw:
renpy.redraw(self, 0)
# Pass the event to our child
return self.value.event(ev, x, y, st)
Here is a video of me trying to run the program:
https://youtu.be/22vRYaDpp24
(ignore the error at the end, it's just because there's no confirm screen defined.)
Not entirely sure what's going on, but I'll talk to the original creator to see if there's anything I'm doing wrong.