Changeset 219:f9e92d540bfa


Ignore:
Timestamp:
Sep 4, 2013, 2:21:21 PM (7 years ago)
Author:
Jeremy Thurgood <firxen@…>
Branch:
default
Message:

Less hacky rotation suppression.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/render.py

    r218 r219  
    4444
    4545class ImageRenderer(Renderer):
     46    rotate = True  # Set to `False` to suppress image rotation.
     47
    4648    def __init__(self, image):
    4749        self._image = image
     
    5153
    5254    def rotate_image(self, image):
     55        if not self._rotate:
     56            return image
    5357        angle = self.game_object.get_render_angle() * 180 / math.pi
    5458        return pygame.transform.rotate(image, angle)
     
    132136    def __init__(self, renderers):
    133137        for renderer in renderers.values():
    134             # TODO: Unhack this somehow.
    135             renderer.rotate_image = self.rotate_image
     138            renderer.rotate = False
    136139        super(FacingSelectionRenderer, self).__init__(renderers)
    137140        self._face = 'left'
     
    142145        elif abs(angle) > math.pi / 2:
    143146            self._face = 'left'
    144 
    145     def rotate_image(self, image):
    146         # Facing images don't get rotated.
    147         return image
    148147
    149148    def select_renderer(self):
Note: See TracChangeset for help on using the changeset viewer.