Created
January 14, 2024 21:43
-
-
Save Phxntxm/1c83d8a37ae7fe1c65912c51d0ac940b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
init python: | |
class HoverTooltips: | |
hovers = { | |
"camping": { | |
"activated": False, | |
"tooltip": "Tooltip for this scene", | |
}, | |
"tournament": { | |
"activated": False, | |
"tooltip": "Tooltip for this scene", | |
}, | |
} | |
@property | |
def tooltip(self): | |
for _hover in self.hovers.values(): | |
if _hover["activated"]: | |
return _hover["tooltip"] | |
def toggle(self, name: str): | |
for _hover, data in self.hovers.items(): | |
if _hover == name: | |
data["activated"] = True | |
else: | |
data["activated"] = False | |
hovers = HoverTooltips() | |
screen scenes: | |
if hovers.tooltip: | |
text "[hovers.tooltip]" | |
vpgrid: | |
cols 4 | |
rows 3 | |
xalign 0.5 | |
ypos 150 | |
spacing 70 | |
if renpy.variant("touch"): | |
imagebutton: | |
idle "tent_idle.png" | |
selected_idle "tent_hover.png" | |
selected hovers.hovers["camping"]["activated"] | |
action If(hovers.hovers["camping"]["activated"], Replay("camping", locked=False), Function(hovers.toggle, "camping")) | |
imagebutton: | |
idle "binoculars_idle.png" | |
selected_idle "binoculars_hover.png" | |
selected hovers.hovers["tournament"]["activated"] | |
action If(hovers.hovers["tournament"]["activated"], Replay("tournament", locked=False), Function(hovers.toggle, "tournament")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment