changeset 398:1555677d86f6

Dim non-interactive screen regions for "modal" stuff.
author Jeremy Thurgood <firxen@gmail.com>
date Sat, 28 Aug 2010 21:05:36 +0200
parents b1dc0caec668
children 1cfcd82519b6
files gamelib/gamescreen.py gamelib/widgets.py
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gamelib/gamescreen.py	Sat Aug 28 20:46:06 2010 +0200
+++ b/gamelib/gamescreen.py	Sat Aug 28 21:05:36 2010 +0200
@@ -140,6 +140,10 @@
         self.close.rect.midbottom = rect.midbottom
 
     def draw(self, surface):
+        scene_surface = self.get_root().surface.subsurface(self.parent.rect)
+        overlay = scene_surface.convert_alpha()
+        overlay.fill(Color(0, 0, 0, 191))
+        scene_surface.blit(overlay, (0, 0))
         self.state.draw_detail(surface.subsurface(self.image_rect), self.screen)
 
     def mouse_down(self, event):
--- a/gamelib/widgets.py	Sat Aug 28 20:46:06 2010 +0200
+++ b/gamelib/widgets.py	Sat Aug 28 21:05:36 2010 +0200
@@ -104,11 +104,15 @@
         if style == "JIM":
             self.set(font=get_font(20, "Monospace.ttf"))
             self.trim_line_top = 10
-            self.bg_color = Color(255, 175, 127, 207)
+            self.bg_color = Color(255, 175, 127, 191)
             self.fg_color = (0, 0, 0)
             self.border_color = (127, 15, 0)
 
     def draw_all(self, surface):
+        root_surface = self.get_root().surface
+        overlay = root_surface.convert_alpha()
+        overlay.fill(Color(0, 0, 0, 191))
+        root_surface.blit(overlay, (0, 0))
         BoomLabel.draw_all(self, surface)
 
     def _draw_all_no_bg(self, surface):