Mercurial > mamba
comparison mamba/habitats/editor.py @ 113:c5d6d0ba3b2b
Fill in more toolbar stuff
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sun, 11 Sep 2011 20:26:51 +0200 |
parents | 45397addd80d |
children | 6b1cdbdd34ca |
comparison
equal
deleted
inserted
replaced
112:62a705f4e876 | 113:c5d6d0ba3b2b |
---|---|
5 | 5 |
6 from mamba.engine import Habitat, NewHabitatEvent | 6 from mamba.engine import Habitat, NewHabitatEvent |
7 from mamba.widgets.level import LevelWidget | 7 from mamba.widgets.level import LevelWidget |
8 from mamba.widgets.text import TextWidget | 8 from mamba.widgets.text import TextWidget |
9 from mamba.widgets.imagebutton import ImageButtonWidget | 9 from mamba.widgets.imagebutton import ImageButtonWidget |
10 from mamba.level import Level, Tileset | 10 from mamba.level import Level, TILE_MAP |
11 from mamba.constants import SCREEN, EDIT_SCREEN, NAME, ESCAPE_KEYS | 11 from mamba.constants import SCREEN, EDIT_SCREEN, NAME, ESCAPE_KEYS |
12 | 12 |
13 | 13 |
14 class EditorHabitat(Habitat): | 14 class EditorHabitat(Habitat): |
15 def __init__(self, level_name): | 15 def __init__(self, level_name): |
60 button_height += tilesetname.surface.get_height() + button_padding | 60 button_height += tilesetname.surface.get_height() + button_padding |
61 floor_button = ImageButtonWidget( | 61 floor_button = ImageButtonWidget( |
62 (button_left, button_height), self.level.tileset.floor, | 62 (button_left, button_height), self.level.tileset.floor, |
63 'Floor', color='white') | 63 'Floor', color='white') |
64 self.container.add(floor_button) | 64 self.container.add(floor_button) |
65 button_height += floor_button.surface.get_height() + button_padding | |
66 for tile_char in TILE_MAP: | |
67 try: | |
68 tile = self.level.tileset[tile_char] | |
69 except pygame.error: | |
70 # Ignore stuff we can't load for now | |
71 continue | |
72 if tile is None: | |
73 continue | |
74 tile_button = ImageButtonWidget( | |
75 (button_left, button_height), tile.image, | |
76 'Tile', color='white') | |
77 self.container.add(tile_button) | |
78 button_height += \ | |
79 tile_button.surface.get_height() + button_padding |