can fill sub-rect of a surface with tile

This commit is contained in:
Frank DeMarco 2019-11-16 00:42:42 -05:00
parent ebe0bad311
commit 4f25a971d7
1 changed files with 5 additions and 3 deletions

View File

@ -214,9 +214,11 @@ def get_inverted_surface(base):
del pixels
return surface
def fill_tile(surface, tile):
for x in range(0, surface.get_width(), tile.get_width()):
for y in range(0, surface.get_height(), tile.get_height()):
def fill_tile(surface, tile, rect=None):
w, h = tile.get_size()
surface.set_clip(rect)
for x in range(0, surface.get_width(), w):
for y in range(0, surface.get_height(), h):
surface.blit(tile, (x, y))
def get_shadowed_text(text, font, offset, color, antialias=True, shadow_color=(0, 0, 0),