Mercurial > rinkhals
diff gamelib/imagecache.py @ 186:f06010d34cd3
Add sprite cursors for building placement.
author | Simon Cross <hodgestar@gmail.com> |
---|---|
date | Fri, 04 Sep 2009 17:49:37 +0000 |
parents | 7e556ef40100 |
children | f8e9a8851d7d |
line wrap: on
line diff
--- a/gamelib/imagecache.py Fri Sep 04 17:39:29 2009 +0000 +++ b/gamelib/imagecache.py Fri Sep 04 17:49:37 2009 +0000 @@ -56,7 +56,7 @@ # modifiers -from pygame.locals import BLEND_MULT, BLEND_ADD +from pygame.locals import BLEND_MULT, BLEND_ADD, BLEND_RGBA_MULT NIGHT_COLOUR = (100.0, 100.0, 200.0, 255.0) DARKEN_COLOUR = (100.0, 100.0, 100.0, 255.0) LIGHTEN_COLOUR = (200.0, 200.0, 200.0, 225.0) @@ -92,6 +92,11 @@ lighten.blit(overlay, (over_x, over_y), None, BLEND_ADD) return lighten +def sprite_cursor(image): + cursor = image.copy() + cursor.fill((255, 255, 255, 100), None, BLEND_RGBA_MULT) + return cursor + # globals cache = ImageCache() @@ -99,4 +104,5 @@ cache.register_modifier("right_facing", convert_to_right_facing) cache.register_modifier("darken_center", darken_center) cache.register_modifier("lighten_most", lighten_most) +cache.register_modifier("sprite_cursor", sprite_cursor) load_image = cache.load_image