Code: Select all
screen event_show:
if img_width > 1280 or img_height > 720:
button keysym 'K_RETURN' action Return()
viewport:
draggable True
add "[image_path]"
else:
button keysym 'K_RETURN' action Return()
add "[image_path]" xalign .5 yalign .5
I do know the reason: in the clean environment the screen above was evoked through a call screen statement, where my actual game NEEDS to evoke it through the show screen statement, because otherwise the textbox down below wouldn't appear. I imagine it's a matter of focus, please correct me if I'm wrong. Oh, and I DID try changing from the Enter key to pretty much everything, nothing works in a "shown" screen.
So I thought of splitting it into two different things, a screen for images up till the native size and a screen to use viewport for bigger images. Then I just could assign a custom key that would call the viewport screen.
Example: let's say the player gets to a simple one image, one text event, where the image is bigger than 1280x720. It would by default be evoked thru show screen. The player could then just press that custom key and done: the viewport screen would be evoked thru call screen.
Problem is I have absolutely no idea how to map a custom key with a custom action usable only when events with oversized images are showing.
https://www.renpy.org/doc/html/keymap.html won't really clarify, at least for me, how I do that.
Finally, I came up with a pretty dumb workaround. I added a button that appears on screen when an event with an oversized image is called. The player can just hit that button and it will call a screen with viewport. It works damn well, but it's not really elegant.
I'm not asking for full code, just if I'm simply missing something obvious or if it's even possible. I hope I've been clear since I'm pretty bad with screens and stuff.
Thanks in advance!