[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Making a clock rotate



dialtone wrote:
I got it rotating, thx for your help Pete. But I have a problem more... I cannot manage to keep the rotation point in the center of the surface. My code now is this: (The problem is that the pointer progressively goes away of the surface till it goes completely out. Can you help me to correct the newrect() function which I suspect is the main responsible for this bad behave? Thx a lot)
using the Rect objects it is very easy to do a 'centered' blit. you create a rect object, use one of its handy assignment attributes, and then blit with that position. no need for special math os subsurfaces


def blit_centered(src, dst):
r = src.get_rect()
r.center = dst.get_rect().center
return dst.blit(src, r)

you can use this function to blit any source image to any destination image and have the two centers shared.


--
"Neither will I tell you by what authority I do these things"
pete*shinners.org