Open
Description
Hello,
Last year, I experienced OpenGL and repeated textures, and I thought it would be interesting to have a similar feature in pygame. The way we do it right now with current means isn't that good (not optimized). So after discussions, the best would be to add a boolean kwarg to pygame.Surface.scroll
named repeat
. When it's set to True
, it shifts surface pixels by an offset and all out of range pixels come back in the other side. As you can see below at the left (In a future, it would be interesting to implement the mirror repeated case):
Finally, we shall be able to use pygame.Vector2
or tuple
/ list
as arguments, rather than only 2 arguments dx
and dy
for offset.
This is an example summarizing everything I said:
foo = pygame.image.load("foo.png")
offset = pygame.Vector2(10, 20)
foo.scroll(offset, repeat=True) # repeated
foo.scroll(offset) # not repeated
Activity