[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Surfaces just not blitting
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Surfaces just not blitting
- From: Gregory Piñero <gregpinero@xxxxxxxxx>
- Date: Mon, 15 Aug 2005 23:32:43 -0400
- Delivered-to: archiver@seul.org
- Delivered-to: pygame-users-outgoing@seul.org
- Delivered-to: pygame-users@seul.org
- Delivery-date: Mon, 15 Aug 2005 23:32:59 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=A/WuxK1aSWhearh+VAunSGZyWH33iNmlGqrkQCG+BHHm9DpP6MgftFli4Y81QHP7MGQ5vHSEhePf2ttOa352ffCkyEIpOD3rw6sSC9iOUwzDyXhE2m47iD4OeM5gTbNLEy6GTeA8EpeHCSkF+RpoIG6gCaHQvaPcQQ9/enHoUkw=
- In-reply-to: <43015A24.5000304@rpi.edu>
- References: <312cfe2b05081519015b142e0b@mail.gmail.com> <43015A24.5000304@rpi.edu>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
Thanks, I'm finally getting it. Essentially the "sub" blits are
relative to what you're blitting. I didn't realize that. Changing
the self.header.blit(text,self.rect) to
self.header.blit(text,(0,0,0,0)) worked perfectly.
Thanks,
Greg
On 8/15/05, Ethan Glasser-Camp <glasse@xxxxxxx> wrote:
> Gregory Piñero wrote:
> > Hi guys,
> >
> > I'm trying to make a background in pygame. I want to have it contain
> > 3 squares each with a smaller square on it, and then text on the
> > smaller square. Here is the code I wrote, it's short.
> >
> > http://www.blendedtechnologies.com/wp-content/MakeABackGround.zip
> >
> > For some reason only the first square shows up how I want. I've been
> > staring at the code for an hour trying to figure this out, so now I'm
> > hoping one of you experts will have some ideas?
> >
> > Thanks in advance,
> >
> > Greg
>
> The problem isn't in the numerical order that you draw the GameSpaces, but in
> how you draw them. The particular interaction causing the problem is these lines:
>
> GameSpace.__init__:
> self.rect=self.image.get_rect()
> self.rect.top=top
> self.rect.left=left
>
> if pygame.font:
> font = pygame.font.Font(None, 14)
> text = font.render(name, 1, (10, 10, 10))
> self.header.blit(text, self.rect)
> self.image.blit(self.header, self.rect)
>
> When you call this function with top=200, left=200, self.rect resembles
> something along the lines of [200, 200, 100, 100]. When you blit things onto
> self.image or self.header, you chose to blit them starting at 200, 200, which is
> too far off the surface. This means that they won't get blitted.
>
> Ethan
>
>
>
>
--
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)