diff gamelib/menu.py @ 450:ece69836f00a

Image buttons for game over screen
author Neil Muller <neil@dip.sun.ac.za>
date Sun, 29 Aug 2010 00:50:25 +0200
parents a6de33fecb97
children 0ce08d5e2acb
line wrap: on
line diff
--- a/gamelib/menu.py	Sun Aug 29 00:31:03 2010 +0200
+++ b/gamelib/menu.py	Sun Aug 29 00:50:25 2010 +0200
@@ -8,28 +8,12 @@
 from albow.resource import get_image
 from pygame import Rect
 
-class SplashButton(Image):
-    """The fancy hand button for the widget"""
+from gamelib.widgets import BoomImageButton
 
-    def __init__(self, filename, x, y, action, enable=None):
-        this_image = get_image('splash', filename)
-        Image.__init__(self, image=this_image)
-        self.action = action
-        self.set_rect(Rect((x, y), this_image.get_size()))
-        self.enable = enable
 
-    def draw(self, surface):
-        if self.is_enabled():
-            surface.blit(self.get_image(), self.get_rect())
+class SplashButton(BoomImageButton):
 
-    def mouse_down(self, event):
-        if self.is_enabled():
-            self.action()
-
-    def is_enabled(self):
-        if self.enable:
-            return self.enable()
-        return True
+    FOLDER = 'splash'
 
 
 class MenuScreen(Screen):