forked from Cavemanon/SnootGame
Rehaul Gallery Menu
This commit is contained in:
parent
dc4b133c79
commit
a5c223cb1b
|
@ -69,44 +69,74 @@ init python:
|
||||||
CG Gallery screen - A screen that shows the image gallery
|
CG Gallery screen - A screen that shows the image gallery
|
||||||
Basically Gallery Object has terrible defaults, so I just wrote my own stuff
|
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:
|
python:
|
||||||
items = len(galleryItems)
|
items = len(galleryItems)
|
||||||
galleryRows = (items / GALLERY_COLS) + 1
|
galleryRows = (items / GALLERY_COLS) + 1
|
||||||
extraSpaces = GALLERY_COLS - (items % GALLERY_COLS)
|
extraSpaces = GALLERY_COLS - (items % GALLERY_COLS)
|
||||||
|
item_counter = 0
|
||||||
|
|
||||||
tag menu
|
tag menu
|
||||||
use game_menu(_("Gallery"), scroll="viewport"):
|
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:
|
grid GALLERY_COLS galleryRows:
|
||||||
spacing 8
|
|
||||||
for item in galleryItems:
|
for item in galleryItems:
|
||||||
use flag_button(item)
|
$ 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):
|
for i in range(0, extraSpaces):
|
||||||
null height 20
|
null height 20
|
||||||
|
|
||||||
|
label "Gallery"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if/else for buttons
|
if/else for buttons
|
||||||
"""
|
"""
|
||||||
screen flag_button(item):
|
screen flag_button(item, yoffset):
|
||||||
python:
|
python:
|
||||||
flag = renpy.seen_image(item['item'])
|
flag = renpy.seen_image(item['item'])
|
||||||
if flag:
|
if flag:
|
||||||
button:
|
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
|
xcenter 0.5 ycenter 0.5
|
||||||
|
|
||||||
vbox:
|
vbox:
|
||||||
text item["item"] xalign 0.5
|
text item["item"] xalign 0.5
|
||||||
add item["cg"] fit 'contain' xcenter 0.5 ycenter 0.5 size (PREFERRED_WIDTH, PREFERRED_HEIGHT)
|
add item["cg"] fit 'contain' xcenter 0.5 ycenter 0.5 size (PREFERRED_WIDTH, PREFERRED_HEIGHT)
|
||||||
#action view_image(item["item"])
|
|
||||||
else:
|
else:
|
||||||
vbox:
|
vbox:
|
||||||
|
ymaximum PREFERRED_HEIGHT
|
||||||
xcenter 0.5 ycenter 0.5
|
xcenter 0.5 ycenter 0.5
|
||||||
text "? ? ?" xalign 0.5
|
text "? ? ?" xalign 0.5
|
||||||
add NOT_UNLOCKED_COVER
|
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):
|
screen view_image(fn, origin):
|
||||||
tag menu
|
tag menu
|
||||||
|
|
Loading…
Reference in New Issue