From 255e03dc90fd4d57462cac9e10387dd262799b8f Mon Sep 17 00:00:00 2001 From: nutbuster Date: Thu, 1 Jul 2021 17:17:36 +1000 Subject: [PATCH] Render All Quick Buttons' Text Helper Array Function also added --- game/screens.rpy | 50 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/game/screens.rpy b/game/screens.rpy index 9f32994..f2d79ef 100644 --- a/game/screens.rpy +++ b/game/screens.rpy @@ -240,6 +240,21 @@ style choice_button_text is default: ## The quick menu is displayed in-game to provide easy access to the out-of-game ## menus. +screen quick_button(filename, label, function): + button: + xmaximum 40 + ymaximum 72 + action function + fixed: + add filename xalign 0.5 yalign 0.5 zoom 1 + text label xalign 0.5 yalign 0.5 xanchor 0.5 size 22 color "#000000EE" + +# label_functions is [ [ "label", function() ], [ "foobar", foobar() ], .. ] +# Reuse the same image and keep things 'neat'. +screen quick_buttons(filename, label_functions): + for l_f in label_functions: + use quick_button(filename, l_f[0], l_f[1]) + screen quick_menu(): ## Ensure this appears on top of other screens. @@ -251,14 +266,16 @@ screen quick_menu(): ypos 0.977 grid 1 4: style_prefix "quick" - xalign 0.0 - yalign 0.0 - #imagebutton auto "gui/button/uioptionbuttons/skip_%s.png" action Rollback() - imagebutton auto "gui/button/uioptionbuttons/skip_%s.png" action Skip() alternate Skip(fast=True, confirm=True) - imagebutton auto "gui/button/uioptionbuttons/save_%s.png" action ShowMenu('save') - imagebutton auto "gui/button/uioptionbuttons/auto_%s.png" action Preference("auto-forward", "toggle") - imagebutton auto "gui/button/uioptionbuttons/load_%s.png" action ShowMenu('load') + xalign 0.010 + yalign 0.010 + use quick_buttons("gui/button/uioptionbuttons/template_idle.png", \ + [ \ + [ "Skip", Skip() ], \ + [ "Save", ShowMenu('save') ], \ + [ "Auto", Preference("auto-forward", "toggle") ], \ + [ "Load", ShowMenu('load') ] \ + ] ) screen score_menu(): zorder 100 @@ -275,7 +292,6 @@ screen score_menu(): text "DEBUG SCORE CARD" - ## This code ensures that the quick_menu screen is displayed in-game, whenever ## the player has not explicitly hidden the interface. init python: @@ -297,7 +313,7 @@ style quick_button_text: ## Main and Game Menu Screens ################################################################################ -## Navigation screen ########################################################### +## Navigation screen ########################################################## ## ## This screen is included in the main and game menus, and provides navigation ## to other menus, and to start the game. @@ -1522,7 +1538,10 @@ style pref_vbox: ## Since a mouse may not be present, we replace the quick menu with a version ## that uses fewer and bigger buttons that are easier to touch. + +#redefine function screen quick_button(filename, label, function): + variant "small" button: xmaximum 160 ymaximum 100 @@ -1531,7 +1550,6 @@ screen quick_button(filename, label, function): add filename xalign 0.5 yalign 0.5 zoom 1.75 text label xalign 0.5 yalign 0.5 size 42 color "#000000EE" - screen quick_menu(): variant "small" zorder 100 @@ -1540,10 +1558,14 @@ screen quick_menu(): style_prefix "quick" xalign 0.5 yalign 0.975 - use quick_button("gui/button/uioptionbuttons/template_idle.png", "Back", Rollback()) - use quick_button("gui/button/uioptionbuttons/template_idle.png", "Skip", Skip()) #alternate Skip(fast=True, confirm=True)) - use quick_button("gui/button/uioptionbuttons/template_idle.png", "Auto", Preference("auto-forward", "toggle")) - use quick_button("gui/button/uioptionbuttons/template_idle.png", "Menu", ShowMenu()) + + use quick_buttons("gui/button/uioptionbuttons/template_idle.png", \ + [ \ + [ "Back", Rollback() ], \ + [ "Skip", Skip() ], \ + [ "Auto", Preference("auto-forward", "toggle") ], \ + [ "Menu", ShowMenu() ] \ + ] ) style window: variant "small"