2Functions & classes that extend the pygame library
16 def rotateSurface(surface:pygame.Surface, angle:float, pivot:tuple|list|pygame.math.Vector2, offset:pygame.math.Vector2):
18 """ Rotate the surface around the pivot point.
21 surface (pygame.Surface): The surface that is to be rotated.
22 angle (float): Rotate by this angle.
23 pivot (tuple, list, pygame.math.Vector2): The pivot point.
24 offset (pygame.math.Vector2): This vector
is added to the pivot.
27 rotated_image = pygame.transform.rotozoom(surface, -angle, 1)
28 rotated_offset = offset.rotate(angle)
30 rect = rotated_image.get_rect(center=pivot+rotated_offset)
31 return rotated_image, rect