Rehaul Gallery Menu

This commit is contained in:
Nutbuster 2021-07-17 14:21:24 +10:00
parent dc4b133c79
commit a5c223cb1b
1 changed files with 44 additions and 14 deletions

View File

@ -69,44 +69,74 @@ init python:
CG Gallery screen - A screen that shows the image gallery
Basically Gallery Object has terrible defaults, so I just wrote my own stuff
"""
screen cg_gallery():
screen cg_gallery(__yoffset = 0):
style_prefix "game_menu"
if main_menu:
add gui.game_menu_background
#add gui.main_menu_background
else:
add gui.game_menu_background
python:
items = len(galleryItems)
galleryRows = (items / GALLERY_COLS) + 1
extraSpaces = GALLERY_COLS - (items % GALLERY_COLS)
tag menu
use game_menu(_("Gallery"), scroll="viewport"):
grid GALLERY_COLS galleryRows:
spacing 8
for item in galleryItems:
use flag_button(item)
item_counter = 0
tag menu
frame:
style "game_menu_outer_frame"
if main_menu:
key "game_menu" action ShowMenu("main_menu")
viewport:
yinitial __yoffset
xalign 0.5
scrollbars "vertical"
mousewheel True
draggable True
pagekeys True
add Color("#000")
grid GALLERY_COLS galleryRows:
for item in galleryItems:
$ item_counter += 1
$ yoffset = item_counter / 3 * PREFERRED_HEIGHT * 1.15
$ yoffset = int( yoffset + (PREFERRED_HEIGHT * 1.15))
# should properly fix with actual margin difference but good enough or the actual position
use flag_button(item, yoffset)
for i in range(0, extraSpaces):
null height 20
label "Gallery"
for i in range(0, extraSpaces):
null height 20
"""
if/else for buttons
"""
screen flag_button(item):
screen flag_button(item, yoffset):
python:
flag = renpy.seen_image(item['item'])
if flag:
button:
action ShowMenu('view_image', item['fn'], ShowMenu('cg_gallery'))
action ShowMenu('view_image', item['fn'], ShowMenu('cg_gallery', yoffset))
xcenter 0.5 ycenter 0.5
vbox:
text item["item"] xalign 0.5
add item["cg"] fit 'contain' xcenter 0.5 ycenter 0.5 size (PREFERRED_WIDTH, PREFERRED_HEIGHT)
#action view_image(item["item"])
else:
vbox:
ymaximum PREFERRED_HEIGHT
xcenter 0.5 ycenter 0.5
text "? ? ?" xalign 0.5
add NOT_UNLOCKED_COVER
"""
view_image, loads the image in fullscreen with viewport controls
view_image, loads the image in fullscreen with viewport control
"""
screen view_image(fn, origin):
tag menu