source: nagslang/widgets/base.py@ 29:58505d3482b6

Last change on this file since 29:58505d3482b6 was 29:58505d3482b6, checked in by Stefano Rivera <stefano@…>, 8 years ago

Text on the menu screen

File size: 484 bytes
Line 
1import pygame
2
3
4class Widget(object):
5 def __init__(self, pos, size):
6 self.pos = pos
7 self.size = size
8 self.rect = pygame.Rect(pos, size if size else (0, 0))
9 self.visible = True
10 self.is_prepared = False
11
12 def draw(self, surface):
13 raise NotImplemented()
14
15 def prepare(self):
16 raise NotImplemented()
17
18 def do_prepare(self):
19 if not self.is_prepared:
20 self.prepare()
21 self.is_prepared = True
Note: See TracBrowser for help on using the repository browser.