Changeset 181:7e556ef40100


Ignore:
Timestamp:
Sep 4, 2009, 4:48:01 PM (11 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Convert:
svn:b4e93282-eac8-4b8b-b765-0f5d36de2b68@182
Message:

Lighten help screen. Fix some oddities in darken modifier.

Location:
gamelib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • gamelib/helpscreen.py

    r179 r181  
    3939    def paint(self, s):
    4040        pygame.display.set_caption('Instructions')
    41         splash = imagecache.load_image("images/splash.png")
     41        splash = imagecache.load_image("images/splash.png", ["lighten_most"])
    4242        pygame.display.get_surface().blit(splash, (0, 0))
    4343        gui.Container.paint(self, s)
  • gamelib/imagecache.py

    r159 r181  
    5757# modifiers
    5858
    59 from pygame.locals import BLEND_RGBA_MULT, BLEND_MULT
     59from pygame.locals import BLEND_MULT, BLEND_ADD
    6060NIGHT_COLOUR = (100.0, 100.0, 200.0, 255.0)
    6161DARKEN_COLOUR = (100.0, 100.0, 100.0, 255.0)
     62LIGHTEN_COLOUR = (200.0, 200.0, 200.0, 225.0)
    6263
    6364def convert_to_night(image):
    6465    """Convert a day tile to a night tile."""
    6566    night_image = image.copy()
    66     night_image.fill(NIGHT_COLOUR, None, BLEND_RGBA_MULT)
     67    night_image.fill(NIGHT_COLOUR, None, BLEND_MULT)
    6768    return night_image
    6869
     
    7576    darkened = image.copy()
    7677    w, h = darkened.get_size()
    77     w, h = int(w*0.5), int(h*0.5)
    78     x, y = int(w*0.5), int(h*0.5)
    79     overlay = pygame.Surface((w, h))
     78    over_w, over_h = int(w*0.5), int(h*0.5)
     79    over_x, over_y = int(w*0.25), int(h*0.25)
     80    overlay = pygame.Surface((over_w, over_h))
    8081    overlay.fill(DARKEN_COLOUR)
    81     darkened.blit(overlay, (x,y), None, BLEND_MULT)
     82    darkened.blit(overlay, (over_x, over_y), None, BLEND_MULT)
    8283    return darkened
     84
     85def lighten_most(image):
     86    lighten = image.copy()
     87    w, h = lighten.get_size()
     88    over_w, over_h = int(w*0.9), int(h*0.9)
     89    over_x, over_y = int(w*0.05), int(h*0.05)
     90    overlay = pygame.Surface((over_w, over_h))
     91    overlay.fill(LIGHTEN_COLOUR)
     92    lighten.blit(overlay, (over_x, over_y), None, BLEND_ADD)
     93    return lighten
    8394
    8495# globals
     
    8899cache.register_modifier("right_facing", convert_to_right_facing)
    89100cache.register_modifier("darken_center", darken_center)
     101cache.register_modifier("lighten_most", lighten_most)
    90102load_image = cache.load_image
Note: See TracChangeset for help on using the changeset viewer.