Wheelmenu + Tooltip + Cheats

* Added wheelmenu buttons (WIP)
* Moved cheats menu inside the wheelmenu
* Added animations
* Added new tooltip styling
This commit is contained in:
LoafyLemon 2024-04-17 21:50:53 +01:00
parent f267528d4f
commit ca583cfd19
7 changed files with 42 additions and 12 deletions

BIN
game/images/interface/wheelmenu/wheelmenu_button_opaque.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
game/images/interface/wheelmenu/wheelmenu_frame.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
game/images/interface/wheelmenu/wheelmenu_genie.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
game/images/interface/wheelmenu/wheelmenu_gradient.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -10,16 +10,17 @@ screen tooltip():
window:
id "tooltip"
at tooltip_follow
text "[_tooltip!i]"
text "[_tooltip!i]" xoffset 8
style tooltip_window is empty:
background "#00000080"
padding (18, 12)
background Frame("wheelmenu_frame", 16, 0, 0, 0)
padding (16, 8)
yanchor 0.5
xmaximum 300
style tooltip_text is default:
color "#fff"
size 10
size 8
outlines [(1, "#00000080", 1, 0)]
transform tooltip_follow:
@ -35,14 +36,15 @@ init python:
cw, ch = trans.child.window_size
xanchor = 1.0 if (x + int(cw)) > (config.screen_width) else 0.0
yanchor = 1.0 if (y + int(ch)) > (config.screen_height) else 0.0
yanchor = 0.5 if (y + int(ch)) > (config.screen_height) else 0.0
xoffset = 18 if xanchor else 0
yoffset = 24 if yanchor else 0
# xoffset = 18 if xanchor else 0
# yoffset = 24 if yanchor else 0
xoffset = 0 if xanchor else 16
yoffset = 0 if yanchor else -8
trans.pos = (x, y)
trans.anchor = (xanchor, yanchor)
trans.offset = (xoffset, yoffset)
return 0
if not renpy.android:

View File

@ -47,6 +47,8 @@ init python:
return tuple(zip(buttons, positions)) # Nonhashable types cannot be used in a screen, so we use a tuple instead.
config.per_frame_screens.append("wheelmenu")
label wheelmenu(btns, ret, pos=None):
call screen wheelmenu(btns, pos)
@ -58,9 +60,10 @@ screen wheelmenu(btns, pos):
zorder 4
style_prefix "wheelmenu"
default start_pos = pos or renpy.get_mouse_pos()
$ mpos = renpy.get_mouse_pos()
default start_pos = pos or mpos
use close_button_background
use close_button_background(keysym="game_menu")
window at wheelmenu_anim:
id "wheelmenu"
@ -69,15 +72,20 @@ screen wheelmenu(btns, pos):
for btn, pos in btns:
add btn pos pos
# TODO: Add genie's eyes/face following mouse.
add "wheelmenu_genie" align (0.5, 0.5) at transform:
subpixel True
xysize (48, 48)
yzoom (-1 if mpos[0] > start_pos[0] else 1)
rotate (math.degrees(math.atan2(mpos[1] - start_pos[1], mpos[0] - start_pos[0])) + 360) % 360 - 180
style wheelmenu_window is empty:
background Transform("wheelmenu_gradient", align=(0.5, 0.5), xysize=(200, 200))
maximum (400, 400)
anchor (0.5, 0.5)
style wheelmenu_button is empty:
background Transform("wheelmenu_button", xysize=(48,48))
hover_background At(Transform("wheelmenu_button", xysize=(48,48)), pulse_hover)
hover_background At(Transform("wheelmenu_button_opaque", xysize=(48,48)), wheelmenu_hover_anim)
xysize (48, 48)
anchor (0.5, 0.5)
@ -101,6 +109,13 @@ transform wheelmenu_anim:
on hide:
easeout 0.15 zoom 0.0
transform wheelmenu_hover_anim(t=2.0, strength=0.2, pause=0.0):
matrixcolor BrightnessMatrix(value=0.0)
linear t/2 matrixcolor BrightnessMatrix(value=strength)
linear t/2 matrixcolor BrightnessMatrix(value=0.0)
pause pause
repeat
# transform tooltip_follow:
# events False
# function tooltip_func

View File

@ -30,6 +30,7 @@ default desk_OBJ = RoomObject(
"Do Paperwork": (Text("📝", align=(0.5, 0.5)), Jump("paperwork"), "True"),
"Open Inventory": (Text("🎒", align=(0.5, 0.5)), Jump("inventory"), "True"),
"Open Deck Builder": (Text("🃏", align=(0.5, 0.5)), Jump("deck_builder"), "states.cardgame.unlocked"),
"Open Cheats Menu": (Text("🕹️", align=(0.5, 0.5)), Jump("cheats"), "game.cheats"),
},
hovered=Show(
"gui_tooltip",