[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] font/text in pygame
On 4/27/05, Daniel Bickett <dbickett@xxxxxxxxx> wrote:
> I wrote the following function recently. It places the image perfectly
> in the center of the screen, using the rect of the image and the
> screen.
>
> def centerImgOnScreen( image_rect , screen_rect ):
> x = ( screen_rect.right / 2 ) - ( image_rect.right / 2 )
> y = ( screen_rect.bottom / 2 ) - ( image_rect.bottom / 2 )
> return x,y
Let the library do the work for you. ;)
image_rect.center = screen_rect.center
--
Sami Hangaslammi