forked from Cavemanon/SnootGame
Menu Redo: More Horizontal than Vert
This commit is contained in:
@ -36,7 +36,8 @@ init python:
|
|||||||
# (cg: string; ext: string; w: float; h: float
|
# (cg: string; ext: string; w: float; h: float
|
||||||
def cg(fname, ext, w, h):
|
def cg(fname, ext, w, h):
|
||||||
wh = {'x': w, 'y': 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)
|
return im.FactorScale(fname, scale, scale, False)
|
||||||
|
|
||||||
# Reads /images/cgs dir for all image files
|
# Reads /images/cgs dir for all image files
|
||||||
@ -65,18 +66,6 @@ init python:
|
|||||||
}]
|
}]
|
||||||
return
|
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
|
# Call to loading the gallery
|
||||||
loadGallery()
|
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'):
|
screen cg_gallery(flag, __yoffset = 0, origin = 'CG'):
|
||||||
|
|
||||||
style_prefix "game_menu"
|
|
||||||
if main_menu:
|
if main_menu:
|
||||||
key "game_menu" action ShowMenu("main_menu")
|
key "game_menu" action ShowMenu("main_menu")
|
||||||
|
|
||||||
|
|
||||||
|
frame:
|
||||||
|
pass
|
||||||
add gui.main_menu_background
|
add gui.main_menu_background
|
||||||
add gui.game_menu_background
|
add gui.game_menu_background
|
||||||
|
|
||||||
@ -137,59 +128,62 @@ screen cg_gallery(flag, __yoffset = 0, origin = 'CG'):
|
|||||||
gallery_rows = (items / GALLERY_COLS) + 1
|
gallery_rows = (items / GALLERY_COLS) + 1
|
||||||
empty_spaces = GALLERY_COLS - (items % GALLERY_COLS)
|
empty_spaces = GALLERY_COLS - (items % GALLERY_COLS)
|
||||||
|
|
||||||
frame:
|
|
||||||
|
|
||||||
style "game_menu_outer_frame"
|
vbox:
|
||||||
viewport:
|
transform:
|
||||||
yinitial __yoffset
|
zoom 0.95
|
||||||
scrollbars "vertical"
|
hbox:
|
||||||
mousewheel True
|
style_prefix "navigation"
|
||||||
draggable True
|
xalign 0.5
|
||||||
pagekeys True
|
|
||||||
if renpy.variant("small"): #TODO: slightly overspills
|
|
||||||
xpos 490
|
|
||||||
else:
|
|
||||||
xpos 440
|
|
||||||
|
|
||||||
grid GALLERY_COLS gallery_rows:
|
spacing gui.navigation_spacing
|
||||||
for item in gallery_items:
|
|
||||||
# Should properly fix with actual margin difference but good
|
|
||||||
# enough or the actual position
|
|
||||||
python:
|
|
||||||
item_counter += 1
|
|
||||||
yoffset = item_counter / 3 * PREFERRED_HEIGHT * 1.15
|
|
||||||
yoffset = int( yoffset + (PREFERRED_HEIGHT * 1.15))
|
|
||||||
|
|
||||||
use flag_button(item, yoffset, origin)
|
for cp in CG_PATHS:
|
||||||
|
if cp['name'] == origin:
|
||||||
for i in range(0, empty_spaces):
|
textbutton _(cp['name']) text_color gui.selected_color text_xalign 0.5
|
||||||
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:
|
else:
|
||||||
textbutton _(cp['name'])
|
if cp['eval'] is None:
|
||||||
textbutton _("Return") action ShowMenu('main_menu')
|
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:
|
if _in_replay:
|
||||||
textbutton _("End Replay") action EndReplay(confirm=True)
|
textbutton _("End Replay") action EndReplay(confirm=True)
|
||||||
elif not main_menu:
|
elif not main_menu:
|
||||||
textbutton _("Main Menu") action MainMenu()
|
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
|
||||||
|
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
|
||||||
|
python:
|
||||||
|
item_counter += 1
|
||||||
|
yoffset = item_counter / 3 * PREFERRED_HEIGHT * 1.15
|
||||||
|
yoffset = int( yoffset + (PREFERRED_HEIGHT * 1.15))
|
||||||
|
|
||||||
|
use flag_button(item, yoffset, origin)
|
||||||
|
|
||||||
|
for i in range(0, empty_spaces):
|
||||||
|
null height 20
|
||||||
|
|
||||||
label "Gallery"
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if/else flow control & extra parameters for Buttons
|
if/else flow control & extra parameters for Buttons
|
||||||
@ -202,8 +196,11 @@ screen flag_button(item, yoffset, origin):
|
|||||||
button:
|
button:
|
||||||
action ShowMenu('view_image_a', item['fn'], ShowMenu('cg_gallery_0', yoffset, origin), 0.0)
|
action ShowMenu('view_image_a', item['fn'], ShowMenu('cg_gallery_0', yoffset, origin), 0.0)
|
||||||
xcenter 0.5 ycenter 0.5
|
xcenter 0.5 ycenter 0.5
|
||||||
|
padding (1,0,1,2)
|
||||||
vbox:
|
vbox:
|
||||||
text item["item"] xalign 0.5
|
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)
|
add item["cg"] fit 'contain' xcenter 0.5 ycenter 0.5 size (PREFERRED_WIDTH, PREFERRED_HEIGHT)
|
||||||
else:
|
else:
|
||||||
vbox:
|
vbox:
|
||||||
@ -244,7 +241,9 @@ screen view_image(fn, _origin, zoom=0.0, flag='a'):
|
|||||||
draggable True
|
draggable True
|
||||||
arrowkeys True
|
arrowkeys True
|
||||||
pagekeys 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
|
#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
|
#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"
|
style_prefix "quick"
|
||||||
xalign 0.5
|
xalign 0.5
|
||||||
yalign 0.975
|
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_a_f ],
|
||||||
[ "-", zoom_b_f ]
|
[ "-", zoom_b_f ]
|
||||||
|
Reference in New Issue
Block a user