Changeset 463:4dda5a0e4cf1


Ignore:
Timestamp:
04/09/11 18:56:59 (12 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Phase:
public
Message:

Better background clipping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/level.py

    r453 r463  
    7878        for i, background in enumerate(self.level_data['backgrounds']):
    7979            image = data.load_image('backgrounds/' + background)
     80            clip_rect = Rect((0, 0), self.pixel_size)
    8081            if i == 0:
    81                 print "background:", background, image.get_rect()
    82                 print "pixel_size:", self.pixel_size
    8382                clip_rect = Rect((0, 0), (int(self.pixel_size[0] * 0.75), int(self.pixel_size[1] * 0.75)))
    84                 print "initial:", clip_rect
    85                 clip_rect = clip_rect.clip(image.get_rect())
    86                 print "clipped to image:", clip_rect
    87                 clip_rect = clip_rect.union(Rect((0, 0), SCREEN))
    88                 print "unioned to screen:", clip_rect
    89                 clip_rect.midbottom = image.get_rect().midbottom
    90                 print "offset:", clip_rect
    91                 image = image.subsurface(clip_rect)
     83            clip_rect = clip_rect.clip(image.get_rect())
     84            clip_rect = clip_rect.union(Rect((0, 0), SCREEN))
     85            clip_rect.midbottom = image.get_rect().midbottom
     86            image = image.subsurface(clip_rect)
    9287            self.backgrounds.append(image)
    9388
Note: See TracChangeset for help on using the changeset viewer.