I’m rendering an interactive 2d map with pygame.
My idea is to exract the coordinates of each regions from a png and use them to scroll and zoom with the following algorithm:
x - offset[0] * zoom, y - offset[1] * zoom
however, after a few degrees of zoom, a small gap is created between the borders of the various regions. Is there a way to reduce it?
def zoom_point(point, offset, zoom):
x = int((point[0] - offset[0]) * zoom)
y = int((point[1] - offset[1]) * zoom)
return x, y
def zoomed_points(points, offset, zoom):
for point in points:
yield zoom_point(point, offset, zoom)