Finally got this vaguely working using an ATL function and a mid move display swap...
Got work in 6hrs or so so will leave it with you to tinker around with:
Code: Select all
### Tweak 'warper', 'duration' (note 'last_st' should be bigger and negative), 'ypos' as wanted
default panel_info = {
'showing' : None,
'pending' : None,
'last_st' : -5.0,
'warper' : {'in':'easein_bounce', 'out':'easeout_back'},
'duration' : 3.0,
'ypos' : [600, 150]
}
init python:
def panel_slider(trans, st, at):
global panel_info
if not panel_info['last_st']:
panel_info['last_st'] = st
# default closed
ypos = panel_info['ypos'][0]
if panel_info['last_st'] + panel_info['duration'] >= st:
# we should be moving
if not panel_info['showing']:
panel_info['showing'] = panel_info['pending']
#### Here we want to force redraw/refresh the info_panel screen
renpy.restart_interaction()
yrange = panel_info['ypos'][1] - panel_info['ypos'][0]
portion = float(st - panel_info['last_st']) / panel_info['duration']
if panel_info['pending'] == panel_info['showing']:
# showing
warp_portion = renpy.atl.warpers[ panel_info['warper']['in'] ]( portion )
ypos += yrange * warp_portion
else:
# hiding
warp_portion = renpy.atl.warpers[ panel_info['warper']['out'] ]( portion )
ypos = panel_info['ypos'][1] - yrange * warp_portion
else:
# we are either open or closed
if not panel_info['pending'] and not panel_info['showing']:
# closed with no pending action
pass
elif panel_info['pending'] != panel_info['showing']:
# fully closed
panel_info['showing'] = panel_info['pending']
if panel_info['showing']:
# swapped to new
panel_info['last_st'] = st
#### Here we want to force redraw/refresh the info_panel screen etc
renpy.restart_interaction()
else:
# fully open
ypos = panel_info['ypos'][1]
panel_info['cur_ypos'] = int(ypos)
panel_info['cur_st'] = st
trans.ypos = int(ypos)
return 0.04
transform panel_slide:
function panel_slider
screen panel_control():
default panels = [ 'info', 'trade' ]
fixed:
# x,y,w,h
area (0.635, 0.1, 0.365, 0.6)
vbox:
for panel in panels:
textbutton "{0}".format("Close" if panel_info['showing'] == panel else panel.capitalize()):
action [
SetDict(panel_info, 'last_st', None),
SetDict(panel_info, 'pending', None if panel_info['showing'] == panel else panel)
]
screen info_panel():
fixed at panel_slide:
area (400,600, 200, 450)
if panel_info['showing'] == 'info':
# use infoscreen
add Color('#770')
text "Info"
elif panel_info['showing'] == 'trade':
# use tradescreen
add Color('#077')
text "Trade"
else:
add Color('#777')
text "Hidden"
screen debug():
vbox:
text "\n\nDEBUG"
for k in panel_info:
$ v = str(panel_info[k]).replace('[','[[').replace('{','{{')
text "[k] = [v]"
init python:
config.overlay_screens.append('panel_control')
config.overlay_screens.append('info_panel')
config.overlay_screens.append('debug')
config.per_frame_screens.append('debug')
# config.per_frame_screens.append('panel_control')
# config.per_frame_screens.append('info_panel')
label start:
"Start"
"End"
return
If you want a Close All type button, use: action [ SetDict(panel_info, 'last_st', None), SetDict(panel_info, 'pending', None) ]
I left the debug panel/screen bit in just for extra info...
Realistically it might be best to tweak the 'return 0.04' so it runs fast while moving then slows while inactive...
Note: I used pixel positions... If you alter panel_info['ypos'] to use floats, also amend the " trans.ypos = int(ypos) " at the end. It should still work with floats.
Should be online late tomorrow if needed