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

Re: [pygame] simple rectangle drawing




Niki Spahiev writes:

> etoffi@softhome.net wrote:
> 
> > pre-ps: not on the mailing list
> > 
> > hello, everyone!
> > 
> > i am trying to make a simple game that will use either a series of
> > rectangles or circles to make up the display.
> 
> 
> [...]
> 
> 
>  
> 
> try this:
> 
>  
> 	r = pygame.rect.Rect (left, top, w, h)
> 	if obj == None:
> 		self.background.fill ((0,0,0), r)
> 	else:
> 		self.background.fill (obj.color, r)
> 	pygame.display.update ()
>
> 
> HTH,
> Niki Spahiev
> 

just to clarify, we still *do* need the set clip rect before calling fill:

  self.background.set_clip (r)

i was just wrong in setting the alst 2 params, which are (w, h), not
(right, bottom)

anyway, thanks Niki!


--
etoffi <http://oluworld.sourceforge.net/>

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org