Image cache preference

* Added image cache size preference
* Increased default image cache size 300MB-> 512MB
* Fixed get_gpu_info function to encode bytes to string before joining
* Fixed missing bar images
This commit is contained in:
LoafyLemon 2023-03-24 19:16:22 +00:00
parent 98ba4d03a2
commit 5a8e4d85ab
4 changed files with 61 additions and 45 deletions

View File

@ -204,6 +204,8 @@ image light_slider_full = "gui/slider/light_full.png"
image scrollbar_horizontal_idle_thumb = "gui/scrollbar/vertical_idle_bar.png" #Solid(gui.accent_color)
image scrollbar_horizontal_hover_thumb = image_hover("gui/scrollbar/vertical_idle_bar.png") #Solid(gui.hover_color)
image scrollbar_horizontal_insensitive_thumb = "scrollbar_horizontal_idle_thumb"
image scrollbar_horizontal_selected_insensitive_thumb = "scrollbar_horizontal_idle_thumb"
image scrollbar_horizontal_selected_idle_thumb = "gui/scrollbar/vertical_idle_bar.png"
image scrollbar_horizontal_selected_hover_thumb = "scrollbar_horizontal_hover_thumb"
image scrollbar_horizontal_idle_bar = Solid(gui.muted_color)
image scrollbar_horizontal_selected_idle_bar = "scrollbar_horizontal_idle_bar"

View File

@ -111,6 +111,7 @@ screen preferences_general():
style_prefix gui.theme("check")
screen preferences_visuals():
vbox:
hbox:
box_wrap True
@ -145,7 +146,7 @@ screen preferences_visuals():
vbox:
style_prefix gui.theme("radio")
label "Renderer"
label _("Renderer")
default renderer_used = renpy.get_renderer_info()["renderer"]
@ -168,6 +169,14 @@ screen preferences_visuals():
#if not renpy.mobile:
#textbutton _("Preserve Aspect Ratio") action [settings.Toggle("preserve_aspect_ratio"), _DisplayReset()]
vbox:
style_prefix gui.theme("slider")
label _("Image cache ([persistent.custom_settings[image_cache_size]]MB)")
hbox:
bar value DictValue(persistent.custom_settings, "image_cache_size", range=1792, max_is_zero=False, style="slider", 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."
text get_gpu_info() yalign 1.0 size 10
screen preferences_sound():

View File

@ -20,6 +20,7 @@ init python:
settings.default("preserve_aspect_ratio", True)
settings.default("animations", True)
settings.default("updates", True)
settings.default("image_cache_size", 512)
renpy.music.register_channel("background", "sfx", True)
renpy.music.register_channel("sound2", "sfx", True)
@ -121,6 +122,10 @@ define config.say_attribute_transition = d3
# Python
define config.open_file_encoding = "utf-8"
define config.image_cache_size_mb = settings.get("image_cache_size")
# Debug
# define config.profile = True
# Garbage Collector
# define config.manage_gc = True

View File

@ -6,7 +6,7 @@ init -999 python early:
def get_gpu_info():
try:
info = "\n".join([glGetString(GL_VENDOR), glGetString(GL_RENDERER), glGetString(GL_VERSION)])
info = "\n".join([glGetString(GL_VENDOR).decode("utf-8"), glGetString(GL_RENDERER).decode("utf-8"), glGetString(GL_VERSION).decode("utf-8")])
except:
info = "ERR: Unknown or incompatible driver."
return info