Remove get_zoom and use builtin fit feature
using renpy.render, wtf
This commit is contained in:
parent
ed2a817c84
commit
3278b1f4af
@ -16,6 +16,6 @@ screen gift(gift):
|
||||
zorder 30
|
||||
|
||||
if isinstance(gift, Item):
|
||||
add gift.get_image() align (0.5, 0.4) zoom get_zoom(gift.get_image(), (320, 320))
|
||||
add gift.get_image() align (0.5, 0.4) xysize (320, 320) fit "contain"
|
||||
else:
|
||||
add gift align (0.5, 0.4) zoom get_zoom(gift, (320, 320))
|
||||
add gift align (0.5, 0.4) xysize (320, 320) fit "contain"
|
||||
|
@ -37,13 +37,3 @@ init python:
|
||||
sprite = Image(path)
|
||||
|
||||
return Transform(sprite, crop=(x, y, w, h), xsize=xsize, ysize=ysize, fit="contain", matrixcolor=matrix, subpixel=True)
|
||||
|
||||
def get_zoom(image, size):
|
||||
if isinstance(image, str):
|
||||
image = Image(image)
|
||||
|
||||
r = renpy.render(image, 800, 800, 0, 0)
|
||||
x, y = r.get_size()
|
||||
xsize, ysize = size
|
||||
|
||||
return min(ysize / y, xsize / x)
|
||||
|
Loading…
Reference in New Issue
Block a user