Mercurial > nagslang
annotate tools/area_editor.py @ 115:6415db718b36
More albow
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Mon, 02 Sep 2013 15:04:42 +0200 |
parents | 817d4a62135c |
children | ecbcf6569fdb |
rev | line source |
---|---|
71
c449a3507a6b
Shebang and path hacking, so that the area_editor runs
Stefano Rivera <stefano@rivera.za.net>
parents:
57
diff
changeset
|
1 #!/usr/bin/env python |
c449a3507a6b
Shebang and path hacking, so that the area_editor runs
Stefano Rivera <stefano@rivera.za.net>
parents:
57
diff
changeset
|
2 |
51 | 3 # The basic area editor |
4 # | |
5 # To edit an existing level, use | |
6 # editor levelname | |
7 # | |
8 # To create a new level: | |
9 # | |
10 # editor levelname <xsize> <ysiz> | |
11 # (size specified in pixels | |
12 # | |
13 | |
71
c449a3507a6b
Shebang and path hacking, so that the area_editor runs
Stefano Rivera <stefano@rivera.za.net>
parents:
57
diff
changeset
|
14 import os |
c449a3507a6b
Shebang and path hacking, so that the area_editor runs
Stefano Rivera <stefano@rivera.za.net>
parents:
57
diff
changeset
|
15 import sys |
c449a3507a6b
Shebang and path hacking, so that the area_editor runs
Stefano Rivera <stefano@rivera.za.net>
parents:
57
diff
changeset
|
16 |
51 | 17 import pygame |
18 import pygame.locals as pgl | |
19 | |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
20 from albow.root import RootWidget |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
21 from albow.widget import Widget |
109
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
22 from albow.controls import Button |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
23 |
71
c449a3507a6b
Shebang and path hacking, so that the area_editor runs
Stefano Rivera <stefano@rivera.za.net>
parents:
57
diff
changeset
|
24 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
c449a3507a6b
Shebang and path hacking, so that the area_editor runs
Stefano Rivera <stefano@rivera.za.net>
parents:
57
diff
changeset
|
25 |
109
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
26 from nagslang.constants import SCREEN |
51 | 27 from nagslang.level import Level, POLY_COLORS |
28 | |
29 | |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
30 # layout constants |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
31 MENU_BUTTON_HEIGHT = 35 |
115 | 32 MENU_PAD = 6 |
33 MENU_HALF_PAD = MENU_PAD // 2 | |
34 MENU_LEFT = SCREEN[0] + MENU_HALF_PAD | |
35 MENU_WIDTH = 200 - MENU_PAD | |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
36 |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
37 |
51 | 38 class EditorLevel(Level): |
39 | |
40 def __init__(self, name, x=800, y=600): | |
41 super(EditorLevel, self).__init__(name) | |
42 self.x = x | |
43 self.y = y | |
44 | |
45 def round_point(self, pos): | |
46 return (10 * (pos[0] // 10), 10 * (pos[1] // 10)) | |
47 | |
48 def point_to_pymunk(self, pos): | |
49 # inverse of point_to_pygame | |
50 # (this is also the same as point_to_pygame, but a additional | |
51 # function for sanity later in pyweek). | |
52 return (pos[0], self.y - pos[1]) | |
53 | |
54 def add_point(self, poly_index, pos): | |
55 self.polygons.setdefault(poly_index, []) | |
56 if not self.polygons[poly_index]: | |
99 | 57 point = self.point_to_pymunk(self.round_point(pos)) |
58 self.polygons[poly_index].append(point) | |
51 | 59 else: |
60 add_pos = self.fix_angle(poly_index, pos) | |
61 self.polygons[poly_index].append(add_pos) | |
62 | |
63 def fix_angle(self, index, pos): | |
64 # Last point | |
65 point1 = self.point_to_pygame(self.polygons[index][-1]) | |
66 pos = self.round_point(pos) | |
67 # We want the line (point1 to pos) to be an angle of | |
68 # 0, 45, 90, 135, 180, 225, 270, 305 | |
69 # However, we only need to consider half the circle | |
70 # This is a hack to approximate the right thing | |
71 pos0 = (pos[0], point1[1]) | |
72 pos90 = (point1[0], pos[1]) | |
73 dist = max(abs(point1[0] - pos[0]), abs(point1[1] - pos[1])) | |
74 pos45 = (point1[0] + dist, point1[1] + dist) | |
75 pos135 = (point1[0] + dist, point1[1] - dist) | |
76 pos225 = (point1[0] - dist, point1[1] - dist) | |
77 pos305 = (point1[0] - dist, point1[1] + dist) | |
78 min_dist = 9999999 | |
79 new_pos = point1 | |
80 for cand in [pos0, pos90, pos45, pos135, pos225, pos305]: | |
81 dist = (pos[0] - cand[0]) ** 2 + (pos[1] - cand[1]) ** 2 | |
82 if dist < min_dist: | |
83 new_pos = cand | |
84 min_dist = dist | |
85 return self.point_to_pymunk(new_pos) | |
86 | |
87 def delete_point(self, index): | |
88 if index in self.polygons and len(self.polygons[index]) > 0: | |
89 self.polygons[index].pop() | |
90 | |
96
a9b564c38bef
Support showing exterior filled view in the editor
Neil Muller <drnlmuller@gmail.com>
parents:
72
diff
changeset
|
91 def draw(self, surface, topleft, mouse_pos, mouse_poly, filled): |
51 | 92 self._draw_background(True) |
93 # Draw polygons as needed for the editor | |
96
a9b564c38bef
Support showing exterior filled view in the editor
Neil Muller <drnlmuller@gmail.com>
parents:
72
diff
changeset
|
94 if filled: |
a9b564c38bef
Support showing exterior filled view in the editor
Neil Muller <drnlmuller@gmail.com>
parents:
72
diff
changeset
|
95 self._draw_exterior(True) |
51 | 96 for index, polygon in self.polygons.items(): |
97 color = POLY_COLORS[index] | |
98 if len(polygon) > 1: | |
99 pointlist = [self.point_to_pygame(p) for p in polygon] | |
100 pygame.draw.lines(self._surface, color, False, pointlist, 2) | |
101 if index == mouse_poly and mouse_pos: | |
102 endpoint = self.fix_angle(index, mouse_pos) | |
103 pygame.draw.line(self._surface, color, | |
99 | 104 self.point_to_pygame(polygon[-1]), |
105 self.point_to_pygame(endpoint)) | |
51 | 106 surface_area = pygame.rect.Rect(topleft, SCREEN) |
107 surface.blit(self._surface, (0, 0), surface_area) | |
108 | |
109
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
109 |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
110 class LevelWidget(Widget): |
51 | 111 |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
112 def __init__(self, level): |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
113 super(LevelWidget, self).__init__(pygame.rect.Rect(0, 0, |
109
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
114 SCREEN[0], SCREEN[1])) |
51 | 115 self.level = level |
116 self.pos = (0, 0) | |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
117 self.filled_mode = False |
51 | 118 self.mouse_pos = None |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
119 self.cur_poly = None |
51 | 120 |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
121 def _level_coordinates(self, pos): |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
122 # Move positions to level values |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
123 if not pos: |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
124 return (0, 0) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
125 return pos[0] + self.pos[0], pos[1] + self.pos[1] |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
126 |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
127 def _move_view(self, offset): |
51 | 128 new_pos = [self.pos[0] + offset[0], self.pos[1] + offset[1]] |
129 if new_pos[0] < 0: | |
130 new_pos[0] = self.pos[0] | |
131 elif new_pos[0] > self.level.x - SCREEN[0]: | |
132 new_pos[0] = self.pos[0] | |
133 if new_pos[1] < 0: | |
134 new_pos[1] = self.pos[1] | |
135 elif new_pos[1] > self.level.y - SCREEN[1]: | |
136 new_pos[1] = self.pos[1] | |
137 self.pos = tuple(new_pos) | |
138 | |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
139 def draw(self, surface): |
51 | 140 if (self.cur_poly is not None and self.cur_poly in self.level.polygons |
141 and len(self.level.polygons[self.cur_poly])): | |
142 # We have an active polygon | |
143 mouse_pos = self._level_coordinates(self.mouse_pos) | |
144 else: | |
145 mouse_pos = None | |
109
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
146 level.draw(surface, self.pos, mouse_pos, self.cur_poly, |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
147 self.filled_mode) |
51 | 148 |
115 | 149 def change_poly(self, new_poly): |
150 self.cur_poly = new_poly | |
151 if self.cur_poly is not None: | |
152 self.filled_mode = False | |
153 | |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
154 def key_down(self, ev): |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
155 if ev.key == pgl.K_LEFT: |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
156 self._move_view((-10, 0)) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
157 elif ev.key == pgl.K_RIGHT: |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
158 self._move_view((10, 0)) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
159 elif ev.key == pgl.K_UP: |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
160 self._move_view((0, -10)) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
161 elif ev.key == pgl.K_DOWN: |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
162 self._move_view((0, 10)) |
115 | 163 elif ev.key in (pgl.K_1, pgl.K_2, pgl.K_3, pgl.K_4, pgl.K_5, pgl.K_6): |
164 self.change_poly(ev.key - pgl.K_0) | |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
165 elif ev.key == pgl.K_0: |
115 | 166 self.change_poly(None) |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
167 elif ev.key == pgl.K_d and self.cur_poly: |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
168 self.level.delete_point(self.cur_poly) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
169 elif ev.key == pgl.K_s: |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
170 level.save() |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
171 elif ev.key == pgl.K_f: |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
172 if level.all_closed(): |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
173 self.cur_poly = None |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
174 self.filled_mode = True |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
175 else: |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
176 print 'Not all polygons closed, so not filling' |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
177 |
109
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
178 def mouse_move(self, ev): |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
179 old_pos = self.mouse_pos |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
180 self.mouse_pos = ev.pos |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
181 if self.cur_poly and old_pos != self.mouse_pos: |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
182 self.invalidate() |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
183 |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
184 def mouse_down(self, ev): |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
185 if self.cur_poly: |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
186 # Add a point |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
187 self.level.add_point(self.cur_poly, |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
188 self._level_coordinates(ev.pos)) |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
189 |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
190 |
115 | 191 class PolyButton(Button): |
192 """Button for coosing the correct polygon""" | |
193 | |
194 def __init__(self, index, level_widget): | |
195 if index is not None: | |
196 text = "Draw: %s" % index | |
197 else: | |
198 text = 'Exit Draw Mode' | |
199 super(PolyButton, self).__init__(text) | |
200 self.index = index | |
201 self.level_widget = level_widget | |
202 | |
203 def action(self): | |
204 self.level_widget.change_poly(self.index) | |
205 | |
206 | |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
207 class EditorApp(RootWidget): |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
208 |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
209 def __init__(self, level, surface): |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
210 super(EditorApp, self).__init__(surface) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
211 self.level = level |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
212 self.level_widget = LevelWidget(self.level) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
213 self.add(self.level_widget) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
214 |
115 | 215 # Add poly buttons |
216 y = 15 | |
217 for poly in range(1, 7): | |
218 but = PolyButton(poly, self.level_widget) | |
219 but.rect = pygame.rect.Rect(0, 0, MENU_WIDTH // 2 - MENU_PAD, | |
220 MENU_BUTTON_HEIGHT) | |
221 if poly % 2: | |
222 but.rect.move_ip(MENU_LEFT, y) | |
223 else: | |
224 but.rect.move_ip(MENU_LEFT + MENU_WIDTH // 2 - MENU_HALF_PAD, | |
225 y) | |
226 y += MENU_BUTTON_HEIGHT + MENU_PAD | |
227 self.add(but) | |
228 | |
229 end_poly_but = PolyButton(None, self.level_widget) | |
230 end_poly_but.rect = pygame.rect.Rect(0, 0, MENU_WIDTH, | |
231 MENU_BUTTON_HEIGHT) | |
232 end_poly_but.rect.move_ip(MENU_LEFT, y) | |
233 self.add(end_poly_but) | |
234 y += MENU_BUTTON_HEIGHT + MENU_PAD | |
235 | |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
236 quit_but = Button('Quit', action=self.quit) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
237 quit_but.rect = pygame.rect.Rect(0, 0, MENU_WIDTH, MENU_BUTTON_HEIGHT) |
115 | 238 quit_but.rect.move_ip(MENU_LEFT, y) |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
239 self.add(quit_but) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
240 |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
241 def key_down(self, ev): |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
242 if ev.key == pgl.K_ESCAPE: |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
243 self.quit() |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
244 else: |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
245 self.level_widget.key_down(ev) |
51 | 246 |
109
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
247 def mouse_move(self, ev): |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
248 self.level_widget.mouse_move(ev) |
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
249 |
51 | 250 |
251 if __name__ == "__main__": | |
252 if len(sys.argv) == 2: | |
253 level = EditorLevel(sys.argv[1]) | |
254 level.load() | |
255 elif len(sys.argv) == 4: | |
256 level = EditorLevel(sys.argv[1], int(sys.argv[2]), int(sys.argv[3])) | |
257 else: | |
258 print 'Please supply a levelname or levelname and level size' | |
259 sys.exit() | |
260 pygame.display.init() | |
261 pygame.font.init() | |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
262 pygame.display.set_mode((SCREEN[0] + MENU_WIDTH, SCREEN[1]), |
109
817d4a62135c
Partially albowify the level editor
Neil Muller <drnlmuller@gmail.com>
parents:
108
diff
changeset
|
263 pgl.SWSURFACE) |
51 | 264 pygame.display.set_caption('Nagslang Area Editor') |
108
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
265 pygame.key.set_repeat(200, 100) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
266 app = EditorApp(level, pygame.display.get_surface()) |
dde91f8c4335
Add fonts needed for Albowifying the editor
Neil Muller <drnlmuller@gmail.com>
parents:
99
diff
changeset
|
267 app.run() |