Mercurial > skaapsteker
changeset 463:4dda5a0e4cf1
Better background clipping.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sat, 09 Apr 2011 20:56:59 +0200 |
parents | 4507910da5ed |
children | 523106f3004e |
files | skaapsteker/level.py |
diffstat | 1 files changed, 5 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/skaapsteker/level.py Sat Apr 09 20:47:19 2011 +0200 +++ b/skaapsteker/level.py Sat Apr 09 20:56:59 2011 +0200 @@ -77,18 +77,13 @@ self.backgrounds = [] for i, background in enumerate(self.level_data['backgrounds']): image = data.load_image('backgrounds/' + background) + clip_rect = Rect((0, 0), self.pixel_size) if i == 0: - print "background:", background, image.get_rect() - print "pixel_size:", self.pixel_size clip_rect = Rect((0, 0), (int(self.pixel_size[0] * 0.75), int(self.pixel_size[1] * 0.75))) - print "initial:", clip_rect - clip_rect = clip_rect.clip(image.get_rect()) - print "clipped to image:", clip_rect - clip_rect = clip_rect.union(Rect((0, 0), SCREEN)) - print "unioned to screen:", clip_rect - clip_rect.midbottom = image.get_rect().midbottom - print "offset:", clip_rect - image = image.subsurface(clip_rect) + clip_rect = clip_rect.clip(image.get_rect()) + clip_rect = clip_rect.union(Rect((0, 0), SCREEN)) + clip_rect.midbottom = image.get_rect().midbottom + image = image.subsurface(clip_rect) self.backgrounds.append(image) def enter(self):