I have a chunk of code like this within one of my screens:
Code: Select all
grid 3 2: area (62, 120, 900, 700) for c in charDesc.iterkeys(): imagebutton action SetScreenVariable('currSelection', c): idle ("img/portrait.%s.png"%(c)) hover ("img/portrait.%s.png"%(c)) area (50, 25, 200, 300)
After trying that code, I have found out that the size provided by the "area" is not honored at all (the positioning is correct, but with the images displaying at double the intended size, the overlapping is horrible). Even if 'area' fails to zoom the image (rather understandable), I would have expected it to at least clip it to the given size.
I know I could use pre-scaled versions of the files for this; but both the "small" and "full-size" versions of these portraits are used only on this screen; so I'd prefer to re-use the same files and make my files easier to manage.
I googled around for an answer and the closest I got was this http://www.renpy.org/wiki/renpy/doc/ref ... tions/Zoom, which is marked as "Deprecated".
My "evil" side is more than willing to write a python function to get the job done and then call it from within the for loop (passing 'c' as an argument)... but before I walk the dark path,
is there a good renpyish way to zoom images on the fly? (within the definition of an imagebutton)
As you can notice, the interpolation is already ugly enough (the new-style  syntax doesn't seem to work with a local variable ), so I hope I can keep the code as readable as possible.
On a side note: right now, the images don't change at all when hovered, I don't know yet if the final version will include "hovered" variants (it'll depend on available time). Is a zoom operation too costly? If so, it'd be good to know if there is a (sane enough) way to do the zoom in advance, and then use the pre-zoomed image, rather than doing things on the fly on every iteration.