2023-03-23 21:25:38 +00:00
|
|
|
default _tooltip = None
|
|
|
|
|
2022-05-16 23:48:22 +00:00
|
|
|
screen tooltip():
|
|
|
|
layer "interface"
|
|
|
|
tag tooltip
|
|
|
|
zorder 5
|
|
|
|
style_prefix "tooltip"
|
|
|
|
|
2023-07-02 16:03:44 +00:00
|
|
|
if settings.get("tooltip") and getattr(store, "_tooltip", None):
|
2022-05-31 15:03:20 +00:00
|
|
|
window:
|
2023-03-23 21:25:38 +00:00
|
|
|
id "tooltip"
|
2022-05-31 15:03:20 +00:00
|
|
|
at tooltip_follow
|
2024-04-17 20:50:53 +00:00
|
|
|
text "[_tooltip!i]" xoffset 8
|
2022-05-16 23:48:22 +00:00
|
|
|
|
|
|
|
style tooltip_window is empty:
|
2024-04-17 20:50:53 +00:00
|
|
|
background Frame("wheelmenu_frame", 16, 0, 0, 0)
|
|
|
|
padding (16, 8)
|
|
|
|
yanchor 0.5
|
2022-05-16 23:48:22 +00:00
|
|
|
xmaximum 300
|
|
|
|
|
|
|
|
style tooltip_text is default:
|
|
|
|
color "#fff"
|
2024-04-17 20:50:53 +00:00
|
|
|
size 8
|
2022-05-16 23:48:22 +00:00
|
|
|
outlines [(1, "#00000080", 1, 0)]
|
|
|
|
|
2022-05-31 15:03:20 +00:00
|
|
|
transform tooltip_follow:
|
|
|
|
events False
|
|
|
|
function tooltip_func
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2022-05-31 15:03:20 +00:00
|
|
|
init python:
|
2022-05-16 23:48:22 +00:00
|
|
|
|
2022-05-31 15:03:20 +00:00
|
|
|
def tooltip_func(trans, st, at):
|
|
|
|
x, y = renpy.get_mouse_pos()
|
2023-03-23 21:25:38 +00:00
|
|
|
|
|
|
|
if trans.pos is not (x, y):
|
|
|
|
cw, ch = trans.child.window_size
|
|
|
|
|
|
|
|
xanchor = 1.0 if (x + int(cw)) > (config.screen_width) else 0.0
|
2024-04-17 20:50:53 +00:00
|
|
|
yanchor = 0.5 if (y + int(ch)) > (config.screen_height) else 0.0
|
2023-03-23 21:25:38 +00:00
|
|
|
|
2024-04-17 20:50:53 +00:00
|
|
|
# xoffset = 18 if xanchor else 0
|
|
|
|
# yoffset = 24 if yanchor else 0
|
|
|
|
xoffset = 0 if xanchor else 16
|
|
|
|
yoffset = 0 if yanchor else -8
|
2023-03-23 21:25:38 +00:00
|
|
|
trans.pos = (x, y)
|
|
|
|
trans.anchor = (xanchor, yanchor)
|
|
|
|
trans.offset = (xoffset, yoffset)
|
|
|
|
return 0
|
|
|
|
|
|
|
|
if not renpy.android:
|
|
|
|
|
|
|
|
config.always_shown_screens.append("tooltip")
|
|
|
|
config.per_frame_screens.append("tooltip")
|