forked from Cavemanon/SnootGame
Menu Redo: More Horizontal than Vert
This commit is contained in:
parent
be45045956
commit
a905747e2c
@ -36,7 +36,8 @@ init python:
|
||||
# (cg: string; ext: string; w: float; h: float
|
||||
def cg(fname, ext, w, h):
|
||||
wh = {'x': w, 'y': h}
|
||||
scale = box_ratio(wh)
|
||||
scale = PREFERRED_WIDTH * 100.0 / float(wh['x']) / 100.0
|
||||
#scale = box_ratio(wh)
|
||||
return im.FactorScale(fname, scale, scale, False)
|
||||
|
||||
# Reads /images/cgs dir for all image files
|
||||
@ -65,18 +66,6 @@ init python:
|
||||
}]
|
||||
return
|
||||
|
||||
# (xy) -> { x: float; y: float }
|
||||
# Biggest value gets % diff to preferred_ variable
|
||||
def box_ratio(xy):
|
||||
cent = 0
|
||||
if xy['x'] > xy['y']:
|
||||
cent = PREFERRED_WIDTH * 100.0 / float(xy['x'])
|
||||
else:
|
||||
cent = PREFERRED_HEIGHT * 100.0 / float(xy['y'])
|
||||
|
||||
cent /= 100.0
|
||||
return cent
|
||||
|
||||
# Call to loading the gallery
|
||||
loadGallery()
|
||||
|
||||
@ -120,10 +109,12 @@ Basically Gallery Object has terrible defaults, so I just wrote my own stuff
|
||||
"""
|
||||
screen cg_gallery(flag, __yoffset = 0, origin = 'CG'):
|
||||
|
||||
style_prefix "game_menu"
|
||||
if main_menu:
|
||||
key "game_menu" action ShowMenu("main_menu")
|
||||
|
||||
|
||||
frame:
|
||||
pass
|
||||
add gui.main_menu_background
|
||||
add gui.game_menu_background
|
||||
|
||||
@ -137,21 +128,49 @@ screen cg_gallery(flag, __yoffset = 0, origin = 'CG'):
|
||||
gallery_rows = (items / GALLERY_COLS) + 1
|
||||
empty_spaces = GALLERY_COLS - (items % GALLERY_COLS)
|
||||
|
||||
frame:
|
||||
|
||||
style "game_menu_outer_frame"
|
||||
vbox:
|
||||
transform:
|
||||
zoom 0.95
|
||||
hbox:
|
||||
style_prefix "navigation"
|
||||
xalign 0.5
|
||||
|
||||
spacing gui.navigation_spacing
|
||||
|
||||
for cp in CG_PATHS:
|
||||
if cp['name'] == origin:
|
||||
textbutton _(cp['name']) text_color gui.selected_color text_xalign 0.5
|
||||
else:
|
||||
if cp['eval'] is None:
|
||||
textbutton _(cp['name']) action ShowMenu('cg_gallery_'+flag, 0, cp['name']) text_xalign 0.5
|
||||
elif eval(cp['eval']):
|
||||
textbutton _(cp['name']) action ShowMenu('cg_gallery_'+flag, 0, cp['name']) text_xalign 0.5
|
||||
else:
|
||||
textbutton _(cp['name']) text_xalign 0.5
|
||||
textbutton _("Return") action ShowMenu('main_menu') text_xalign 0.5
|
||||
|
||||
if _in_replay:
|
||||
textbutton _("End Replay") action EndReplay(confirm=True)
|
||||
elif not main_menu:
|
||||
textbutton _("Main Menu") action MainMenu()
|
||||
|
||||
transform:
|
||||
zoom 0.95
|
||||
xcenter 0.525
|
||||
ycenter 0.525
|
||||
|
||||
viewport:
|
||||
yinitial __yoffset
|
||||
scrollbars "vertical"
|
||||
mousewheel True
|
||||
draggable True
|
||||
pagekeys True
|
||||
if renpy.variant("small"): #TODO: slightly overspills
|
||||
xpos 490
|
||||
else:
|
||||
xpos 440
|
||||
xfill True
|
||||
|
||||
grid GALLERY_COLS gallery_rows:
|
||||
xcenter 0.5
|
||||
ycenter 0.5
|
||||
for item in gallery_items:
|
||||
# Should properly fix with actual margin difference but good
|
||||
# enough or the actual position
|
||||
@ -165,31 +184,6 @@ screen cg_gallery(flag, __yoffset = 0, origin = 'CG'):
|
||||
for i in range(0, empty_spaces):
|
||||
null height 20
|
||||
|
||||
vbox:
|
||||
style_prefix "navigation"
|
||||
xpos gui.notMM_navigation_xpos
|
||||
yalign 0.5
|
||||
|
||||
spacing gui.navigation_spacing
|
||||
|
||||
for cp in CG_PATHS:
|
||||
if cp['name'] == origin:
|
||||
textbutton _(cp['name']) text_color gui.selected_color
|
||||
else:
|
||||
if cp['eval'] is None:
|
||||
textbutton _(cp['name']) action ShowMenu('cg_gallery_'+flag, 0, cp['name'])
|
||||
elif eval(cp['eval']):
|
||||
textbutton _(cp['name']) action ShowMenu('cg_gallery_'+flag, 0, cp['name'])
|
||||
else:
|
||||
textbutton _(cp['name'])
|
||||
textbutton _("Return") action ShowMenu('main_menu')
|
||||
|
||||
if _in_replay:
|
||||
textbutton _("End Replay") action EndReplay(confirm=True)
|
||||
elif not main_menu:
|
||||
textbutton _("Main Menu") action MainMenu()
|
||||
|
||||
label "Gallery"
|
||||
|
||||
"""
|
||||
if/else flow control & extra parameters for Buttons
|
||||
@ -202,7 +196,10 @@ screen flag_button(item, yoffset, origin):
|
||||
button:
|
||||
action ShowMenu('view_image_a', item['fn'], ShowMenu('cg_gallery_0', yoffset, origin), 0.0)
|
||||
xcenter 0.5 ycenter 0.5
|
||||
padding (1,0,1,2)
|
||||
vbox:
|
||||
transform:
|
||||
#xmaximum (PREFERRED_WIDTH, PREFERRED_HEIGHT)
|
||||
text item["item"] xalign 0.5
|
||||
add item["cg"] fit 'contain' xcenter 0.5 ycenter 0.5 size (PREFERRED_WIDTH, PREFERRED_HEIGHT)
|
||||
else:
|
||||
@ -244,7 +241,9 @@ screen view_image(fn, _origin, zoom=0.0, flag='a'):
|
||||
draggable True
|
||||
arrowkeys True
|
||||
pagekeys True
|
||||
add fn zoom zoom_arr[zoom] anchor (0.5, 0.5)
|
||||
xfill False
|
||||
yfill False
|
||||
add fn zoom zoom_arr[zoom] anchor (0.55, 0.55)
|
||||
|
||||
#Reuse quick buttons, Ren'Py handles touch input lazy, it doesn't have
|
||||
#double finger pinch zoom, it translates taps as mouse events - have to use
|
||||
@ -254,7 +253,7 @@ screen view_image(fn, _origin, zoom=0.0, flag='a'):
|
||||
style_prefix "quick"
|
||||
xalign 0.5
|
||||
yalign 0.975
|
||||
use quick_buttons("gui/button/uioptionbuttons/template_idle.png", \
|
||||
use quick_buttons("gui/button/uioptionbuttons/template_idle.png",
|
||||
[
|
||||
[ "+", zoom_a_f ],
|
||||
[ "-", zoom_b_f ]
|
||||
|
Loading…
Reference in New Issue
Block a user