A picture is worth a thousand words, so ultimately, my question is “how can I achieve this?”:

Intuitively, I thought this might be achievable by defining a surface within the main display object defined by pygame.display.set_mode, drawing (or blitting) whatever is needed onto that surface, and then rotating it with pygame.transform.rotate. The static dots, I assumed, could be drawn directly to the screen object in the code below, which is the object returned by the pygame.display.set_mode function.
I therefore drafted up the following test code, but I don’t see any rotation. What am I doing wrong?
#!/usr/bin/env python
import pygame as pg
from pygame.locals import *
SIZE = (800, 600)
BGCOL = (128, 128, 128)
STIMCOL = (80, 255, 80)
screen = pg.display.set_mode((SIZE), HWSURFACE | DOUBLEBUF)
screen.fill(BGCOL)
surf = pg.Surface((200, 200), flags=HWSURFACE)
surf.fill(BGCOL)
pg.draw.rect(surf, STIMCOL, (10, 20, 40, 50))
pg.draw.rect(surf, STIMCOL, (60, 70, 80, 90))
screen.blit(surf, (100, 100))
pg.display.flip()
running = True
while running:
pg.transform.rotate(surf, -1)
pg.display.flip()
Of course, if there is a better way of doing this, I’m all ears. Perhaps sprite groups are a good way to go? (Although I’ve never used them before … =/)
Thanks!
You have a few errors in code:
pygame.transform.rotate(surface,angle) returns a rotated surface
and you are not blitting the surface in the while loop. So your code should look like this:
EDIT: After looking over comments in the pygame docs, there are many problems with resizing of the image when rotated anything other than 90 degrees. You should keep track of the rotation, and rotate the image from scratch by an increasing angle.