WTS/game/scripts/gui/preferences.rpy
LoafyLemon 7612c0bf1f Save menu
* Implement new save/load menus
2024-06-05 22:25:18 +01:00

365 lines
13 KiB
Plaintext

#
# Preferences screen
#
# The preferences screen allows the player to configure the game to better suit
# themselves.
#
# https://www.renpy.org/doc/html/screen_special.html#preferences
init offset = -1
screen preferences(page="general"):
tag menu
use game_menu(_("Preferences"), scroll="viewport"):
style_prefix gui.theme("pref")
vbox:
spacing gui.pref_spacing
null # Tab margin
if page == "general":
use preferences_general
elif page == "visuals":
use preferences_visuals
elif page == "sound":
use preferences_sound
elif page == "accessibility":
use preferences_accessibility
hbox:
style_prefix gui.theme("tab")
pos (25 + 15, 100)
yanchor 0.5
textbutton "General":
selected (page == "general")
action Show("preferences", config.intra_transition, "general")
textbutton "Visuals":
selected (page == "visuals")
action Show("preferences", config.intra_transition, "visuals")
textbutton "Sound":
selected (page == "sound")
action Show("preferences", config.intra_transition, "sound")
textbutton "Accessibility":
selected (page == "accessibility")
action Show("preferences", config.intra_transition, "accessibility")
screen preferences_general():
frame style "navigation_page_left":
vbox:
label _("General")
vbox:
style_prefix "navigation_checkbox"
textbutton _("Tutorials") action settings.Toggle("tutorials")
if not renpy.mobile:
textbutton _("Tooltips") action settings.Toggle("tooltip") tooltip _("This is a tooltip.")
textbutton _("System Cursor") action Preference("system cursor", "toggle")
textbutton _("Autosaves") action ToggleField(store, "_autosave")
textbutton _("Automatic Update Checks") action settings.Toggle("updates")
textbutton _("Kinetic Text") action settings.Toggle("kinetictext")
text _("Skipping")
textbutton _("Skip Unseen Text") action Preference("skip", "toggle")
textbutton _("Until dialog menu") action InvertSelected(Preference("after choices", "toggle"))
text _("Text Speed")
bar value Preference("text speed") style "navigation_bar"
text _("Auto-Forward Time")
bar value Preference("auto-forward time") style "navigation_bar"
textbutton _("Power-saving") action Preference("gl powersave", "toggle")
textbutton _("multithreading") action settings.Toggle("multithreading") tooltip "Improves performance by executing tasks asynchronously. (Requires restart)"
frame style "navigation_page_right":
pass
screen preferences_visuals():
frame style "navigation_page_left":
vbox:
label _("Display")
if renpy.variant("pc") or renpy.variant("web"):
vbox:
style_prefix "navigation_radio"
textbutton _("Fullscreen") action Preference("display", "fullscreen")
textbutton _("Windowed") action Preference("display", "any window")
textbutton _("Tearing") action [ ToggleField(_preferences, "gl_tearing"), _DisplayReset() ] style "navigation_checkbox_button"
textbutton _("Reset Window size"):
style "navigation_button"
action Preference("display", "window")
sensitive (renpy.get_physical_size() != (config.screen_width, config.screen_height) and not preferences.fullscreen)
default fps_msg = "Framerate preference may take effect after restarting the game"
text _("Framerate")
hbox:
style_prefix "navigation_radio"
textbutton "30 FPS" action [Preference("gl framerate", 30), Notify(fps_msg)]
if renpy.get_refresh_rate() >= 60:
textbutton "60 FPS" action [Preference("gl framerate", 60), Notify(fps_msg)]
textbutton (f"{int(renpy.get_refresh_rate())} FPS") action [Preference("gl framerate", None), Notify(fps_msg)]
if not renpy.variant("web"):
default renderer_used = renpy.get_renderer_info()["renderer"]
text _("Renderer")
hbox:
style_prefix "navigation_radio"
textbutton _("OpenGL"):
selected renderer_used == "gl2"
action Confirm("Changing renderer requires a full restart, do it now?\nUnsaved progress will be lost.", Function(set_renderer, "gl2"))
textbutton _("DirectX"):
sensitive renpy.windows
selected renderer_used == "angle2"
action Confirm("Changing renderer requires a full restart, do it now?\nUnsaved progress will be lost.", Function(set_renderer, "angle2"))
text _("Image cache ([persistent.custom_settings['image_cache_size']]MB)")
bar value DictValue(persistent.custom_settings, "image_cache_size", range=1792, max_is_zero=False, style="navigation_bar", offset=256, step=128, force_step=True, action=Notify(_("Restart the game to apply image cache size changes."))) tooltip _("Improves performance at a cost of higher memory usage.")
null height 35
text get_gpu_info() yalign 1.0 size 12
frame style "navigation_page_right":
pass
screen preferences_sound():
frame style "navigation_page_left":
vbox:
label _("Audio")
text _("Music Volume")
bar value Preference("music volume") style "navigation_bar"
text _("Sound Volume")
bar value Preference("sound volume") style "navigation_bar"
text _("Weather Volume")
bar value Preference("weather volume") style "navigation_bar"
# label _("Voice Volume")
# hbox:
# bar value Preference("voice volume")
# if config.sample_voice:
# textbutton _("Test") action Play("voice", config.sample_voice)
textbutton _("Mute All"):
action Preference("all mute", "toggle")
style "navigation_checkbox_button"
textbutton _("Mute when minimized"):
action Preference("audio when minimized", "toggle")
selected (not _preferences.audio_when_minimized)
style "navigation_checkbox_button"
frame style "navigation_page_right":
pass
screen preferences_accessibility():
frame style "navigation_page_left":
vbox:
label _("Accessibility")
text _("Text Font")
vbox:
style_prefix "navigation_radio"
textbutton _("Default"):
action Preference("font transform", None)
textbutton _("DejaVu Sans"):
action Preference("font transform", "dejavusans")
textbutton _("Opendyslexic"):
action Preference("font transform", "opendyslexic")
text _("Text Scaling")
hbox:
style_prefix "navigation_radio"
textbutton "Small" action Preference("font size", 0.8)
textbutton "Default" action Preference("font size", 1.0)
textbutton "Large" action Preference("font size", 1.2)
text _("Vertical Text Spacing")
hbox:
style_prefix "navigation_radio"
textbutton "Small" action Preference("font line spacing", 0.8)
textbutton "Default" action Preference("font line spacing", 1.0)
textbutton "Large" action Preference("font line spacing", 1.2)
if not renpy.mobile:
vbox:
style_prefix "navigation_checkbox"
textbutton _("Text-to-speech"):
action Preference("self voicing", "toggle")
text _("Text-to-speech Accentuation")
bar value Preference("self voicing volume drop") style "navigation_bar"
text _("Advanced")
vbox:
textbutton "Delete persistent data ({color=#f00}!{/color})" action Confirm(gui.CONFIRM_DELETE_PERSISTENT, Function(delete_persistent))
textbutton "Delete save files ({color=#f00}!{/color})" action Confirm(gui.CONFIRM_DELETE_SAVES, Function(delete_saves))
frame style "navigation_page_right":
pass
define gui.CONFIRM_DELETE_PERSISTENT = """{color=#7a0000}Warning!{/color}
{size=-4}You are about to reset all persistent data, including
achievements, seen text, and preferences.{/size}\n
Are you sure?"""
define gui.CONFIRM_DELETE_SAVES = """{color=#7a0000}Warning!{/color}
{size=-4}You are about to delete all save files, including
auto saves, quick saves, and manual saves.{/size}\n
Are you sure?"""
define gui.SAVE_INCOMPATIBLE_WARNING = """{color=#7a0000}Warning!{/color}
{size=-4}The save file you are attempting to load is not compatible
with the current game version. While you can try loading it,
doing so may result in unexpected crashes and bugs.
Proceed anyway?"""
init python:
def delete_persistent():
renpy.loadsave.location.unlink_persistent()
renpy.persistent.should_save_persistent = False
renpy.quit(relaunch=True)
def delete_saves():
for fn in renpy.list_saved_games(fast=True):
renpy.unlink_save(fn)
def set_renderer(s):
preferences.renderer = s if s in ("gl2", "angle2") else "auto"
renpy.quit(relaunch=True)
# style mute_all_button is check_button
# style mute_all_button_text is check_button_text
# # Preference
# style pref_label is gui_label:
# top_margin gui.pref_spacing
# bottom_margin 2
# style pref_label_text is gui_label_text:
# yalign 1.0
# style dark_pref_label_text is dark_label_text
# style light_pref_label_text is light_label_text
# style pref_button is gui_button:
# padding (18, 4, 4, 4)
# style pref_button_text is gui_button_text
# style pref_vbox is vbox:
# xminimum (245 - 30 - 60) / 2
# style pref_hbox:
# spacing 30
# box_wrap_spacing 2 * gui.pref_spacing
# # Radio button
# style radio_label is pref_label
# style radio_label_text is pref_label_text
# style dark_radio_label_text is dark_pref_label_text
# style light_radio_label_text is light_pref_label_text
# style radio_vbox is pref_vbox:
# spacing gui.pref_button_spacing
# style radio_button is gui_button:
# background None
# padding (18, 4, 4, 4)
# style dark_radio_button is dark_gui_button:
# take radio_button
# foreground "dark_radio_false"
# selected_foreground "dark_radio_true"
# insensitive_foreground "dark_radio_none"
# style light_radio_button is light_gui_button:
# take radio_button
# foreground "light_radio_false"
# selected_foreground "light_radio_true"
# insensitive_foreground "light_radio_none"
# style radio_button_text is gui_button_text:
# first_indent 6
# # Check button
# style check_label is pref_label
# style check_label_text is pref_label_text
# style dark_check_label_text is dark_pref_label_text
# style light_check_label_text is light_pref_label_text
# style check_vbox is pref_vbox:
# spacing gui.pref_button_spacing
# style check_button is gui_button:
# background None
# padding (18, 4, 4, 4)
# style dark_check_button is dark_gui_button:
# take check_button
# foreground "dark_check_false"
# selected_foreground "dark_check_true"
# insensitive_foreground "dark_check_none"
# style light_check_button is light_gui_button:
# take check_button
# foreground "light_check_false"
# selected_foreground "light_check_true"
# insensitive_foreground "light_check_none"
# style check_button_text is gui_button_text:
# first_indent 6
# # Slider
# style slider_label is pref_label
# style slider_label_text is pref_label_text
# style dark_slider_label_text is dark_pref_label_text
# style light_slider_label_text is light_pref_label_text
# style slider_slider is gui_slider:
# xsize 320
# style dark_slider_slider is dark_slider
# style light_slider_slider is light_slider
# style slider_button is gui_button:
# background None
# yalign 0.5
# left_margin 9
# style slider_button_text is gui_button_text
# style slider_vbox is pref_vbox:
# xsize 320
screen _self_voicing():
zorder 1500
if _preferences.self_voicing == "clipboard":
$ message = _("Clipboard voicing enabled. Press 'shift+C' to disable.")
elif _preferences.self_voicing == "debug":
$ message = _("Text-to-speech would say \"[renpy.display.tts.last]\". Press 'alt+shift+V' to disable.")
else:
$ message = _("Text-to-speech enabled. Press 'shift+v' to disable.")
text message:
alt ""
xpos 10
ypos 35
color "#fff"
outlines [ (1, "#0008", 0, 0)]