Mercurial > rinkhals
comparison gamelib/gameboard.py @ 447:f04a2490c35f
The sub-toolbar rewrite, the finally not crashing version
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 21 Nov 2009 19:58:49 +0000 |
parents | feb9b7a23ef2 |
children | 938498b8cd03 |
comparison
equal
deleted
inserted
replaced
446:0c523d384681 | 447:f04a2490c35f |
---|---|
82 self.days = 0 | 82 self.days = 0 |
83 self.killed_foxes = 0 | 83 self.killed_foxes = 0 |
84 self.day, self.night = True, False | 84 self.day, self.night = True, False |
85 # For the level loading case | 85 # For the level loading case |
86 if self.disp: | 86 if self.disp: |
87 self.toolbar = None | |
87 self.create_display() | 88 self.create_display() |
88 self.add_cash(level.starting_cash) | 89 self.add_cash(level.starting_cash) |
89 self.add_wood(level.starting_wood) | 90 self.add_wood(level.starting_wood) |
90 | 91 |
91 self.fix_buildings() | 92 self.fix_buildings() |
101 | 102 |
102 def create_display(self): | 103 def create_display(self): |
103 width, height = self.disp.rect.w, self.disp.rect.h | 104 width, height = self.disp.rect.w, self.disp.rect.h |
104 tbl = gui.Table() | 105 tbl = gui.Table() |
105 tbl.tr() | 106 tbl.tr() |
106 self.toolbar = toolbar.ToolBar(self, width=constants.TOOLBAR_WIDTH) | 107 self.toolbar = toolbar.DefaultToolBar(self, width=constants.TOOLBAR_WIDTH) |
107 tbl.td(self.toolbar, valign=-1) | 108 tbl.td(self.toolbar, valign=-1) |
108 self.tvw = VidWidget(self, self.tv, width=width-constants.TOOLBAR_WIDTH, height=height) | 109 self.tvw = VidWidget(self, self.tv, width=width-constants.TOOLBAR_WIDTH, height=height) |
109 tbl.td(self.tvw) | 110 tbl.td(self.tvw) |
110 self.top_widget = tbl | 111 self.top_widget = tbl |
112 | |
113 def change_toolbar(self, new_toolbar): | |
114 """Replace the toolbar""" | |
115 td = self.toolbar.container | |
116 td.remove(self.toolbar) | |
117 td.add(new_toolbar, 0, 0) | |
118 self.toolbar = new_toolbar | |
119 self.toolbar.rect.size = self.toolbar.resize(height=td.rect.height) | |
120 td.resize() | |
121 td.repaint() | |
111 | 122 |
112 def update(self): | 123 def update(self): |
113 self.tvw.reupdate() | 124 self.tvw.reupdate() |
114 | 125 |
115 def loop(self): | 126 def loop(self): |