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

Re: [pygame] font/text in pygame



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
-- 
Daniel Bickett
dbickett at gmail.com
http://heureusement.org/