Changeset 127:fe1f0bb4ecf0


Ignore:
Timestamp:
Sep 2, 2013, 3:22:42 PM (7 years ago)
Author:
Neil Muller <drnlmuller@…>
Branch:
default
Message:

Handle case of display larger than the level better

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/screens/area.py

    r107 r127  
    116116        display_size = display_surface.get_size()
    117117        protagnist_pos = self.protagonist.physicser.get_render_position(
    118                 level_surface)
     118            level_surface)
    119119        x_wide = display_size[0] // 2
    120120        y_wide = display_size[1] // 2
    121         if protagnist_pos[0] < x_wide:
     121        if display_size[0] > level_size[0]:
     122            x = -(display_size[0] - level_size[0]) // 2
     123        elif protagnist_pos[0] < x_wide:
    122124            x = 0
    123125        elif protagnist_pos[0] > level_size[0] - x_wide:
     
    125127        else:
    126128            x = protagnist_pos[0] - x_wide
    127         if protagnist_pos[1] < y_wide:
     129        if display_size[1] > level_size[1]:
     130            y = -(display_size[1] - level_size[1]) // 2
     131        elif protagnist_pos[1] < y_wide:
    128132            y = 0
    129133        elif protagnist_pos[1] > level_size[1] - y_wide:
Note: See TracChangeset for help on using the changeset viewer.