diff gamelib/gui.py @ 212:16ce5ed563c9

Change science buttons
author Neil Muller <drnlmuller@gmail.com>
date Sat, 12 May 2012 20:17:28 +0200
parents 0090ecf08544
children 2d72e84a765b
line wrap: on
line diff
--- a/gamelib/gui.py	Sat May 12 20:20:26 2012 +0200
+++ b/gamelib/gui.py	Sat May 12 20:17:28 2012 +0200
@@ -51,10 +51,10 @@
 
 
 class IconTextButton(TextButton):
-    WIDTH = 128
-    HEIGHT = 64
+    WIDTH = 270
+    HEIGHT = 80
 
-    TEXT_OFFSET = (50, 0)
+    TEXT_OFFSET = (0, 60)
 
     def __init__(self, pos, name, text, font=font_auto, shadow=True):
         rect = (pos[0], pos[1], self.WIDTH, self.HEIGHT)
@@ -64,16 +64,20 @@
                      (self.WIDTH - self.TEXT_OFFSET[0],
                       self.HEIGHT - self.TEXT_OFFSET[1]))
         super(IconTextButton, self).__init__(
-            rect, n, d, text, font, shadow, text_rect)
+            rect, n, d, text, font, shadow, text_rect,
+            (255, 255, 255), (128, 128, 128))
 
     def _mk_image(self, name, suffix):
-        bg = data.load_image('images/button_%s.png' % (suffix,))
+        bg = data.load_image('images/research_%s.png' % (suffix,))
         try:
             icon = data.load_image('images/icons/%s_%s.png' % (name, suffix))
         except pygame.error:
             icon = pygame.Surface((64, 64), pygame.SRCALPHA)
-        drawable = ImageDrawable((0, 0, self.WIDTH, self.HEIGHT), bg.copy())
-        drawable.image.blit(icon, (0, 0))
+        base = pygame.Surface((self.WIDTH, self.HEIGHT), pygame.SRCALPHA)
+        base.blit(bg, (self.WIDTH / 2 - 32, 0))
+        drawable = ImageDrawable((0, 0, self.WIDTH, self.HEIGHT), base)
+        # Centre icon
+        drawable.image.blit(icon, (self.WIDTH / 2 - 32, 0))
         return drawable