[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] [Pygame] Joystick Inputs



On Wed, Dec 7, 2011 at 7:51 PM, Andrew Godfroy <killerrin@xxxxxxxxxxx> wrote:
Alright, so If I’m getting you right, I should be using Rotozoom instead of just rotate, and build in a check to see if the previous angle is the same as the last one?
No.  Think about what's happening.  Try unrolling a couple calls:
self.image = pygame.transform.rotate(self.image, #something)
self.image = pygame.transform.rotate(self.image, #something)
self.image = pygame.transform.rotate(self.image, #something)
self.image = pygame.transform.rotate(self.image, #something)
. . . is equivalent to:
self.image = pygame.transform.rotate(pygame.transform.rotate(pygame.transform.rotate(pygame.transform.rotate(self.image, #something), #something), #something), #something)
Now do you see the problem?  Each image will be larger than the last.  Plus, you're doing a transformation repeatedly, which hurts image quality.

The attached image demonstrates what's happening.  You're starting with an image, then rotating, and then rotating THAT, and so on.  The image gets bigger and bigger.  I've drawn the padding as white and black, but they probably wouldn't necessarily be those colors.

Ian

Attachment: rotation.png
Description: PNG image