git.fiddlerwoaroof.com
Ed L authored on 10/06/2014 20:38:45
Showing 75 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+cprotos.pyc libtcodpy.pyc
1 3
new file mode 100644
... ...
@@ -0,0 +1,1177 @@
1
+
2
+from ctypes import *
3
+from libtcodpy import Color
4
+
5
+# HACK for return types
6
+c_void = c_int
7
+
8
+def setup_protos(lib):
9
+    lib.TCOD_line_step.restype = c_bool
10
+    lib.TCOD_line_step.argtypes=[POINTER(c_int), POINTER(c_int)]
11
+
12
+    #_lib.TCOD_line.restype=c_bool 
13
+    #_lib.TCOD_line.argtypes=[c_int, c_int, c_int, c_int, TCOD_line_listener_t]
14
+
15
+    lib.TCOD_line_init_mt.restype=c_void 
16
+    lib.TCOD_line_init_mt.argtypes=[c_int, c_int, c_int, c_int, c_void_p]
17
+
18
+    lib.TCOD_line_step_mt.restype=c_bool 
19
+    lib.TCOD_line_step_mt.argtypes=[POINTER(c_int), POINTER(c_int), c_void_p]
20
+
21
+    #_lib.TCOD_line_mt.restype=c_bool 
22
+    #_lib.TCOD_line_mt.argtypes=[c_int, c_int, c_int, c_int, TCOD_line_listener_t , c_void_p]
23
+
24
+    lib.TCOD_bsp_new.restype=c_void_p
25
+    lib.TCOD_bsp_new.argtypes=[]
26
+
27
+    lib.TCOD_bsp_new_with_size.restype=c_void_p
28
+    lib.TCOD_bsp_new_with_size.argtypes=[c_int,c_int,c_int, c_int]
29
+
30
+    lib.TCOD_bsp_delete.restype=c_void 
31
+    lib.TCOD_bsp_delete.argtypes=[c_void_p]
32
+
33
+    lib.TCOD_bsp_left.restype=c_void_p
34
+    lib.TCOD_bsp_left.argtypes=[c_void_p]
35
+
36
+    lib.TCOD_bsp_right.restype=c_void_p
37
+    lib.TCOD_bsp_right.argtypes=[c_void_p]
38
+
39
+    lib.TCOD_bsp_father.restype=c_void_p
40
+    lib.TCOD_bsp_father.argtypes=[c_void_p]
41
+
42
+    lib.TCOD_bsp_is_leaf.restype=c_bool 
43
+    lib.TCOD_bsp_is_leaf.argtypes=[c_void_p]
44
+
45
+    #_lib.c_void_pre_order.restype=c_bool 
46
+    #_lib.c_void_pre_order.argtypes=[c_void_p, TCOD_bsp_callback_t , void_p]
47
+
48
+    #_lib.TCOD_bsp_traverse_in_order.restype=c_bool 
49
+    #_lib.TCOD_bsp_traverse_in_order.argtypes=[c_void_p, TCOD_bsp_callback_t , void_p]
50
+
51
+    #_lib.c_void_post_order.restype=c_bool 
52
+    #_lib.c_void_post_order.argtypes=[c_void_p, TCOD_bsp_callback_t , void_p]
53
+
54
+    #_lib.TCOD_bsp_traverse_level_order.restype=c_bool 
55
+    #_lib.TCOD_bsp_traverse_level_order.argtypes=[c_void_p, TCOD_bsp_callback_t , void_p]
56
+
57
+    #_lib.TCOD_bsp_traverse_inverted_level_order.restype=c_bool 
58
+    #_lib.TCOD_bsp_traverse_inverted_level_order.argtypes=[c_void_p, TCOD_bsp_callback_t , void_p]
59
+
60
+    lib.TCOD_bsp_contains.restype=c_bool 
61
+    lib.TCOD_bsp_contains.argtypes=[c_void_p, c_int, c_int]
62
+
63
+    lib.TCOD_bsp_find_node.restype=c_void_p
64
+    lib.TCOD_bsp_find_node.argtypes=[c_void_p, c_int, c_int]
65
+
66
+    lib.TCOD_bsp_resize.restype=c_void 
67
+    lib.TCOD_bsp_resize.argtypes=[c_void_p, c_int,c_int, c_int, c_int]
68
+
69
+    lib.TCOD_bsp_split_once.restype=c_void 
70
+    lib.TCOD_bsp_split_once.argtypes=[c_void_p, c_bool , c_int]
71
+
72
+    lib.TCOD_bsp_split_recursive.restype=c_void 
73
+    lib.TCOD_bsp_split_recursive.argtypes=[c_void_p, c_void_p , c_int, ]
74
+
75
+    lib.TCOD_bsp_remove_sons.restype=c_void
76
+    lib.TCOD_bsp_remove_sons.argtypes=[c_void_p]
77
+
78
+    lib.TCOD_color_RGB.restype=Color
79
+    lib.TCOD_color_RGB.argtypes=[c_byte , c_byte , c_byte ]
80
+
81
+    lib.TCOD_color_HSV.restype=Color
82
+    lib.TCOD_color_HSV.argtypes=[c_float , c_float , c_float ]
83
+
84
+    lib.TCOD_color_equals .restype=c_bool
85
+    lib.TCOD_color_equals .argtypes=[Color, Color]
86
+
87
+    lib.TCOD_color_add .restype=Color
88
+    lib.TCOD_color_add .argtypes=[Color, Color]
89
+
90
+    lib.TCOD_color_subtract .restype=Color
91
+    lib.TCOD_color_subtract .argtypes=[Color, Color]
92
+
93
+    lib.TCOD_color_multiply .restype=Color
94
+    lib.TCOD_color_multiply .argtypes=[Color , Color ]
95
+
96
+    lib.TCOD_color_multiply_scalar .restype=Color
97
+    lib.TCOD_color_multiply_scalar .argtypes=[Color , c_float ]
98
+
99
+#    lib.TCOD_color_lerp .restype=c_int
100
+#    lib.TCOD_color_lerp .argtypes=[c_int , c_int , c_float ]
101
+
102
+    lib.TCOD_color_set_HSV .restype=c_void
103
+    lib.TCOD_color_set_HSV .argtypes=[POINTER(Color),c_float , c_float , c_float ]
104
+
105
+    lib.TCOD_color_get_HSV .restype=c_void
106
+    lib.TCOD_color_get_HSV .argtypes=[Color ,POINTER(c_float) , POINTER(c_float) , POINTER(c_float) ]
107
+
108
+    lib.TCOD_color_get_hue .restype=c_float
109
+    lib.TCOD_color_get_hue .argtypes=[Color ]
110
+
111
+    lib.TCOD_color_set_hue .restype=c_void
112
+    lib.TCOD_color_set_hue .argtypes=[POINTER(Color), c_float ]
113
+
114
+    lib.TCOD_color_get_saturation .restype=c_float
115
+    lib.TCOD_color_get_saturation .argtypes=[Color ]
116
+
117
+    lib.TCOD_color_set_saturation .restype=c_void
118
+    lib.TCOD_color_set_saturation .argtypes=[POINTER(Color), c_float ]
119
+
120
+    lib.TCOD_color_get_value .restype=c_float
121
+    lib.TCOD_color_get_value .argtypes=[Color ]
122
+
123
+    lib.TCOD_color_set_value .restype=c_void
124
+    lib.TCOD_color_set_value .argtypes=[POINTER(Color), c_float ]
125
+
126
+    lib.TCOD_color_shift_hue .restype=c_void
127
+    lib.TCOD_color_shift_hue .argtypes=[POINTER(Color), c_float ]
128
+
129
+    lib.TCOD_color_scale_HSV .restype=c_void
130
+    lib.TCOD_color_scale_HSV .argtypes=[POINTER(Color), c_float , c_float ]
131
+
132
+    lib.TCOD_color_gen_map.restype=c_void
133
+    lib.TCOD_color_gen_map.argtypes=[POINTER(Color), c_int, POINTER(Color), POINTER(c_int)]
134
+
135
+    lib.TCOD_console_init_root.restype=c_void
136
+    lib.TCOD_console_init_root.argtypes=[c_int, c_int, c_char_p , c_bool , c_uint ]
137
+
138
+    lib.TCOD_console_set_window_title.restype=c_void
139
+    lib.TCOD_console_set_window_title.argtypes=[c_char_p]
140
+
141
+    lib.TCOD_console_set_fullscreen.restype=c_void
142
+    lib.TCOD_console_set_fullscreen.argtypes=[c_bool ]
143
+
144
+    lib.TCOD_console_is_fullscreen.restype=c_bool
145
+    lib.TCOD_console_is_fullscreen.argtypes=[]
146
+
147
+    lib.TCOD_console_is_window_closed.restype=c_bool
148
+    lib.TCOD_console_is_window_closed.argtypes=[]
149
+
150
+    lib.TCOD_console_set_custom_font.restype=c_void
151
+    lib.TCOD_console_set_custom_font.argtypes=[c_char_p, c_int,c_int, c_int]
152
+
153
+    lib.TCOD_console_map_ascii_code_to_font.restype=c_void
154
+    lib.TCOD_console_map_ascii_code_to_font.argtypes=[c_int, c_int, c_int]
155
+
156
+    lib.TCOD_console_map_ascii_codes_to_font.restype=c_void
157
+    lib.TCOD_console_map_ascii_codes_to_font.argtypes=[c_int, c_int, c_int, c_int]
158
+
159
+    lib.TCOD_console_map_string_to_font.restype=c_void
160
+    lib.TCOD_console_map_string_to_font.argtypes=[c_char_p, c_int, c_int]
161
+
162
+    lib.TCOD_console_set_dirty.restype=c_void
163
+    lib.TCOD_console_set_dirty.argtypes=[c_int, c_int, c_int, c_int]
164
+
165
+    lib.TCOD_console_set_default_background.restype=c_void
166
+    lib.TCOD_console_set_default_background.argtypes=[c_void_p ,Color ]
167
+
168
+    lib.TCOD_console_set_default_foreground.restype=c_void
169
+    lib.TCOD_console_set_default_foreground.argtypes=[c_void_p ,Color ]
170
+
171
+    lib.TCOD_console_clear.restype=c_void
172
+    lib.TCOD_console_clear.argtypes=[c_void_p ]
173
+
174
+    lib.TCOD_console_set_char_background.restype=c_void
175
+    lib.TCOD_console_set_char_background.argtypes=[c_void_p ,c_int, c_int, Color , c_int ]
176
+
177
+    lib.TCOD_console_set_char_foreground.restype=c_void
178
+    lib.TCOD_console_set_char_foreground.argtypes=[c_void_p ,c_int, c_int, Color ]
179
+
180
+    lib.TCOD_console_set_char.restype=c_void
181
+    lib.TCOD_console_set_char.argtypes=[c_void_p ,c_int, c_int, c_int]
182
+
183
+    lib.TCOD_console_put_char.restype=c_void
184
+    lib.TCOD_console_put_char.argtypes=[c_void_p ,c_int, c_int, c_int, c_int ]
185
+
186
+    lib.TCOD_console_put_char_ex.restype=c_void
187
+    lib.TCOD_console_put_char_ex.argtypes=[c_void_p ,c_int, c_int, c_int, Color, Color ]
188
+
189
+    lib.TCOD_console_set_background_flag.restype=c_void
190
+    lib.TCOD_console_set_background_flag.argtypes=[c_void_p ,c_int ]
191
+
192
+    lib.TCOD_console_get_background_flag.restype=c_int
193
+    lib.TCOD_console_get_background_flag.argtypes=[c_void_p ]
194
+
195
+    lib.TCOD_console_set_alignment.restype=c_void
196
+    lib.TCOD_console_set_alignment.argtypes=[c_void_p ,c_int ]
197
+
198
+    lib.TCOD_console_get_alignment.restype=c_int
199
+    lib.TCOD_console_get_alignment.argtypes=[c_void_p ]
200
+
201
+#    lib.TCOD_console_print.restype=c_void
202
+#    lib.TCOD_console_print.argtypes=[c_void_p ,c_int, c_int, c_char_p, ...]
203
+
204
+#    lib.TCOD_console_print_ex.restype=c_void
205
+#    lib.TCOD_console_print_ex.argtypes=[c_void_p ,c_int, c_int, c_int , c_int , c_char_p, ...]
206
+
207
+#    lib.TCOD_console_print_rect.restype=c_int
208
+#    lib.TCOD_console_print_rect.argtypes=[c_void_p ,c_int, c_int, c_int, c_int, c_char_p, ...]
209
+
210
+#    lib.TCOD_console_print_rect_ex.restype=c_int
211
+#    lib.TCOD_console_print_rect_ex.argtypes=[c_void_p ,c_int, c_int, c_int, c_int, c_int , c_int , c_char_p, ...]
212
+
213
+#    lib.TCOD_console_get_height_rect.restype=c_int
214
+#    lib.TCOD_console_get_height_rect.argtypes=[c_void_p ,c_int, c_int, c_int, c_int, c_char_p, ...]
215
+
216
+    lib.TCOD_console_rect.restype=c_void
217
+    lib.TCOD_console_rect.argtypes=[c_void_p ,c_int, c_int, c_int, c_int, c_bool , c_int ]
218
+
219
+    lib.TCOD_console_hline.restype=c_void
220
+    lib.TCOD_console_hline.argtypes=[c_void_p ,c_int,c_int, c_int, c_int ]
221
+
222
+    lib.TCOD_console_vline.restype=c_void
223
+    lib.TCOD_console_vline.argtypes=[c_void_p ,c_int,c_int, c_int, c_int ]
224
+
225
+#    lib.TCOD_console_print_frame.restype=c_void
226
+#    lib.TCOD_console_print_frame.argtypes=[c_void_p ,c_int,c_int,c_int,c_int, c_bool , c_int , c_char_p, ...]
227
+
228
+    lib.TCOD_console_map_string_to_font_utf.restype=c_void
229
+    lib.TCOD_console_map_string_to_font_utf.argtypes=[c_char_p, c_int, c_int]
230
+
231
+#    lib.TCOD_console_print_utf.restype=c_void
232
+#    lib.TCOD_console_print_utf.argtypes=[c_void_p ,c_int, c_int, wchar_t_p, ...]
233
+
234
+#    lib.TCOD_console_print_ex_utf.restype=c_void
235
+#    lib.TCOD_console_print_ex_utf.argtypes=[c_void_p ,c_int, c_int, c_int , c_int , wchar_t_p, ...]
236
+
237
+#    lib.TCOD_console_print_rect_utf.restype=c_int
238
+#    lib.TCOD_console_print_rect_utf.argtypes=[c_void_p ,c_int, c_int, c_int, c_int, wchar_t_p, ...]
239
+
240
+#    lib.TCOD_console_print_rect_ex_utf.restype=c_int
241
+#    lib.TCOD_console_print_rect_ex_utf.argtypes=[c_void_p ,c_int, c_int, c_int, c_int, c_int , c_int , wchar_t_p, ...]
242
+
243
+    lib.TCOD_console_get_height_rect_utf.restype=c_int
244
+#    lib.TCOD_console_get_height_rect_utf.argtypes=[c_void_p ,c_int, c_int, c_int, c_int, wchar_t_p, ...]
245
+
246
+    lib.TCOD_console_get_default_background.restype=Color
247
+    lib.TCOD_console_get_default_background.argtypes=[c_void_p ]
248
+
249
+    lib.TCOD_console_get_default_foreground.restype=Color
250
+    lib.TCOD_console_get_default_foreground.argtypes=[c_void_p ]
251
+
252
+    lib.TCOD_console_get_char_background.restype=Color
253
+    lib.TCOD_console_get_char_background.argtypes=[c_void_p ,c_int, c_int]
254
+
255
+    lib.TCOD_console_get_char_foreground.restype=Color
256
+    lib.TCOD_console_get_char_foreground.argtypes=[c_void_p ,c_int, c_int]
257
+
258
+    lib.TCOD_console_get_char.restype=c_int
259
+    lib.TCOD_console_get_char.argtypes=[c_void_p ,c_int, c_int]
260
+
261
+    lib.TCOD_console_set_fade.restype=c_void
262
+    lib.TCOD_console_set_fade.argtypes=[c_byte , Color ]
263
+
264
+    lib.TCOD_console_get_fade.restype=c_byte
265
+    lib.TCOD_console_get_fade.argtypes=[]
266
+
267
+    lib.TCOD_console_get_fading_color.restype=Color
268
+    lib.TCOD_console_get_fading_color.argtypes=[]
269
+
270
+    lib.TCOD_console_flush.restype=c_void
271
+    lib.TCOD_console_flush.argtypes=[]
272
+
273
+    lib.TCOD_console_set_color_control.restype=c_void
274
+    lib.TCOD_console_set_color_control.argtypes=[c_int , Color , Color ]
275
+
276
+#    lib.TCOD_console_check_for_keypress.restype=TCOD_key_t
277
+#    lib.TCOD_console_check_for_keypress.argtypes=[c_int]
278
+
279
+#    lib.TCOD_console_wait_for_keypress.restype=TCOD_key_t
280
+#    lib.TCOD_console_wait_for_keypress.argtypes=[c_bool ]
281
+
282
+    lib.TCOD_console_set_keyboard_repeat.restype=c_void
283
+    lib.TCOD_console_set_keyboard_repeat.argtypes=[c_int, c_int]
284
+
285
+    lib.TCOD_console_disable_keyboard_repeat.restype=c_void
286
+    lib.TCOD_console_disable_keyboard_repeat.argtypes=[]
287
+
288
+    lib.TCOD_console_is_key_pressed.restype=c_bool
289
+    lib.TCOD_console_is_key_pressed.argtypes=[c_int ]
290
+
291
+    lib.TCOD_console_from_file.restype=c_void_p
292
+    lib.TCOD_console_from_file.argtypes=[c_char_p]
293
+
294
+    lib.TCOD_console_load_asc.restype=c_bool
295
+    lib.TCOD_console_load_asc.argtypes=[c_void_p , c_char_p]
296
+
297
+    lib.TCOD_console_load_apf.restype=c_bool
298
+    lib.TCOD_console_load_apf.argtypes=[c_void_p , c_char_p]
299
+
300
+    lib.TCOD_console_save_asc.restype=c_bool
301
+    lib.TCOD_console_save_asc.argtypes=[c_void_p , c_char_p]
302
+
303
+    lib.TCOD_console_save_apf.restype=c_bool
304
+    lib.TCOD_console_save_apf.argtypes=[c_void_p , c_char_p]
305
+
306
+    lib.TCOD_console_new.restype=c_void_p
307
+    lib.TCOD_console_new.argtypes=[c_int, c_int]
308
+
309
+    lib.TCOD_console_get_width.restype=c_int
310
+    lib.TCOD_console_get_width.argtypes=[c_void_p ]
311
+
312
+    lib.TCOD_console_get_height.restype=c_int
313
+    lib.TCOD_console_get_height.argtypes=[c_void_p ]
314
+
315
+    lib.TCOD_console_set_key_color.restype=c_void
316
+    lib.TCOD_console_set_key_color.argtypes=[c_void_p ,Color ]
317
+
318
+    lib.TCOD_console_blit.restype=c_void
319
+    lib.TCOD_console_blit.argtypes=[c_void_p ,c_int, c_int, c_int, c_int, c_void_p , c_int, c_int, c_float, c_float]
320
+
321
+    lib.TCOD_console_delete.restype=c_void
322
+    lib.TCOD_console_delete.argtypes=[c_void_p ]
323
+
324
+    lib.TCOD_console_credits.restype=c_void
325
+    lib.TCOD_console_credits.argtypes=[]
326
+
327
+    lib.TCOD_console_credits_reset.restype=c_void
328
+    lib.TCOD_console_credits_reset.argtypes=[]
329
+
330
+    lib.TCOD_console_credits_render.restype=c_bool
331
+    lib.TCOD_console_credits_render.argtypes=[c_int, c_int, c_bool ]
332
+
333
+    lib.TCOD_map_new.restype=c_void_p
334
+    lib.TCOD_map_new.argtypes=[c_int, c_int]
335
+
336
+    lib.TCOD_map_clear.restype=c_void
337
+    lib.TCOD_map_clear.argtypes=[c_void_p , c_bool , c_bool ]
338
+
339
+    lib.TCOD_map_copy.restype=c_void
340
+    lib.TCOD_map_copy.argtypes=[c_void_p , c_void_p ]
341
+
342
+    lib.TCOD_map_set_properties.restype=c_void
343
+    lib.TCOD_map_set_properties.argtypes=[c_void_p , c_int, c_int, c_bool, c_bool]
344
+
345
+    lib.TCOD_map_delete.restype=c_void
346
+    lib.TCOD_map_delete.argtypes=[c_void_p ]
347
+
348
+    lib.TCOD_map_compute_fov.restype=c_void
349
+    lib.TCOD_map_compute_fov.argtypes=[c_void_p , c_int, c_int, c_int, c_bool, c_int ]
350
+
351
+    lib.TCOD_map_is_in_fov.restype=c_bool
352
+    lib.TCOD_map_is_in_fov.argtypes=[c_void_p , c_int, c_int]
353
+
354
+    lib.TCOD_map_set_in_fov.restype=c_void
355
+    lib.TCOD_map_set_in_fov.argtypes=[c_void_p , c_int, c_int, c_bool ]
356
+
357
+    lib.TCOD_map_is_transparent.restype=c_bool
358
+    lib.TCOD_map_is_transparent.argtypes=[c_void_p , c_int, c_int]
359
+
360
+    lib.TCOD_map_is_walkable.restype=c_bool
361
+    lib.TCOD_map_is_walkable.argtypes=[c_void_p , c_int, c_int]
362
+
363
+    lib.TCOD_map_get_width.restype=c_int
364
+    lib.TCOD_map_get_width.argtypes=[c_void_p ]
365
+
366
+    lib.TCOD_map_get_height.restype=c_int
367
+    lib.TCOD_map_get_height.argtypes=[c_void_p ]
368
+
369
+    lib.TCOD_map_get_nb_cells.restype=c_int
370
+    lib.TCOD_map_get_nb_cells.argtypes=[c_void_p ]
371
+
372
+    lib.TCOD_heightmap_new.restype=c_void_p
373
+    lib.TCOD_heightmap_new.argtypes=[c_int,c_int]
374
+
375
+    lib.TCOD_heightmap_delete.restype=c_void
376
+    lib.TCOD_heightmap_delete.argtypes=[c_void_p]
377
+
378
+    lib.TCOD_heightmap_get_value.restype=c_float
379
+    lib.TCOD_heightmap_get_value.argtypes=[c_void_p, c_int, c_int]
380
+
381
+    lib.TCOD_heightmap_get_interpolated_value.restype=c_float
382
+    lib.TCOD_heightmap_get_interpolated_value.argtypes=[c_void_p, c_float , c_float ]
383
+
384
+    lib.TCOD_heightmap_set_value.restype=c_void
385
+    lib.TCOD_heightmap_set_value.argtypes=[c_void_p, c_int, c_int, c_float ]
386
+
387
+    lib.TCOD_heightmap_get_slope.restype=c_float
388
+    lib.TCOD_heightmap_get_slope.argtypes=[c_void_p, c_int, c_int]
389
+
390
+    lib.TCOD_heightmap_get_normal.restype=c_void
391
+    lib.TCOD_heightmap_get_normal.argtypes=[c_void_p, c_float , c_float , POINTER(c_float), c_float ]
392
+
393
+    lib.TCOD_heightmap_count_cells.restype=c_int
394
+    lib.TCOD_heightmap_count_cells.argtypes=[c_void_p, c_float , c_float ]
395
+
396
+    lib.TCOD_heightmap_has_land_on_border.restype=c_bool
397
+    lib.TCOD_heightmap_has_land_on_border.argtypes=[c_void_p, c_float ]
398
+
399
+    lib.TCOD_heightmap_get_minmax.restype=c_void
400
+    lib.TCOD_heightmap_get_minmax.argtypes=[c_void_p, POINTER(c_float), POINTER(c_float)]
401
+
402
+    lib.TCOD_heightmap_copy.restype=c_void
403
+    lib.TCOD_heightmap_copy.argtypes=[c_void_p,c_void_p]
404
+
405
+    lib.TCOD_heightmap_add.restype=c_void
406
+    lib.TCOD_heightmap_add.argtypes=[c_void_p, c_float ]
407
+
408
+    lib.TCOD_heightmap_scale.restype=c_void
409
+    lib.TCOD_heightmap_scale.argtypes=[c_void_p, c_float ]
410
+
411
+    lib.TCOD_heightmap_clamp.restype=c_void
412
+    lib.TCOD_heightmap_clamp.argtypes=[c_void_p, c_float , c_float ]
413
+
414
+    lib.TCOD_heightmap_normalize.restype=c_void
415
+    lib.TCOD_heightmap_normalize.argtypes=[c_void_p, c_float , c_float ]
416
+
417
+    lib.TCOD_heightmap_clear.restype=c_void
418
+    lib.TCOD_heightmap_clear.argtypes=[c_void_p]
419
+
420
+    lib.TCOD_heightmap_lerp_hm.restype=c_void
421
+    lib.TCOD_heightmap_lerp_hm.argtypes=[c_void_p, c_void_p, c_void_p, c_float ]
422
+
423
+    lib.TCOD_heightmap_add_hm.restype=c_void
424
+    lib.TCOD_heightmap_add_hm.argtypes=[c_void_p, c_void_p, c_void_p]
425
+
426
+    lib.TCOD_heightmap_multiply_hm.restype=c_void
427
+    lib.TCOD_heightmap_multiply_hm.argtypes=[c_void_p, c_void_p, c_void_p]
428
+
429
+    lib.TCOD_heightmap_add_hill.restype=c_void
430
+    lib.TCOD_heightmap_add_hill.argtypes=[c_void_p, c_float , c_float , c_float , c_float ]
431
+
432
+    lib.TCOD_heightmap_dig_hill.restype=c_void
433
+    lib.TCOD_heightmap_dig_hill.argtypes=[c_void_p, c_float , c_float , c_float , c_float ]
434
+
435
+    lib.TCOD_heightmap_dig_bezier.restype=c_void
436
+    lib.TCOD_heightmap_dig_bezier.argtypes=[c_void_p, POINTER(c_int), POINTER(c_int), c_float , c_float , c_float , c_float ]
437
+
438
+    lib.TCOD_heightmap_rain_erosion.restype=c_void
439
+    lib.TCOD_heightmap_rain_erosion.argtypes=[c_void_p, c_int,c_float ,c_float ,c_void_p ]
440
+
441
+
442
+    lib.TCOD_heightmap_kernel_transform.restype=c_void
443
+    lib.TCOD_heightmap_kernel_transform.argtypes=[c_void_p, c_int, POINTER(c_int), POINTER(c_int), POINTER(c_float), c_float ,c_float ]
444
+
445
+    lib.TCOD_heightmap_add_voronoi.restype=c_void
446
+    lib.TCOD_heightmap_add_voronoi.argtypes=[c_void_p, c_int, c_int, POINTER(c_float),c_void_p ]
447
+
448
+
449
+    lib.TCOD_heightmap_add_fbm.restype=c_void
450
+    lib.TCOD_heightmap_add_fbm.argtypes=[c_void_p, c_int ,c_float , c_float , c_float , c_float , c_float , c_float , c_float ]
451
+
452
+    lib.TCOD_heightmap_scale_fbm.restype=c_void
453
+    lib.TCOD_heightmap_scale_fbm.argtypes=[c_void_p, c_int ,c_float , c_float , c_float , c_float , c_float , c_float , c_float ]
454
+
455
+    lib.TCOD_heightmap_islandify.restype=c_void
456
+    lib.TCOD_heightmap_islandify.argtypes=[c_void_p, c_float ,c_void_p ]
457
+
458
+    lib.TCOD_image_new.restype=c_void_p
459
+    lib.TCOD_image_new.argtypes=[c_int, c_int]
460
+
461
+    lib.TCOD_image_from_console.restype=c_void_p
462
+    lib.TCOD_image_from_console.argtypes=[c_void_p ]
463
+
464
+    lib.TCOD_image_refresh_console.restype=c_void
465
+    lib.TCOD_image_refresh_console.argtypes=[c_void_p , c_void_p ]
466
+
467
+    lib.TCOD_image_load.restype=c_void_p
468
+    lib.TCOD_image_load.argtypes=[c_char_p]
469
+
470
+    lib.TCOD_image_clear.restype=c_void
471
+    lib.TCOD_image_clear.argtypes=[c_void_p , Color ]
472
+
473
+    lib.TCOD_image_invert.restype=c_void
474
+    lib.TCOD_image_invert.argtypes=[c_void_p ]
475
+
476
+    lib.TCOD_image_hflip.restype=c_void
477
+    lib.TCOD_image_hflip.argtypes=[c_void_p ]
478
+
479
+    lib.TCOD_image_rotate90.restype=c_void
480
+    lib.TCOD_image_rotate90.argtypes=[c_void_p , c_int]
481
+
482
+    lib.TCOD_image_vflip.restype=c_void
483
+    lib.TCOD_image_vflip.argtypes=[c_void_p ]
484
+
485
+    lib.TCOD_image_scale.restype=c_void
486
+    lib.TCOD_image_scale.argtypes=[c_void_p , c_int, c_int]
487
+
488
+    lib.TCOD_image_save.restype=c_void
489
+    lib.TCOD_image_save.argtypes=[c_void_p , c_char_p]
490
+
491
+    lib.TCOD_image_get_size.restype=c_void
492
+    lib.TCOD_image_get_size.argtypes=[c_void_p , POINTER(c_int),POINTER(c_int)]
493
+
494
+    lib.TCOD_image_get_pixel.restype=Color
495
+    lib.TCOD_image_get_pixel.argtypes=[c_void_p ,c_int, c_int]
496
+
497
+    lib.TCOD_image_get_alpha.restype=c_int
498
+    lib.TCOD_image_get_alpha.argtypes=[c_void_p ,c_int, c_int]
499
+
500
+    lib.TCOD_image_get_mipmap_pixel.restype=c_int
501
+    lib.TCOD_image_get_mipmap_pixel.argtypes=[c_void_p ,c_float,c_float, c_float, c_float]
502
+
503
+    lib.TCOD_image_put_pixel.restype=c_void
504
+    lib.TCOD_image_put_pixel.argtypes=[c_void_p ,c_int, c_int,Color ]
505
+
506
+    lib.TCOD_image_blit.restype=c_void
507
+    lib.TCOD_image_blit.argtypes=[c_void_p , c_void_p , c_float , c_float , ]
508
+
509
+    lib.TCOD_image_blit_rect.restype=c_void
510
+    lib.TCOD_image_blit_rect.argtypes=[c_void_p , c_void_p , c_int, c_int, c_int, c_int, ]
511
+
512
+    lib.TCOD_image_blit_2x.restype=c_void
513
+    lib.TCOD_image_blit_2x.argtypes=[c_void_p , c_void_p , c_int, c_int, c_int, c_int, c_int, c_int]
514
+
515
+    lib.TCOD_image_delete.restype=c_void
516
+    lib.TCOD_image_delete.argtypes=[c_void_p ]
517
+
518
+    lib.TCOD_image_set_key_color.restype=c_void
519
+    lib.TCOD_image_set_key_color.argtypes=[c_void_p , Color]
520
+
521
+    lib.TCOD_image_is_pixel_transparent.restype=c_bool
522
+    lib.TCOD_image_is_pixel_transparent.argtypes=[c_void_p , c_int, c_int]
523
+
524
+    lib.TCOD_lex_new_intern.restype=c_void_p
525
+    lib.TCOD_lex_new_intern.argtypes=[]
526
+
527
+    lib.TCOD_lex_new.restype=c_void_p
528
+    lib.TCOD_lex_new.argtypes=[POINTER(c_char_p), POINTER(c_char_p), c_char_p, ]
529
+
530
+    lib.TCOD_lex_delete.restype=c_void
531
+    lib.TCOD_lex_delete.argtypes=[c_void_p]
532
+
533
+    lib.TCOD_lex_set_data_buffer.restype=c_void
534
+    lib.TCOD_lex_set_data_buffer.argtypes=[c_void_p,c_char_p]
535
+
536
+    lib.TCOD_lex_set_data_file.restype=c_bool
537
+    lib.TCOD_lex_set_data_file.argtypes=[c_void_p,c_char_p]
538
+
539
+    lib.TCOD_lex_parse.restype=c_int
540
+    lib.TCOD_lex_parse.argtypes=[c_void_p]
541
+
542
+    lib.TCOD_lex_parse_until_token_type.restype=c_int
543
+    lib.TCOD_lex_parse_until_token_type.argtypes=[c_void_p,c_int]
544
+
545
+    lib.TCOD_lex_parse_until_token_value.restype=c_int
546
+    lib.TCOD_lex_parse_until_token_value.argtypes=[c_void_p,c_char_p]
547
+
548
+    lib.TCOD_lex_expect_token_type.restype=c_bool
549
+    lib.TCOD_lex_expect_token_type.argtypes=[c_void_p,c_int]
550
+
551
+    lib.TCOD_lex_expect_token_value.restype=c_bool
552
+    lib.TCOD_lex_expect_token_value.argtypes=[c_void_p,c_int,c_char_p]
553
+
554
+    lib.TCOD_lex_savepoint.restype=c_void
555
+    lib.TCOD_lex_savepoint.argtypes=[c_void_p,c_void_p]
556
+
557
+    lib.TCOD_lex_restore.restype=c_void
558
+    lib.TCOD_lex_restore.argtypes=[c_void_p,c_void_p]
559
+
560
+    lib.TCOD_lex_get_last_javadoc.restype=c_char_p
561
+    lib.TCOD_lex_get_last_javadoc.argtypes=[c_void_p]
562
+
563
+    lib.TCOD_lex_get_token_name.restype=c_char_p
564
+    lib.TCOD_lex_get_token_name.argtypes=[c_int]
565
+
566
+    lib.TCOD_lex_get_last_error.restype=c_char_p
567
+    lib.TCOD_lex_get_last_error.argtypes=[]
568
+
569
+    lib.TCOD_lex_hextoint.restype=c_int
570
+    lib.TCOD_lex_hextoint.argtypes=[c_char]
571
+
572
+    lib.TCOD_sys_get_surface.restype=c_void_p
573
+    lib.TCOD_sys_get_surface.argtypes=[c_int, c_int, c_bool ]
574
+
575
+    lib.TCOD_sys_load_image.restype=c_void_p
576
+    lib.TCOD_sys_load_image.argtypes=[c_char_p]
577
+
578
+    lib.TCOD_list_new.restype=c_void_p
579
+    lib.TCOD_list_new.argtypes=[]
580
+
581
+    lib.TCOD_list_allocate.restype=c_void_p
582
+    lib.TCOD_list_allocate.argtypes=[c_int]
583
+
584
+    lib.TCOD_list_duplicate.restype=c_void_p
585
+    lib.TCOD_list_duplicate.argtypes=[c_void_p ]
586
+
587
+    lib.TCOD_list_delete.restype=c_void
588
+    lib.TCOD_list_delete.argtypes=[c_void_p ]
589
+
590
+    lib.TCOD_list_push.restype=c_void
591
+    lib.TCOD_list_push.argtypes=[c_void_p ,c_void_p ]
592
+
593
+    lib.TCOD_list_pop.restype=c_void_p
594
+    lib.TCOD_list_pop.argtypes=[c_void_p ]
595
+
596
+    lib.TCOD_list_peek.restype=c_void_p
597
+    lib.TCOD_list_peek.argtypes=[c_void_p ]
598
+
599
+    lib.TCOD_list_add_all.restype=c_void
600
+    lib.TCOD_list_add_all.argtypes=[c_void_p , c_void_p ]
601
+
602
+    lib.TCOD_list_get.restype=c_void_p
603
+    lib.TCOD_list_get.argtypes=[c_void_p ,c_int]
604
+
605
+    lib.TCOD_list_set.restype=c_void
606
+    lib.TCOD_list_set.argtypes=[c_void_p ,c_void_p, c_int]
607
+
608
+    lib.TCOD_list_begin.restype=POINTER(c_void_p)
609
+    lib.TCOD_list_begin.argtypes=[c_void_p ]
610
+
611
+    lib.TCOD_list_end.restype=POINTER(c_void_p)
612
+    lib.TCOD_list_end.argtypes=[c_void_p ]
613
+
614
+    lib.TCOD_list_reverse.restype=c_void
615
+    lib.TCOD_list_reverse.argtypes=[c_void_p ]
616
+
617
+    lib.TCOD_list_remove_iterator.restype=POINTER(c_void_p)
618
+    lib.TCOD_list_remove_iterator.argtypes=[c_void_p , POINTER(c_void_p)]
619
+
620
+    lib.TCOD_list_remove.restype=c_void
621
+    lib.TCOD_list_remove.argtypes=[c_void_p ,c_void_p ]
622
+
623
+    lib.TCOD_list_remove_iterator_fast.restype=POINTER(c_void_p)
624
+    lib.TCOD_list_remove_iterator_fast.argtypes=[c_void_p , POINTER(c_void_p)]
625
+
626
+    lib.TCOD_list_remove_fast.restype=c_void
627
+    lib.TCOD_list_remove_fast.argtypes=[c_void_p ,c_void_p ]
628
+
629
+    lib.TCOD_list_contains.restype=c_bool
630
+    lib.TCOD_list_contains.argtypes=[c_void_p ,c_void_p ]
631
+
632
+    lib.TCOD_list_clear.restype=c_void
633
+    lib.TCOD_list_clear.argtypes=[c_void_p ]
634
+
635
+    lib.TCOD_list_clear_and_delete.restype=c_void
636
+    lib.TCOD_list_clear_and_delete.argtypes=[c_void_p ]
637
+
638
+    lib.TCOD_list_size.restype=c_int
639
+    lib.TCOD_list_size.argtypes=[c_void_p ]
640
+
641
+    lib.TCOD_list_insert_before.restype=POINTER(c_void_p)
642
+    lib.TCOD_list_insert_before.argtypes=[c_void_p ,c_void_p,c_int]
643
+
644
+    lib.TCOD_list_is_empty.restype=c_bool
645
+    lib.TCOD_list_is_empty.argtypes=[c_void_p ]
646
+
647
+    lib.TCOD_random_get_instance.restype=c_void_p
648
+    lib.TCOD_random_get_instance.argtypes=[]
649
+
650
+    lib.TCOD_random_new.restype=c_void_p
651
+    lib.TCOD_random_new.argtypes=[c_int ]
652
+
653
+    lib.TCOD_random_save.restype=c_void_p
654
+    lib.TCOD_random_save.argtypes=[c_void_p ]
655
+
656
+    lib.TCOD_random_restore.restype=c_void
657
+    lib.TCOD_random_restore.argtypes=[c_void_p , c_void_p ]
658
+
659
+    lib.TCOD_random_new_from_seed.restype=c_void_p
660
+    lib.TCOD_random_new_from_seed.argtypes=[c_int , c_int ]
661
+
662
+    lib.TCOD_random_delete.restype=c_void
663
+    lib.TCOD_random_delete.argtypes=[c_void_p ]
664
+
665
+    lib.TCOD_random_set_distribution .restype=c_void
666
+    lib.TCOD_random_set_distribution .argtypes=[c_void_p , c_int ]
667
+
668
+    lib.TCOD_random_get_int.restype=c_int
669
+    lib.TCOD_random_get_int.argtypes=[c_void_p , c_int, c_int]
670
+
671
+    lib.TCOD_random_get_float .restype=c_float
672
+    lib.TCOD_random_get_float .argtypes=[c_void_p , c_float , c_float ]
673
+
674
+    lib.TCOD_random_get_double .restype=c_double
675
+    lib.TCOD_random_get_double .argtypes=[c_void_p , c_double , c_double ]
676
+
677
+    lib.TCOD_random_get_int_mean .restype=c_int
678
+    lib.TCOD_random_get_int_mean .argtypes=[c_void_p , c_int, c_int, c_int]
679
+
680
+    lib.TCOD_random_get_float_mean .restype=c_float
681
+    lib.TCOD_random_get_float_mean .argtypes=[c_void_p , c_float , c_float , c_float ]
682
+
683
+    lib.TCOD_random_get_double_mean .restype=c_double
684
+    lib.TCOD_random_get_double_mean .argtypes=[c_void_p , c_double , c_double , c_double ]
685
+
686
+#    lib.TCOD_random_dice_new .restype=TCOD_dice_t
687
+#    lib.TCOD_random_dice_new .argtypes=[c_char_p ]
688
+
689
+#    lib.TCOD_random_dice_roll .restype=c_int
690
+#    lib.TCOD_random_dice_roll .argtypes=[c_void_p , TCOD_dice_t ]
691
+
692
+    lib.TCOD_random_dice_roll_s .restype=c_int
693
+    lib.TCOD_random_dice_roll_s .argtypes=[c_void_p , c_char_p ]
694
+
695
+    lib.TCOD_mouse_show_cursor.restype=c_void
696
+    lib.TCOD_mouse_show_cursor.argtypes=[c_bool ]
697
+
698
+#    lib.TCOD_mouse_get_status.restype=TCOD_mouse_t
699
+#    lib.TCOD_mouse_get_status.argtypes=[]
700
+
701
+    lib.TCOD_mouse_is_cursor_visible.restype=c_bool
702
+    lib.TCOD_mouse_is_cursor_visible.argtypes=[]
703
+
704
+    lib.TCOD_mouse_move.restype=c_void
705
+    lib.TCOD_mouse_move.argtypes=[c_int, c_int]
706
+
707
+    lib.TCOD_namegen_parse .restype=c_void
708
+    lib.TCOD_namegen_parse .argtypes=[c_char_p , c_void_p ]
709
+
710
+    lib.TCOD_namegen_generate .restype=c_char_p
711
+    lib.TCOD_namegen_generate .argtypes=[c_char_p , c_bool ]
712
+
713
+    lib.TCOD_namegen_generate_custom .restype=c_char_p
714
+    lib.TCOD_namegen_generate_custom .argtypes=[c_char_p , c_char_p , c_bool ]
715
+
716
+    lib.TCOD_namegen_get_sets .restype=c_void_p
717
+    lib.TCOD_namegen_get_sets .argtypes=[]
718
+
719
+    lib.TCOD_namegen_destroy .restype=c_void
720
+    lib.TCOD_namegen_destroy .argtypes=[]
721
+
722
+    lib.TCOD_noise_new.restype=c_void_p
723
+    lib.TCOD_noise_new.argtypes=[c_int, c_float , c_float , c_void_p ]
724
+
725
+    lib.TCOD_noise_set_type .restype=c_void
726
+    lib.TCOD_noise_set_type .argtypes=[c_void_p , c_int ]
727
+
728
+    lib.TCOD_noise_get_ex .restype=c_float
729
+    lib.TCOD_noise_get_ex .argtypes=[c_void_p , POINTER(c_float), c_int ]
730
+
731
+    lib.TCOD_noise_get_fbm_ex .restype=c_float
732
+    lib.TCOD_noise_get_fbm_ex .argtypes=[c_void_p , POINTER(c_float), c_float , c_int ]
733
+
734
+    lib.TCOD_noise_get_turbulence_ex .restype=c_float
735
+    lib.TCOD_noise_get_turbulence_ex .argtypes=[c_void_p , POINTER(c_float), c_float , c_int ]
736
+
737
+    lib.TCOD_noise_get .restype=c_float
738
+    lib.TCOD_noise_get .argtypes=[c_void_p , POINTER(c_float)]
739
+
740
+    lib.TCOD_noise_get_fbm .restype=c_float
741
+    lib.TCOD_noise_get_fbm .argtypes=[c_void_p , POINTER(c_float), c_float ]
742
+
743
+    lib.TCOD_noise_get_turbulence .restype=c_float
744
+    lib.TCOD_noise_get_turbulence .argtypes=[c_void_p , POINTER(c_float), c_float ]
745
+
746
+    lib.TCOD_noise_delete.restype=c_void
747
+    lib.TCOD_noise_delete.argtypes=[c_void_p ]
748
+
749
+    lib.TCOD_struct_get_name.restype=c_char_p
750
+    lib.TCOD_struct_get_name.argtypes=[c_void_p ]
751
+
752
+    lib.TCOD_struct_add_property.restype=c_void
753
+    lib.TCOD_struct_add_property.argtypes=[c_void_p , c_char_p,c_int , c_bool ]
754
+
755
+    lib.TCOD_struct_add_list_property.restype=c_void
756
+    lib.TCOD_struct_add_list_property.argtypes=[c_void_p , c_char_p,c_int , c_bool ]
757
+
758
+    lib.TCOD_struct_add_value_list.restype=c_void
759
+    lib.TCOD_struct_add_value_list.argtypes=[c_void_p ,c_char_p, POINTER(c_char_p), c_bool ]
760
+
761
+    lib.TCOD_struct_add_value_list_sized.restype=c_void
762
+    lib.TCOD_struct_add_value_list_sized.argtypes=[c_void_p ,c_char_p, POINTER(c_char_p), c_int, c_bool ]
763
+
764
+    lib.TCOD_struct_add_flag.restype=c_void
765
+    lib.TCOD_struct_add_flag.argtypes=[c_void_p ,c_char_p]
766
+
767
+    lib.TCOD_struct_add_structure.restype=c_void
768
+    lib.TCOD_struct_add_structure.argtypes=[c_void_p ,c_void_p]
769
+
770
+    lib.TCOD_struct_is_mandatory.restype=c_bool
771
+    lib.TCOD_struct_is_mandatory.argtypes=[c_void_p ,c_char_p]
772
+
773
+    lib.TCOD_struct_get_type.restype=c_int
774
+    lib.TCOD_struct_get_type.argtypes=[c_void_p , c_char_p]
775
+
776
+    lib.TCOD_parser_new.restype=c_void_p
777
+    lib.TCOD_parser_new.argtypes=[]
778
+
779
+    lib.TCOD_parser_new_struct.restype=c_void_p
780
+    lib.TCOD_parser_new_struct.argtypes=[c_void_p , c_char_p]
781
+
782
+#    lib.TCOD_parser_new_custom_type.restype=c_int
783
+#    lib.TCOD_parser_new_custom_type.argtypes=[c_void_p ,TCOD_parser_custom_t custom_type_]
784
+
785
+    lib.TCOD_parser_run.restype=c_void
786
+    lib.TCOD_parser_run.argtypes=[c_void_p , c_char_p, c_void_p]
787
+
788
+    lib.TCOD_parser_delete.restype=c_void
789
+    lib.TCOD_parser_delete.argtypes=[c_void_p ]
790
+
791
+    lib.TCOD_parser_error.restype=c_void
792
+#    lib.TCOD_parser_error.argtypes=[c_char_p, ...]
793
+
794
+    lib.TCOD_parser_get_bool_property.restype=c_bool
795
+    lib.TCOD_parser_get_bool_property.argtypes=[c_void_p , c_char_p]
796
+
797
+    lib.TCOD_parser_get_char_property.restype=c_int
798
+    lib.TCOD_parser_get_char_property.argtypes=[c_void_p , c_char_p]
799
+
800
+    lib.TCOD_parser_get_int_property.restype=c_int
801
+    lib.TCOD_parser_get_int_property.argtypes=[c_void_p , c_char_p]
802
+
803
+    lib.TCOD_parser_get_float_property.restype=c_float
804
+    lib.TCOD_parser_get_float_property.argtypes=[c_void_p , c_char_p]
805
+
806
+    lib.TCOD_parser_get_string_property.restype=c_char_p
807
+    lib.TCOD_parser_get_string_property.argtypes=[c_void_p , c_char_p]
808
+
809
+    lib.TCOD_parser_get_color_property.restype=c_int
810
+    lib.TCOD_parser_get_color_property.argtypes=[c_void_p , c_char_p]
811
+
812
+#    lib.TCOD_parser_property.restype=TCOD_dice_t
813
+#    lib.TCOD_parser_property.argtypes=[c_void_p , c_char_p]
814
+
815
+#    lib.TCOD_parser_py.restype=c_void
816
+#    lib.TCOD_parser_py.argtypes=[c_void_p , c_char_p, c_void_p]
817
+
818
+    lib.TCOD_parser_get_custom_property.restype=c_void_p
819
+    lib.TCOD_parser_get_custom_property.argtypes=[c_void_p , c_char_p]
820
+
821
+    lib.TCOD_parser_get_list_property.restype=c_void_p
822
+    lib.TCOD_parser_get_list_property.argtypes=[c_void_p , c_char_p, c_int ]
823
+
824
+#    lib.TCOD_parse_c_bool_value.restype=TCOD_value_t
825
+#    lib.TCOD_parse_c_bool_value.argtypes=[]
826
+
827
+#    lib.TCOD_parse_char_value.restype=TCOD_value_t
828
+#    lib.TCOD_parse_char_value.argtypes=[]
829
+
830
+#    lib.TCOD_parse_integer_value.restype=TCOD_value_t
831
+#    lib.TCOD_parse_integer_value.argtypes=[]
832
+
833
+#    lib.TCOD_parse_float_value.restype=TCOD_value_t
834
+#    lib.TCOD_parse_float_value.argtypes=[]
835
+
836
+#    lib.TCOD_parse_string_value.restype=TCOD_value_t
837
+#    lib.TCOD_parse_string_value.argtypes=[]
838
+
839
+#    lib.TCOD_parse_color_value.restype=TCOD_value_t
840
+#    lib.TCOD_parse_color_value.argtypes=[]
841
+
842
+#    lib.TCOD_parse_dice_value.restype=TCOD_value_t
843
+#    lib.TCOD_parse_dice_value.argtypes=[]
844
+
845
+#    lib.TCOD_parse_value_list_value.restype=TCOD_value_t
846
+#    lib.TCOD_parse_value_list_value.argtypes=[c_void_p,c_int]
847
+
848
+#    lib.TCOD_parse_property_value.restype=TCOD_value_t
849
+#    lib.TCOD_parse_property_value.argtypes=[c_void_p, c_void_p , c_char_p, c_bool ]
850
+
851
+    lib.TCOD_path_new_using_map.restype=c_void_p
852
+    lib.TCOD_path_new_using_map.argtypes=[c_void_p , c_float ]
853
+
854
+#    lib.TCOD_path_new_using_function.restype=c_void_p
855
+#    lib.TCOD_path_new_using_function.argtypes=[c_int, c_int, TCOD_path_func_t ,c_void_p, c_float ]
856
+
857
+    lib.TCOD_path_compute.restype=c_bool
858
+    lib.TCOD_path_compute.argtypes=[c_void_p , c_int,c_int, c_int, c_int]
859
+
860
+    lib.TCOD_path_walk.restype=c_bool
861
+    lib.TCOD_path_walk.argtypes=[c_void_p , POINTER(c_int), POINTER(c_int), c_bool]
862
+
863
+    lib.TCOD_path_is_empty.restype=c_bool
864
+    lib.TCOD_path_is_empty.argtypes=[c_void_p ]
865
+
866
+    lib.TCOD_path_size.restype=c_int
867
+    lib.TCOD_path_size.argtypes=[c_void_p ]
868
+
869
+    lib.TCOD_path_reverse.restype=c_void
870
+    lib.TCOD_path_reverse.argtypes=[c_void_p ]
871
+
872
+    lib.TCOD_path_get.restype=c_void
873
+    lib.TCOD_path_get.argtypes=[c_void_p , c_int, POINTER(c_int), POINTER(c_int)]
874
+
875
+    lib.TCOD_path_get_origin.restype=c_void
876
+    lib.TCOD_path_get_origin.argtypes=[c_void_p , POINTER(c_int), POINTER(c_int)]
877
+
878
+    lib.TCOD_path_get_destination.restype=c_void
879
+    lib.TCOD_path_get_destination.argtypes=[c_void_p , POINTER(c_int), POINTER(c_int)]
880
+
881
+    lib.TCOD_path_delete.restype=c_void
882
+    lib.TCOD_path_delete.argtypes=[c_void_p ]
883
+
884
+    lib.TCOD_dijkstra_new .restype=c_void_p
885
+    lib.TCOD_dijkstra_new .argtypes=[c_void_p , c_float ]
886
+
887
+#    lib.TCOD_dijkstra_new_using_function.restype=c_void_p
888
+#    lib.TCOD_dijkstra_new_using_function.argtypes=[c_int, c_int, TCOD_path_func_t ,c_void_p, c_float ]
889
+
890
+    lib.TCOD_dijkstra_compute .restype=c_void
891
+    lib.TCOD_dijkstra_compute .argtypes=[c_void_p , c_int, c_int]
892
+
893
+    lib.TCOD_dijkstra_get_distance .restype=c_float
894
+    lib.TCOD_dijkstra_get_distance .argtypes=[c_void_p , c_int, c_int]
895
+
896
+    lib.TCOD_dijkstra_path_set .restype=c_bool
897
+    lib.TCOD_dijkstra_path_set .argtypes=[c_void_p , c_int, c_int]
898
+
899
+    lib.TCOD_dijkstra_is_empty.restype=c_bool
900
+    lib.TCOD_dijkstra_is_empty.argtypes=[c_void_p ]
901
+
902
+    lib.TCOD_dijkstra_size.restype=c_int
903
+    lib.TCOD_dijkstra_size.argtypes=[c_void_p ]
904
+
905
+    lib.TCOD_dijkstra_reverse.restype=c_void
906
+    lib.TCOD_dijkstra_reverse.argtypes=[c_void_p ]
907
+
908
+    lib.TCOD_dijkstra_get.restype=c_void
909
+    lib.TCOD_dijkstra_get.argtypes=[c_void_p , c_int, POINTER(c_int), POINTER(c_int)]
910
+
911
+    lib.TCOD_dijkstra_path_walk .restype=c_bool
912
+    lib.TCOD_dijkstra_path_walk .argtypes=[c_void_p , POINTER(c_int), POINTER(c_int)]
913
+
914
+    lib.TCOD_dijkstra_delete .restype=c_void
915
+    lib.TCOD_dijkstra_delete .argtypes=[c_void_p ]
916
+
917
+    lib.TCOD_sys_elapsed_milli.restype=c_int
918
+    lib.TCOD_sys_elapsed_milli.argtypes=[]
919
+
920
+    lib.TCOD_sys_elapsed_seconds.restype=c_float
921
+    lib.TCOD_sys_elapsed_seconds.argtypes=[]
922
+
923
+    lib.TCOD_sys_sleep_milli.restype=c_void
924
+    lib.TCOD_sys_sleep_milli.argtypes=[c_int ]
925
+
926
+    lib.TCOD_sys_save_screenshot.restype=c_void
927
+    lib.TCOD_sys_save_screenshot.argtypes=[c_char_p]
928
+
929
+    lib.TCOD_sys_force_fullscreen_resolution.restype=c_void
930
+    lib.TCOD_sys_force_fullscreen_resolution.argtypes=[c_int, c_int]
931
+
932
+    lib.TCOD_sys_set_renderer.restype=c_void
933
+    lib.TCOD_sys_set_renderer.argtypes=[c_int ]
934
+
935
+    lib.TCOD_sys_get_renderer.restype=c_int
936
+    lib.TCOD_sys_get_renderer.argtypes=[]
937
+
938
+    lib.TCOD_sys_set_fps.restype=c_void
939
+    lib.TCOD_sys_set_fps.argtypes=[c_int]
940
+
941
+    lib.TCOD_sys_get_fps.restype=c_int
942
+    lib.TCOD_sys_get_fps.argtypes=[]
943
+
944
+    lib.TCOD_sys_get_last_frame_length.restype=c_float
945
+    lib.TCOD_sys_get_last_frame_length.argtypes=[]
946
+
947
+    lib.TCOD_sys_get_current_resolution.restype=c_void
948
+    lib.TCOD_sys_get_current_resolution.argtypes=[POINTER(c_int), POINTER(c_int)]
949
+
950
+    lib.TCOD_sys_get_fullscreen_offsets.restype=c_void
951
+    lib.TCOD_sys_get_fullscreen_offsets.argtypes=[POINTER(c_int), POINTER(c_int)]
952
+
953
+    lib.TCOD_sys_update_char.restype=c_void
954
+    lib.TCOD_sys_update_char.argtypes=[c_int, c_int, c_int, c_void_p , c_int, c_int]
955
+
956
+    lib.TCOD_sys_get_char_size.restype=c_void
957
+    lib.TCOD_sys_get_char_size.argtypes=[POINTER(c_int), POINTER(c_int)]
958
+
959
+    lib.TCOD_sys_wait_for_event.restype=c_int
960
+    lib.TCOD_sys_wait_for_event.argtypes=[c_int, c_void_p, c_void_p, c_bool ]
961
+
962
+    lib.TCOD_sys_check_for_event.restype=c_int
963
+    lib.TCOD_sys_check_for_event.argtypes=[c_int, c_void_p, c_void_p]
964
+
965
+    lib.TCOD_sys_create_directory.restype=c_bool
966
+    lib.TCOD_sys_create_directory.argtypes=[c_char_p]
967
+
968
+    lib.TCOD_sys_delete_file.restype=c_bool
969
+    lib.TCOD_sys_delete_file.argtypes=[c_char_p]
970
+
971
+    lib.TCOD_sys_delete_directory.restype=c_bool
972
+    lib.TCOD_sys_delete_directory.argtypes=[c_char_p]
973
+
974
+    lib.TCOD_sys_is_directory.restype=c_bool
975
+    lib.TCOD_sys_is_directory.argtypes=[c_char_p]
976
+
977
+    lib.TCOD_sys_get_directory_content.restype=c_void_p
978
+    lib.TCOD_sys_get_directory_content.argtypes=[c_char_p, c_char_p]
979
+
980
+    lib.TCOD_sys_file_exists.restype=c_bool
981
+#    lib.TCOD_sys_file_exists.argtypes=[c_char_p , ...]
982
+
983
+    lib.TCOD_sys_clipboard_set.restype=c_void
984
+    lib.TCOD_sys_clipboard_set.argtypes=[c_char_p]
985
+
986
+    lib.TCOD_sys_clipboard_get.restype=c_char_p
987
+    lib.TCOD_sys_clipboard_get.argtypes=[]
988
+
989
+    #_lib.TCOD_thread_new.restype=TCOD_thread_t
990
+    #_lib.TCOD_thread_new.argtypes=[c_int(*func)(void_p),c_void_p]
991
+
992
+    #_lib.TCOD_thread_delete.restype=c_void
993
+    #_lib.TCOD_thread_delete.argtypes=[TCOD_thread_t ]
994
+
995
+    lib.TCOD_sys_get_num_cores.restype=c_int
996
+    lib.TCOD_sys_get_num_cores.argtypes=[]
997
+
998
+    lib.TCOD_thread_wait.restype=c_void
999
+    lib.TCOD_thread_wait.argtypes=[c_void_p ]
1000
+
1001
+    lib.TCOD_mutex_new.restype=c_void_p
1002
+    lib.TCOD_mutex_new.argtypes=[]
1003
+
1004
+    lib.TCOD_mutex_in.restype=c_void
1005
+    lib.TCOD_mutex_in.argtypes=[c_void_p ]
1006
+
1007
+    lib.TCOD_mutex_out.restype=c_void
1008
+    lib.TCOD_mutex_out.argtypes=[c_void_p ]
1009
+
1010
+    lib.TCOD_mutex_delete.restype=c_void
1011
+    lib.TCOD_mutex_delete.argtypes=[c_void_p ]
1012
+
1013
+    lib.TCOD_semaphore_new.restype=c_void_p
1014
+    lib.TCOD_semaphore_new.argtypes=[c_int]
1015
+
1016
+    lib.TCOD_semaphore_lock.restype=c_void
1017
+    lib.TCOD_semaphore_lock.argtypes=[c_void_p ]
1018
+
1019
+    lib.TCOD_semaphore_unlock.restype=c_void
1020
+    lib.TCOD_semaphore_unlock.argtypes=[c_void_p ]
1021
+
1022
+    lib.TCOD_semaphore_delete.restype=c_void
1023
+    lib.TCOD_semaphore_delete.argtypes=[ c_void_p ]
1024
+
1025
+    lib.TCOD_condition_new.restype=c_void_p
1026
+    lib.TCOD_condition_new.argtypes=[]
1027
+
1028
+    lib.TCOD_condition_signal.restype=c_void
1029
+    lib.TCOD_condition_signal.argtypes=[c_void_p ]
1030
+
1031
+    lib.TCOD_condition_broadcast.restype=c_void
1032
+    lib.TCOD_condition_broadcast.argtypes=[c_void_p ]
1033
+
1034
+    lib.TCOD_condition_wait.restype=c_void
1035
+    lib.TCOD_condition_wait.argtypes=[c_void_p , c_void_p ]
1036
+
1037
+    lib.TCOD_condition_delete.restype=c_void
1038
+    lib.TCOD_condition_delete.argtypes=[ c_void_p ]
1039
+
1040
+    #_lib.TCOD_load_library.restype=TCOD_library_t
1041
+    #_lib.TCOD_load_library.argtypes=[c_char_p]
1042
+
1043
+    #_lib.TCOD_get_function_address.restype=c_void_p
1044
+    #_lib.TCOD_get_function_address.argtypes=[TCOD_library_t , c_char_pfunction_]
1045
+
1046
+    #_lib.TCOD_close_library.restype=c_void
1047
+    #_lib.TCOD_close_library.argtypes=[TCOD_library_]
1048
+
1049
+    #_lib.TCOD_sys_register_SDL_renderer.restype=c_void
1050
+    #_lib.TCOD_sys_register_SDL_renderer.argtypes=[SDL_renderer_t ]
1051
+
1052
+    lib.TCOD_tree_new.restype=c_void_p
1053
+    lib.TCOD_tree_new.argtypes=[]
1054
+
1055
+    lib.TCOD_tree_add_son.restype=c_void
1056
+    lib.TCOD_tree_add_son.argtypes=[c_void_p, c_void_p]
1057
+
1058
+    lib.TCOD_text_init.restype=c_void_p
1059
+    lib.TCOD_text_init.argtypes=[c_int, c_int, c_int, c_int, c_int]
1060
+
1061
+    lib.TCOD_text_set_properties.restype=c_void
1062
+    lib.TCOD_text_set_properties.argtypes=[c_void_p , c_int, c_int, c_char_p , c_int]
1063
+
1064
+    lib.TCOD_text_set_colors.restype=c_void
1065
+    lib.TCOD_text_set_colors.argtypes=[c_void_p , c_int , c_int , c_float]
1066
+
1067
+    lib.TCOD_text_update.restype=c_bool
1068
+    lib.TCOD_text_update.argtypes=[c_void_p , c_int ]
1069
+
1070
+    lib.TCOD_text_render.restype=c_void
1071
+    lib.TCOD_text_render.argtypes=[c_void_p , c_void_p ]
1072
+
1073
+    lib.TCOD_text_get.restype=c_char_p
1074
+    lib.TCOD_text_get.argtypes=[c_void_p ]
1075
+
1076
+    lib.TCOD_text_reset.restype=c_void
1077
+    lib.TCOD_text_reset.argtypes=[c_void_p ]
1078
+
1079
+    lib.TCOD_text_delete.restype=c_void
1080
+    lib.TCOD_text_delete.argtypes=[c_void_p ]
1081
+
1082
+    lib.TCOD_console_fill_background.restype=c_void
1083
+    lib.TCOD_console_fill_background.argtypes=[c_void_p , POINTER(c_int), POINTER(c_int), POINTER(c_int)]
1084
+
1085
+    lib.TCOD_console_fill_foreground.restype=c_void
1086
+    lib.TCOD_console_fill_foreground.argtypes=[c_void_p , POINTER(c_int), POINTER(c_int), POINTER(c_int)]
1087
+
1088
+    lib.TCOD_console_fill_char.restype=c_void
1089
+    lib.TCOD_console_fill_char.argtypes=[c_void_p , POINTER(c_int)]
1090
+
1091
+    lib.TCOD_console_double_hline.restype=c_void
1092
+    lib.TCOD_console_double_hline.argtypes=[c_void_p ,c_int,c_int, c_int]
1093
+
1094
+    lib.TCOD_console_double_vline.restype=c_void
1095
+    lib.TCOD_console_double_vline.argtypes=[c_void_p ,c_int,c_int]
1096
+
1097
+    lib.TCOD_console_print_double_frame.restype=c_void
1098
+    lib.TCOD_console_print_double_frame.argtypes=[c_void_p ,c_int,c_int]
1099
+
1100
+    lib.TCOD_console_print_return_string.restype=c_char_p
1101
+    lib.TCOD_console_print_return_string.argtypes=[c_void_p ,c_int]
1102
+
1103
+    lib.TCOD_image_set_key_color_wrapper.restype=c_void
1104
+    lib.TCOD_image_set_key_color_wrapper.argtypes=[c_void_p ]
1105
+
1106
+    lib.TCOD_mouse_get_status_wrapper.restype=c_void
1107
+    lib.TCOD_mouse_get_status_wrapper.argtypes=[c_void_p]
1108
+
1109
+    lib.TCOD_zip_new.restype=c_void_p
1110
+    lib.TCOD_zip_new.argtypes=[]
1111
+
1112
+    lib.TCOD_zip_delete.restype=c_void
1113
+    lib.TCOD_zip_delete.argtypes=[c_void_p ]
1114
+
1115
+    lib.TCOD_zip_put_char.restype=c_void
1116
+    lib.TCOD_zip_put_char.argtypes=[c_void_p , c_char ]
1117
+
1118
+    lib.TCOD_zip_put_int.restype=c_void
1119
+    lib.TCOD_zip_put_int.argtypes=[c_void_p , c_int]
1120
+
1121
+    lib.TCOD_zip_put_float.restype=c_void
1122
+    lib.TCOD_zip_put_float.argtypes=[c_void_p , c_float ]
1123
+
1124
+    lib.TCOD_zip_put_string.restype=c_void
1125
+    lib.TCOD_zip_put_string.argtypes=[c_void_p , c_char_p]
1126
+
1127
+    lib.TCOD_zip_put_color.restype=c_void
1128
+    lib.TCOD_zip_put_color.argtypes=[c_void_p , c_int ]
1129
+
1130
+    lib.TCOD_zip_put_image.restype=c_void
1131
+    lib.TCOD_zip_put_image.argtypes=[c_void_p , c_void_p ]
1132
+
1133
+    lib.TCOD_zip_put_console.restype=c_void
1134
+    lib.TCOD_zip_put_console.argtypes=[c_void_p , c_void_p ]
1135
+
1136
+    lib.TCOD_zip_put_data.restype=c_void
1137
+    lib.TCOD_zip_put_data.argtypes=[c_void_p , c_int,c_void_p]
1138
+
1139
+    lib.TCOD_zip_get_current_bytes.restype=c_int
1140
+    lib.TCOD_zip_get_current_bytes.argtypes=[c_void_p ]
1141
+
1142
+    lib.TCOD_zip_save_to_file.restype=c_int
1143
+    lib.TCOD_zip_save_to_file.argtypes=[c_void_p , c_char_p]
1144
+
1145
+    lib.TCOD_zip_load_from_file.restype=c_int
1146
+    lib.TCOD_zip_load_from_file.argtypes=[c_void_p , c_char_p]
1147
+
1148
+    lib.TCOD_zip_get_char.restype=c_char
1149
+    lib.TCOD_zip_get_char.argtypes=[c_void_p ]
1150
+
1151
+    lib.TCOD_zip_get_int.restype=c_int
1152
+    lib.TCOD_zip_get_int.argtypes=[c_void_p ]
1153
+
1154
+    lib.TCOD_zip_get_float.restype=c_float
1155
+    lib.TCOD_zip_get_float.argtypes=[c_void_p ]
1156
+
1157
+    lib.TCOD_zip_get_string.restype=c_char_p
1158
+    lib.TCOD_zip_get_string.argtypes=[c_void_p ]
1159
+
1160
+    lib.TCOD_zip_get_color.restype=c_int
1161
+    lib.TCOD_zip_get_color.argtypes=[c_void_p ]
1162
+
1163
+    lib.TCOD_zip_get_image.restype=c_void_p
1164
+    lib.TCOD_zip_get_image.argtypes=[c_void_p ]
1165
+
1166
+    lib.TCOD_zip_get_console.restype=c_void_p
1167
+    lib.TCOD_zip_get_console.argtypes=[c_void_p ]
1168
+
1169
+    lib.TCOD_zip_get_data.restype=c_int
1170
+    lib.TCOD_zip_get_data.argtypes=[c_void_p , c_int,c_void_p]
1171
+
1172
+    lib.TCOD_zip_get_remaining_bytes.restype=c_int
1173
+    lib.TCOD_zip_get_remaining_bytes.argtypes=[c_void_p ]
1174
+
1175
+    lib.TCOD_zip_skip_bytes.restype=c_void
1176
+    lib.TCOD_zip_skip_bytes.argtypes=[c_void_p ,c_int ]
1177
+
0 1178
new file mode 100644
... ...
@@ -0,0 +1,43 @@
1
+myStruct "struct_name" {
2
+	// 
3
+	bool_field=true
4
+	char_field='Z'
5
+	int_field=24
6
+	float_field=3.14
7
+	string_field="hello"
8
+	color_field="255,128,128"
9
+	dice_field="0.5x3d5+2"
10
+	
11
+	// dynamically declared fields
12
+	bool bool_field2=false
13
+	char char_field2='@'
14
+	int int_field2=4
15
+	float float_field2=4.3
16
+	string string_field2="world"
17
+	color color_field2=#FF22CC
18
+	dice dice_field2="3d20" 
19
+	
20
+	bool_list=[true, false, true]
21
+	char_list=['a', 'b', 'z']
22
+	integer_list=[13,2,-3]
23
+	float_list=[5.0,2.0,-3.5]
24
+	string_list=["item one","time_two"]
25
+	color_list=["42,42,142","128,64,128"]
26
+//	dice_list=["3d4","2d4+2","0.75x4d6-1"]
27
+
28
+	// dynamically declared list fields
29
+	bool[] bool_list2=[true, false, true]
30
+	char[] char_list2=['a', 'b', 'z']
31
+	int[] integer_list2=[13,2,-3]
32
+	float[] float_list2=[5.0,2.0,-3.5]
33
+	string[] string_list2=["item one","time_two"]
34
+	color[] color_list2=["42,42,142","128,64,128"]
35
+	
36
+}
37
+// a completely dynamic structure (not declared at compile time)
38
+struct dynStruct {
39
+	int someVar=4
40
+	struct subStruct {
41
+		float anotherVar=4.3
42
+	}
43
+}
0 44
new file mode 100644
... ...
@@ -0,0 +1,36 @@
1
+This directory contains antialiased fonts for libtcod.
2
+These fonts are in public domain. 
3
+
4
+The file names are composed with :
5
+<font_name><font_size>_<type>_<layout>.png
6
+<type> : aa 32 bits png with alpha channel
7
+         gs 24 bits or greyscale PNG
8
+<layout> : as standard ASCII layout
9
+           ro standard ASCII layout in row
10
+           tc TCOD layout
11
+
12
+The terminal8x8 font is provided is every possible format as en example.
13
+You can try them with the provided samples :
14
+
15
+./samples_c -font fonts/terminal8x8_aa_as.png -font-nb-char 16 16
16
+./samples_c -font fonts/terminal8x8_aa_ro.png -font-nb-char 16 16 -font-in-row
17
+./samples_c -font fonts/terminal8x8_aa_tc.png -font-nb-char 32 8 -font-tcod
18
+./samples_c -font fonts/terminal8x8_gs_as.png -font-nb-char 16 16 -font-greyscale
19
+./samples_c -font fonts/terminal8x8_gs_ro.png -font-nb-char 16 16 -font-greyscale -font-in-row
20
+./samples_c -font fonts/terminal8x8_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod
21
+
22
+The libtcod 1.3.2 (non antialiased) terminal font is still there and still works :
23
+./samples_c -font terminal.png -font-nb-char 16 16
24
+
25
+All other fonts are provided only in gs_tc format (greyscale, TCOD layout).
26
+To try them :
27
+
28
+Terminal fonts with different size (you can use them as template to create new fonts) :
29
+./samples_c -font fonts/terminal7x7_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod
30
+./samples_c -font fonts/terminal10x10_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod
31
+
32
+Custom fonts :
33
+./samples_c -font fonts/caeldera8x8_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod
34
+./samples_c -font fonts/lucida8x8_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod
35
+./samples_c -font fonts/celtic_garamond_10x10_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod
36
+./samples_c -font fonts/dundalk12x12_gs_tc.png -font-nb-char 32 8 -font-greyscale -font-tcod
0 37
new file mode 100644
1 38
Binary files /dev/null and b/data/fonts/arial10x10.png differ
2 39
new file mode 100644
3 40
Binary files /dev/null and b/data/fonts/arial12x12.png differ
4 41
new file mode 100644
5 42
Binary files /dev/null and b/data/fonts/arial8x8.png differ
6 43
new file mode 100644
7 44
Binary files /dev/null and b/data/fonts/caeldera8x8_gs_tc.png differ
8 45
new file mode 100644
9 46
Binary files /dev/null and b/data/fonts/celtic_garamond_10x10_gs_tc.png differ
10 47
new file mode 100644
11 48
Binary files /dev/null and b/data/fonts/consolas10x10_gs_tc.png differ
12 49
new file mode 100644
13 50
Binary files /dev/null and b/data/fonts/consolas12x12_gs_tc.png differ
14 51
new file mode 100644
15 52
Binary files /dev/null and b/data/fonts/consolas8x8_gs_tc.png differ
16 53
new file mode 100644
17 54
Binary files /dev/null and b/data/fonts/consolas_unicode_10x10.png differ
18 55
new file mode 100644
19 56
Binary files /dev/null and b/data/fonts/consolas_unicode_12x12.png differ
20 57
new file mode 100644
21 58
Binary files /dev/null and b/data/fonts/consolas_unicode_16x16.png differ
22 59
new file mode 100644
23 60
Binary files /dev/null and b/data/fonts/consolas_unicode_8x8.png differ
24 61
new file mode 100644
25 62
Binary files /dev/null and b/data/fonts/courier10x10_aa_tc.png differ
26 63
new file mode 100644
27 64
Binary files /dev/null and b/data/fonts/courier12x12_aa_tc.png differ
28 65
new file mode 100644
29 66
Binary files /dev/null and b/data/fonts/courier8x8_aa_tc.png differ
30 67
new file mode 100644
31 68
Binary files /dev/null and b/data/fonts/dejavu10x10_gs_tc.png differ
32 69
new file mode 100644
33 70
Binary files /dev/null and b/data/fonts/dejavu12x12_gs_tc.png differ
34 71
new file mode 100644
35 72
Binary files /dev/null and b/data/fonts/dejavu16x16_gs_tc.png differ
36 73
new file mode 100644
37 74
Binary files /dev/null and b/data/fonts/dejavu8x8_gs_tc.png differ
38 75
new file mode 100644
39 76
Binary files /dev/null and b/data/fonts/dejavu_wide12x12_gs_tc.png differ
40 77
new file mode 100644
41 78
Binary files /dev/null and b/data/fonts/dejavu_wide16x16_gs_tc.png differ
42 79
new file mode 100644
43 80
Binary files /dev/null and b/data/fonts/dundalk12x12_gs_tc.png differ
44 81
new file mode 100644
45 82
Binary files /dev/null and b/data/fonts/lucida10x10_gs_tc.png differ
46 83
new file mode 100644
47 84
Binary files /dev/null and b/data/fonts/lucida12x12_gs_tc.png differ
48 85
new file mode 100644
49 86
Binary files /dev/null and b/data/fonts/lucida8x8_gs_tc.png differ
50 87
new file mode 100644
51 88
Binary files /dev/null and b/data/fonts/prestige10x10_gs_tc.png differ
52 89
new file mode 100644
53 90
Binary files /dev/null and b/data/fonts/prestige12x12_gs_tc.png differ
54 91
new file mode 100644
55 92
Binary files /dev/null and b/data/fonts/prestige8x8_gs_tc.png differ
56 93
new file mode 100644
57 94
Binary files /dev/null and b/data/fonts/terminal10x10_gs_tc.png differ
58 95
new file mode 100644
59 96
Binary files /dev/null and b/data/fonts/terminal10x16_gs_ro.png differ
60 97
new file mode 100644
61 98
Binary files /dev/null and b/data/fonts/terminal10x16_gs_tc.png differ
62 99
new file mode 100644
63 100
Binary files /dev/null and b/data/fonts/terminal10x18_gs_ro.png differ
64 101
new file mode 100644
65 102
Binary files /dev/null and b/data/fonts/terminal12x12_gs_ro.png differ
66 103
new file mode 100644
67 104
Binary files /dev/null and b/data/fonts/terminal16x16_gs_ro.png differ
68 105
new file mode 100644
69 106
Binary files /dev/null and b/data/fonts/terminal7x7_gs_tc.png differ
70 107
new file mode 100644
71 108
Binary files /dev/null and b/data/fonts/terminal8x12_gs_ro.png differ
72 109
new file mode 100644
73 110
Binary files /dev/null and b/data/fonts/terminal8x12_gs_tc.png differ
74 111
new file mode 100644
75 112
Binary files /dev/null and b/data/fonts/terminal8x14_gs_ro.png differ
76 113
new file mode 100644
77 114
Binary files /dev/null and b/data/fonts/terminal8x8_aa_as.png differ
78 115
new file mode 100644
79 116
Binary files /dev/null and b/data/fonts/terminal8x8_aa_ro.png differ
80 117
new file mode 100644
81 118
Binary files /dev/null and b/data/fonts/terminal8x8_aa_tc.png differ
82 119
new file mode 100644
83 120
Binary files /dev/null and b/data/fonts/terminal8x8_gs_as.png differ
84 121
new file mode 100644
85 122
Binary files /dev/null and b/data/fonts/terminal8x8_gs_ro.png differ
86 123
new file mode 100644
87 124
Binary files /dev/null and b/data/fonts/terminal8x8_gs_tc.png differ
88 125
new file mode 100644
89 126
Binary files /dev/null and b/data/img/circle.png differ
90 127
new file mode 100644
91 128
Binary files /dev/null and b/data/img/skull.png differ
92 129
new file mode 100644
... ...
@@ -0,0 +1,70 @@
1
+/*
2
+ * Collections of syllables and other data used for name generation.
3
+ *  
4
+ * All the strings must be enclosed between quotation marks, with no semicolon
5
+ * at the end.
6
+ * 
7
+ * SYLLABLE SETS:   
8
+ * Please use only latin characters, apostrophes and dashes for syllables. All
9
+ * other characters will be treated as separators between syllables, eg. "ish"
10
+ * and "is'h" are syllables, but "|sh" and "ish!" aren't (the erroneous
11
+ * syllables will be read as "sh" and "ish", respectively). If you wish to use
12
+ * a special character, please write it after a slash, eg. a semicolon will need
13
+ * to be written as "/;" in order to be correctly parsed. Beware: a slash at the
14
+ * end of a string will not trigger an error whatsoever, but the final syllable
15
+ * will not be added to the list at all. Spaces are a special case: they can be
16
+ * triggered either with the above method, or with a single underscore: "\ " and
17
+ * "_" are both valid and will produce a space.     
18
+ *
19
+ * PHONEME SETS:
20
+ * Phoneme sets should be single characters or digraphs. Please use lowercase
21
+ * characters only. "ch" and "tz" are valid consonants, but "Ch" or "trz" are
22
+ * not. They will be rejected upon generating phoneme lists.
23
+ * 
24
+ * RULES:
25
+ * These denote how a word is generated. A rule is a string consisting of
26
+ * normal characters [a-z,A-Z,',-], special characters preceded by a slash (see
27
+ * the notes concerning syllables), underscores to denote spaces and wildcards.
28
+ * Wildcards are preceded by a dollar sign. Here's the full list:
29
+ * "$P" - a random Pre syllable
30
+ * "$s" - a random Start syllable
31
+ * "$m" - a random Middle syllable
32
+ * "$e" - a random End syllable
33
+ * "$p" - a random Post syllable
34
+ * "$v" - a random vocal
35
+ * "$c" - a random consonant
36
+ * "$?" - a random phoneme
37
+ * So, if we hav the following data:
38
+ *   syllablesStart = "Ivan"
39
+ *   syllablesEnd = "Terrible"
40
+ *   rules = "$s_the_$e"
41
+ * the generator will output "Ivan the Terrible".
42
+ * The wildcards may also include an integer number. This number marks the per
43
+ * cent chance of actually appearing the related wildcard has. The number is
44
+ * placed after the asterisk, but before the corresponding character. For
45
+ * instance, "*50m" means "50% chance of adding a Middle syllable".      
46
+ * If multiple rules are specified, they should be separated by characters that
47
+ * are not special character or wildcard indicators. A comma is a legible
48
+ * separator.
49
+ *  A rule may be preceded by a special wildcard consisting of a per cent sign
50
+ * "%" and an integer number. This means the per cent chance of picking this
51
+ * rule should the RNG encounter it. For instance, if two rules are specified,
52
+ * each will have 50% chance of being chosen. However, if one of them is
53
+ * preceded by the "%50" sign, it will actually have a 100/2*50% = 25% chance of
54
+ * being selected (100/2 is the initial chance any single rule from a set of two
55
+ * will be picked, for five rules this would be 100/5, etc.). 
56
+ * The rules are a mandatory field. Also, any field thai it references are to be
57
+ * included as well, lest it produce errors or, in the best of cases, generate
58
+ * an empty syllable as output.                  
59
+ *   
60
+ * Don't get paranoid about controlling whether the syllables are repeated. The
61
+ * program will ignore repeated entries anyway. This applies to phonemes too.
62
+ * 
63
+ * Please make sure you have enough syllables specified to ensure variety in the
64
+ * generated names. A string with 512 characters should be sufficient in most
65
+ * cases. Anything below that is a risk of making the names predictable.
66
+ * 
67
+ * I hope this little tool is both fun and useful for you. Take care!
68
+ * 
69
+ * -Mingos                  
70
+ */
0 71
new file mode 100644
... ...
@@ -0,0 +1,15 @@
1
+//Celtic names from Jice's "The Cave"
2
+name "Celtic male" {
3
+  syllablesStart = "Aen, Agno, All, Ba, Beo, Brig, Ci, Cre, Dan, Del, Ela, Eo, En, Er, Et, In, Io, Morr, Nem, Nu, Og, Or, Ta"
4
+  syllablesMiddle = "a, ar, ba, bo, ch, d, ig"
5
+  syllablesEnd = "aid, ain, an, and, th, ed, eth, gus, lam, lor, man, od, t, thach"
6
+  rules = "$s$m$e, $s$e"
7
+}
8
+
9
+name "Celtic female" {
10
+  syllablesStart = "Aen, Agno, All, Ba, Beo, Brig, Ci, Cre, Dan, Del, Ela, Eo, En, Er, Et, In, Io, Morr, Nem, Nu, Og, Or, Ta"
11
+  syllablesMiddle = "a, ar, ba, bo, ch, d, ig"
12
+  syllablesEnd = "ai, an, da, id, iu, ma, me, na, ne, tha"
13
+  rules = "$s$m$e, $s$e"
14
+}
15
+
0 16
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+//Fantasy names from Jice's "The Cave"
2
+name "Fantasy male" {
3
+  syllablesStart = "Aer, An, Ar, Ban, Bar, Ber, Beth, Bett, Cut, Dan, Dar, Dell, Der, Edr, Er, Eth, Ett, Fin, Ian, Iarr, Ill, Jed, Kan, Kar, Ker, Kurr, Kyr, Man, Mar, Mer, Mir, Tsal, Tser, Tsir, Van, Var, Yur, Yyr"
4
+  syllablesMiddle = "al, an, ar, el, en, ess, ian, onn, or"
5
+  syllablesEnd = "ai, an, ar, ath, en, eo, ian, is, u, or"
6
+  illegal = "orar, arrar"
7
+  rules = "$s$m$e, $s$e"
8
+}
9
+
10
+name "Fantasy female" {
11
+  syllablesStart = "Aer, An, Ar, Ban, Bar, Ber, Beth, Bett, Cut, Dan, Dar, Dell, Der, Edr, Er, Eth, Ett, Fin, Ian, Iarr, Ill, Jed, Kan, Kar, Ker, Kurr, Kyr, Man, Mar, Mer, Mir, Tsal, Tser, Tsir, Van, Var, Yur, Yyr"
12
+  syllablesMiddle = "al, an, ar, el, en, ess, ian, onn, or"
13
+  syllablesEnd = "a, ae, aelle, ai, ea, i, ia, u, wen, wyn"
14
+  illegal = "arrar"
15
+  rules = "$s$m$e, $s$e"
16
+}
17
+
0 18
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+//Mesopotamian names from Jice's "The Cave"
2
+name "Mesopotamian male" {
3
+  syllablesStart = "A, Ann, Ash, E', En, Er, Gil, In, Ir, Ish, Mar, Ni, Nin, Re, Ti, Ur"
4
+  syllablesMiddle = "am, an, du, esh, gam, gir, ka, ki, li, un, ur, ta"
5
+  syllablesEnd = "aki, al, ar, at, du, eph, esh, il, im, ki, nu, uk, ur, uz"
6
+  illegal = "aa, e'e"
7
+  rules = "$s$m$e, $s$e"
8
+}
9
+
10
+name "Mesopotamian female" {
11
+  syllablesStart = "A, Ann, Ash, E', En, Er, Gil, In, Ir, Ish, Mar, Ni, Nin, Re, Ti, Ur"
12
+  syllablesMiddle = "am, an, du, esh, gam, gir, ka, ki, li, un, ur, ta"
13
+  syllablesEnd = "ag, il, la, na, sag, su, ta"
14
+  illegal = "aa, e'e"
15
+  rules = "$s$m$e, $s$e"
16
+}
17
+
0 18
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+//Norse names from Jice's "The Cave"
2
+name "Norse male" {
3
+  syllablesStart = "Al, Ae, As, Bi, Fen, Ha, Hag, Ho, Hu, Iv, Jot, Ma, Mio, Mu, Nid, Ors, Ra, Sta, Svar, Tys, Vae, Van, Vol, Y, Ygg"
4
+  syllablesMiddle = "an, ar, ba, da, dra, gar, na, tal"
5
+  syllablesEnd = "ad, ald, agr, ar, ard, eyr, far, frost, heim, hogg, in, mir, nar, nir, or, osk, rir, sil, sir, ttir, urd"
6
+  illegal = "yor, yar, yad, yin"
7
+  rules = "$s$m$e, $s$e"
8
+}
9
+
10
+name "Norse female" {
11
+  syllablesStart = "Al, Ae, As, Bi, Fen, Ha, Hag, Ho, Hu, Iv, Jot, Ma, Mio, Mu, Nid, Ors, Ra, Sta, Svar, Tys, Vae, Van, Vol, Y, Ygg"
12
+  syllablesMiddle = "an, ar, ba, da, dra, gar, na, tal"
13
+  syllablesEnd = "a, la, li, va"
14
+  illegal = "raa, ya, aea, aea"
15
+  rules = "$s$m$e, $s$e"
16
+}
17
+
0 18
new file mode 100644
... ...
@@ -0,0 +1,7 @@
1
+//Region names from Jice's "The Cave"
2
+name "region" {
3
+  syllablesStart = "Act, Afr, Ag, Agr, Alb, Am, An, Angl, Ant, As, Asys, Asis, At, Atl, Brund, Cath, Cor, Dan, Eb, Eg, Er, Esc, Esp, Est, Eth, Eur, Flor, It, Lyr, Mal, Mir, Myr, Nor, Pel, Rom, Seg, Sib, Sylv, Terr, Tir, Tr, Tyr, Xan"
4
+  syllablesMiddle = "ad, ag, al, an, and, ant, anth, ar, ard, as, at, atr, eg, en, ent, ern, et, ian, in, itr, on, op, ov, ur, ymn, yr"
5
+  syllablesEnd = "a, aia, ana, as, ea, ene, eos, esia, ia, iad, ias, is, ium, ius, on, ona, or, ova, um, us, ya"
6
+  rules = "$s$m$e, $s$e"
7
+}
0 8
new file mode 100644
... ...
@@ -0,0 +1,6 @@
1
+//Town names from Jice's "The Cave"
2
+name "town" {
3
+  syllablesStart = "Ael, Ash, Barrow, Bel, Black, Clear, Cold, Crystal, Deep, Edge, Falcon, Fair, Fall, Glass, Gold, Ice, Iron, Mill, Moon, Mor, Ray, Red, Rock, Rose, Shadow, Silver, Spell, Spring, Stone, Strong, Summer, Swyn, Wester, Winter"
4
+  syllablesEnd = "ash, burn, barrow, bridge, castle, cliff, coast, crest, dale, dell, dor, fall, field, ford, fort, gate, haven, hill, hold, hollow, iron, lake, marsh, mill, mist, mount, moor, pond, shade, shore, summer, town, wick"
5
+  rules = "$s$e"
6
+}
0 7
new file mode 100644
... ...
@@ -0,0 +1,16 @@
1
+//Demon names
2
+name "demon male" {
3
+  phonemesVocals = "a, e, i, o, u"
4
+  syllablesStart = "Aam, Ab, Ad, Ahr, Alas, Al-A'w, All, Al-M, Ap, As, Ast, Az, Bal, Bal S, Bag, Balb, Ban, Bansh, Baph, Barb, Bath, Bazt, Be'L, Beel, Beelz, Bel, Belph, Ber, Bh, Bifr, Biul, Bush, Caac, Cagn, Caim, Chalk, Char, Chem, Coal, Dag, Dant, Decer, Demog, Dev, Dj, Dragh, Elig, Emp, Errt, Etr, Ett, Eur, Euryn, Gorg, Graph, Grig, Haag, Halph, Haur, Hoeth, Ifr, Inc, Ibl, Ith, Kabh, Kas, Kokb', Kray, Lab, Lam, Lech, Leg, Lil, Lioth, Lix, Luc, Mal, Malph, Mamm, March, Mast, Math, Meph, Merm, Mol, Murm, Naam, Naph, Nek, Neph, Neq, Nix, Noud, Onom, Onos, Orc, Orob, Oul, Paim, Phen, Pont, Proc, Rah, Rak, Raksh, Ram, Rang, Raum, Raz, Rimm, Rub, Rus, Sabn, Salps, Sam, Sat, Sc, Scarm, Seer, Sem, Set, Shait, Shax, Shed, Shez, Sidr, Sitr, Sth, Succ, Surg, Tann, Tart, Tch, Teer, Thamm, Thub, Tlal, Tsab, Val, Vap, Vass, Vep, Verr, Vin, Vol, Vual, Xaph, Xiph, Xitr, Zaeb, Zim, Ziz, Zaln"
5
+	syllablesMiddle = "b'ae, ba, be, chi, dra, du, ga, ghi, go, lia, ma, mba, mu, n'e, na, nti, nzu, phe, pho, r'e, rba, rgo, ssa, thi, tryu, ttu, tzi, v-e, vna, xra, ya"
6
+	syllablesEnd = "b'ael, bel, bub, bur, bus, ces, chus, dai, ddon, des, dhaka, el, fer, flas, gion, gon, gor, klet, kor, ksha, kuth, laas, lech, les, lion, lith, loch, lsu, mael, math, mejes, meus, mon, moth, mmut, mosh, nai, nar, neus, nex, nias, nnin, nomos, phas, r'el, raal, rept, res, rgon, riax, rith, rius, rous, rus, ruth, sias, stor, swath, tath, than, the, thra, tryus, tura, vart, ztuk"
7
+  rules = "$s$v$35m$10m$e"
8
+}
9
+
10
+name "demon female" {
11
+  phonemesVocals = "a, e, i, o, u"
12
+  syllablesStart = "Aam, Ab, Ad, Ahr, Alas, Al-A'w, All, Al-M, Ap, As, Ast, Az, Bal, Bal S, Bag, Balb, Ban, Bansh, Baph, Barb, Bath, Bazt, Be'L, Beel, Beelz, Bel, Belph, Ber, Bh, Bifr, Biul, Bush, Caac, Cagn, Caim, Chalk, Char, Chem, Coal, Dag, Dant, Decer, Demog, Dev, Dj, Dragh, Elig, Emp, Errt, Etr, Ett, Eur, Euryn, Gorg, Graph, Grig, Haag, Halph, Haur, Hoeth, Ifr, Inc, Ibl, Ith, Kabh, Kas, Kokb', Kray, Lab, Lam, Lech, Leg, Lil, Lioth, Lix, Luc, Mal, Malph, Mamm, March, Mast, Math, Meph, Merm, Mol, Murm, Naam, Naph, Nek, Neph, Neq, Nix, Noud, Onom, Onos, Orc, Orob, Oul, Paim, Phen, Pont, Proc, Rah, Rak, Raksh, Ram, Rang, Raum, Raz, Rimm, Rub, Rus, Sabn, Salps, Sam, Sat, Sc, Scarm, Seer, Sem, Set, Shait, Shax, Shed, Shez, Sidr, Sitr, Sth, Succ, Surg, Tann, Tart, Tch, Teer, Thamm, Thub, Tlal, Tsab, Val, Vap, Vass, Vep, Verr, Vin, Vol, Vual, Xaph, Xiph, Xitr, Zaeb, Zim, Ziz, Zaln"
13
+	syllablesMiddle = "b'ae, ba, be, chi, dra, du, ga, ghi, go, lia, ma, mba, mu, n'e, na, nti, nzu, phe, pho, r'e, rba, rgo, ssa, thi, tryu, ttu, tzi, v-e, vna, xra, ya"
14
+	syllablesEnd = "b'a, bel, bua, bure, buth, cess, chia, dai, ddea, dea, dhaka, el, fea, fla, gia, goa, gora, klath, kore, ksha, kua, laal, lexa, less, lia, lith, loth, lsa, mara, math, maja, mea, moa, moth, mmuth, mosh, na, nai, neuth, nex, nia, nnine, nomoa, pha, r'el, raala, repte, reshe, rgona, riaxe, rith, rish, rothe, rushe, ruth, sia, stora, swath, tath, thann, the, thra, trya, tura, varte, ztura"
15
+  rules = "$s$v$35m$10m$e"
16
+}
0 17
new file mode 100644
... ...
@@ -0,0 +1,29 @@
1
+//dwarf names
2
+name "dwarf male" {
3
+  syllablesStart = "A, An, Ba, Bi, Bo, Bom, Da, Dar, De, Do, Du, Due, Duer, Dwa, Fa, Fal, Fi, Fre, Fun, Ga, Gar, Gim, Glo, Go, Gom, Gro, Gwar, Ib, Jor, Ka, Ki, Kil, Lo, Mar, Na, Nal, O, Ras, Ren, Ro, Ta, Tar, Tel, Thi, Tho, Thon, Thra, Tor, Von, We, Wer, Yen, Yur"
4
+  syllablesEnd = "bil, bin, bur, char, den, dir, dur, fri, fur, in, li, lin, mil, mur, ni, nur, ran, ri, ril, rimm, rin, thur, tri, ulf, un, ur, vi, vil, vim, vin, vri"
5
+  rules = "$s$e"
6
+  illegal = "rur, ueu"
7
+}
8
+
9
+name "dwarf female" {
10
+  syllablesStart = "A, An, Ba, Bi, Bo, Bom, Da, Dar, De, Do, Du, Due, Duer, Dwa, Fa, Fal, Fi, Fre, Fun, Ga, Gar, Gim, Glo, Go, Gom, Gro, Gwar, Ib, Jor, Ka, Ki, Kil, Lo, Mar, Na, Nal, O, Ras, Ren, Ro, Ta, Tar, Tel, Thi, Tho, Thon, Thra, Tor, Von, We, Wer, Yen, Yur"
11
+  syllablesEnd = "al, ali, ba, bida, bra, da, deth, di, fra, gret, hild, iess, kala, la, laani, li, lona, ma, mae, mala, na, nuda, ra, ta, tala, tu, tuna, vada, vara, ya"
12
+  rules = "$s$e"
13
+  illegal = "dueal, frefra, grogret"
14
+}
15
+
16
+//surnames have semantic information. Here, they're separated into three
17
+//somewhat coherent sets and either is chosen
18
+name "dwarf surname" {
19
+  //1st set - smith & Mr.Muscle surnames
20
+  syllablesPre = "Boulder, Bronze, Coal, Copper, Gem, Granite, Hammer, Iron, Marble, Metal, Rock, Steel, Stone, Thunder"
21
+  syllablesPost = "bender, breaker, carver, club, crusher, cutter, digger, fist, foot, forger, heart, smasher, smith"
22
+  //2nd set - warrior surnames
23
+  syllablesStart = "Bear, Boar, Dragon, Giant, Goblin, Elf, Ettin, Foe, Kobold, Ogre, Orc,Spider, Troll, Wolf"
24
+  syllablesEnd = "bane, basher, _Battler, _Beheader, boxer, _Butcher, choker, cleaver, crusher, cutter, doom, eater, _Executioner, _Fighter, _Garrotter, grapple, _Gutter, hammer, killer, mauler, masher, ripper, slasher, slayer, slicer, smasher, _Strangler, striker, _Wrestler"
25
+  //3rd set - heroic and general
26
+  phonemesVocals = "Black, Blood, Bronze, Fire, Firm, Grey, Hard, Ice, Iron, Moon, Oak, Onyx, Red, Steel, Stone, Strong, Thunder, White"
27
+  phonemesConsonants = "axe, beard, blade, brand, cheek, fist, foot, hair, hammer, hand, head, heart, pick, shield, spear, spike, sword"
28
+  rules = "$P$p, $s$e, $v$c"
29
+}
0 30
\ No newline at end of file
1 31
new file mode 100644
... ...
@@ -0,0 +1,19 @@
1
+//Norse names. Most of them are syllables extracted from names that
2
+//actually appear in Norse written texts. Norse names consist of two parts,
3
+//which is easy to reflect in a generator such as this one.
4
+name "Mingos Norse male" {
5
+  //these are ready-made names
6
+  syllablesPre = "Aunn, Bjoern, Bjolfr, Bjorr, Boltr, Byulfr, Erik, Erpr, Eykr, Feitr, Fotr, Froekn, Gaukr, Gauss, Gils, Gimp, Griss, Gyi, Haegwin, Haengr, Hakon, Hand, Harekr, Hattr, Haukr, Helf, Hjalli, Hjaerne, Hjarrandi, Hnaki, Hneitr, Hrafn, Jarl, Karl, Kar-Toki, Kaun, Kilfisr, Kiuli, Knut, Knutr, Krakr, Leifr, Lokki, Manni, Mar, Moegr, Naemr, Nagli, Nef-Bjoern, Njall, Oelfun, Oenn, Oern, Rafn, Roki, Skjalf, Skog, Spjall, Sveinn, Tannr, Trani, Trjonn, Utryggr, Vagn, Varg, Ve-Finnr, Voettr, Vragi, Vrai"
7
+  //and these are syllables to stick together
8
+  syllablesStart = "Ab, Adal, Adi, Alf, An, And, Ans, Arn, Arm, Ask, Au, Audh, Ba, Bae, Bag, Bal, Bar, Bas, Bein, Berg, Bern, Bjad, Bjarn, Bjart, Boan, Boed, Boerk, Bogg, Bor, Bot, Bram, Bran, Bratt, Brei, Bro, Brunn, Bukk, Dag, Djur, Dor, Duf, Dun, Ed, Ei, Ein, Ekk, Ey, Fa, Fad, Fal, Far, Fast, Fen, Finn, Fjall, Fjoel, Flae, Fol, Folk, Foest, Frey, Frid, Frost, Ful, Fuld, Gaes, Geir, Gag, Gal, Gam, Gar, Gaut, Geir, Ginn, Gis, Gjaf, Gjal, God, Gnaudi, Gny, Gret, Grim, Grom, Grum, Gud, Gull, Gunn, Gutt, Gyll, Gyr, Ha, Haf, Hag, Hagn, Half, Hall, Ham, Har, Haur, Hedin, Hef, Heg, Heil, Hein, Hel, Hildi, Hjall, Hjalm, Hjoer, Hlif, Hloed, Hoeg, Hoegg, Hoer, Hoes, Hol, Holm, Hord, Horn, Hrad, Hrafn, Hring, Hroeng, Hross, Hug, Hul, Hum, Hus, Hvit, Hyr, Igul, Illu, In, Ingi, Is, Ja, Jar, Jarn, Jat, Jo, Joefur, Kjoet, Kol, Kon, Lamb, Lids, Lik, Ljot, Lyd, Nadd, Nef, Odal, Odd, Oeg, Oel, Oen, Oeng, Oes, Rad, Rafn, Ragn, Rask, Reid, Reyr, Roegn, Rok, Run, Sae, Sig, Skae, Skjald, Skjoeld, Skol, Slag, Snae, Soel, Soend, Spjall, Stafn, Stark, Stein, Stig, Stod, Stygg, Styr, Sunn, Svein, Svart, Svarta, Tid, Tindr, Tjoer, Trygg, Tyr, Thyr, Ud, Ulf, Yngv, Vae, Val, Varg, Ve, Ved, Vest, Vetr, Vid, Vig, Vik"
9
+  syllablesEnd = "adr, afr, all, andi, arfr, arr, astr, autr, bi, beinn, bert, bjoern, bodi, bodr, bori, brandr, burinn, burt, daenni, dan, di, din, diarfr, dinn, dr, dridr, dur, eifr, eirr, fast, fasti, fastr, fidr, fill, fing, fingr, finnr, fli, fri, frimr, fuss, gall, geir, geirr, gils, gir, gisl, glir, glumr, grimr, gripr, gur, guri, haldr, hegn, hjalmr, hjoefr, hjofr, hoefdi, hoess, hofdi, horir, horr, hoess, hvatr, ilir, ill, ingr, inn, jadr, jarn, jarr, jartan, jartr, joern, jofr, karl, kell, ketill, kirr, kuldr, kull, kundr, kunnr, laugr, lan, leifr, leikr, li, lidi, lidr, lingr, madr, maer, mann, marr, mingr, modr, mr, mund, mundr, nall, narr, nefr, nir, niutr, olfr, ormr, phorr, pli, r, raeifr, radr, rik, rikr, ring, rinn, rir, roedr, rudr, rukr, si, sir, skegg, skeggi, sjall, steinn, styrr, sur, tir, tyr, utr, ulf, ulfr, undr, ungr, urd, urdr, valdr, vandi, vandill, veinr, ver, vett, vi, vidr, vifr, vind, vindr, vi, vini, vir, visl"
10
+  rules = "$s$e, %10$P"
11
+  illegal = "bjarnbj, gp, vv, aea, aee, aeo, drd"
12
+}
13
+
14
+name "Mingos Norse female" {
15
+  syllablesStart = "A, Aer, Aerin, Aes, Aet, Afri, Agaer, Ager, Al, Alf, Alm, Arinn, Arn, As, Au, Aud, Bau, Be, Beg, Berg, Bir, Bjol, Bod, Bol, Bor, Borg, Bot, Bri, Brun, Bryn, Bus, Dag, Dis, Dom, Dor, Dot, Dri, Dyr, Ed, Ei, Em, Emb, Engil, Er, Es, Ev, Ey, Fal, Fast, Fin, Fjol, Fjor, Fjot, Folk, Frey, Frid, Frost, Gaut, Geir, Ger, Gil, Ginn, Gis, Gjaf, Gre, Grim, Gud, Gy, Gyd, Haf, Hall, Haur, Hedin, Heil, Heim, Hel, Her, Hidin, Hil, Hildi, Hjalm, Hjor, Hlad, Hlif, Holm, Hrim, Hrod, Hun, Igul, In, Ingi, Ingil, Is, Jar, Jo, Jofur, Jor, Jut, Ljuf, Lofn, Mal, Malm, Mar, Mat, Matt, Mund, Nid, Odd, Ol, Olm, Ot, Rad, Ragn, Rand, Rann, Regin, Run, Sal, Sae, Sig, Skjald, Sol, Stein, Svan, Svein, Tid, Ulf, Vet, Val, Ve, Vig, Vil, Yng"
16
+  syllablesEnd = "bjorg, borg, da, dis, disa, disla, dora, eida, erna, fasta, finna, frida, frosta, fura, ga, gard, gauta, geid, gerda, gida, gret, grid, grima, gudr, gunn, gunna, heidr, hilda, ja, la, laug, lina, linn, ma, maer, rida, run, ta, trid, trida, truda, unn, ve, velda, vi, vilda, vina"
17
+  illegal = "ii, iei, edeid, tg, ee, vev"
18
+  rules = "$s$e"
19
+}
0 20
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+//Names based on syllables from J.R.R. Tolkien's and David Eddings' novels.
2
+name "male" {
3
+  phonemesVocals = "a, e, i, o, u, y"
4
+  phonemesConsonants = "b, c, ch, ck, cz, d, dh, f, g, gh, h, j, k, kh, l, m, n, p, ph, q, r, rh, s, sh, t, th, ts, tz, v, w, x, z, zh"
5
+  syllablesStart = "Aer, Al, Am, An, Ar, Arm, Arth, B, Bal, Bar, Be, Bel, Ber, Bok, Bor, Bran, Breg, Bren, Brod, Cam, Chal, Cham, Ch, Cuth, Dag, Daim, Dair, Del, Dr, Dur, Duv, Ear, Elen, Er, Erel, Erem, Fal, Ful, Gal, G, Get, Gil, Gor, Grin, Gun, H, Hal, Han, Har, Hath, Hett, Hur, Iss, Khel, K, Kor, Lel, Lor, M, Mal, Man, Mard, N, Ol, Radh, Rag, Relg, Rh, Run, Sam, Tarr, T, Tor, Tul, Tur, Ul, Ulf, Unr, Ur, Urth, Yar, Z, Zan, Zer"
6
+  syllablesMiddle = "de, do, dra, du, duna, ga, go, hara, kaltho, la, latha, le, ma, nari, ra, re, rego, ro, rodda, romi, rui, sa, to, ya, zila"
7
+  syllablesEnd = "bar, bers, blek, chak, chik, dan, dar, das, dig, dil, din, dir, dor, dur, fang, fast, gar, gas, gen, gorn, grim, gund, had, hek, hell, hir, hor, kan, kath, khad, kor, lach, lar, ldil, ldir, leg, len, lin, mas, mnir, ndil, ndur, neg, nik, ntir, rab, rach, rain, rak, ran, rand, rath, rek, rig, rim, rin, rion, sin, sta, stir, sus, tar, thad, thel, tir, von, vor, yon, zor"
8
+  rules = "$s$v$35m$10m$e"
9
+}
10
+
11
+name "female" {
12
+  phonemesVocals = "a, e, i, o, u, y"
13
+  syllablesStart = "Ad, Aer, Ar, Bel, Bet, Beth, Ce'N, Cyr, Eilin, El, Em, Emel, G, Gl, Glor, Is, Isl, Iv, Lay, Lis, May, Ner, Pol, Por, Sal, Sil, Vel, Vor, X, Xan, Xer, Yv, Zub"
14
+  syllablesMiddle = "bre, da, dhe, ga, lda, le, lra, mi, ra, ri, ria, re, se, ya"
15
+  syllablesEnd = "ba, beth, da, kira, laith, lle, ma, mina, mira, na, nn, nne, nor, ra, rin, ssra, ta, th, tha, thra, tira, tta, vea, vena, we, wen, wyn"
16
+  rules = "$s$v$35m$10m$e"
17
+}
0 18
new file mode 100644
... ...
@@ -0,0 +1,9 @@
1
+//Town names. The town name construction is based on real British town names,
2
+//although many starting syllables are made up.
3
+name "Mingos town" {
4
+  syllablesPre = "East, Fort, Great, High, Lower, Middle, Mount, New, North, Old, Royal, Saint, South, Upper, West"
5
+  syllablesStart = "Ales, Apple, Ash, Bald, Bay, Bed, Bell, Birdling, Black, Blue, Bow, Bran, Brass, Bright, Brown, Bruns, Bulls, Camp, Cherry, Clark, Clarks, Clay, Clear, Copper, Corn, Cross, Crystal, Dark, Deep, Deer, Drac, Eagle, Earth, Elk, Elles, Elm, Ester, Ewes, Fair, Falcon, Ferry, Fire, Fleet, Fox, Gold, Grand, Green, Grey, Guild, Hammer, Hart, Hawks, Hay, Haze, Hazel, Hemlock, Ice, Iron, Kent, Kings, Knox, Layne, Lint, Lor, Mable, Maple, Marble, Mare, Marsh, Mist, Mor, Mud, Nor, Oak, Orms, Ox, Oxen, Pear, Pine, Pitts, Port, Purple, Red, Rich, Roch, Rock, Rose, Ross, Rye, Salis, Salt, Shadow, Silver, Skeg, Smith, Snow, Sows, Spring, Spruce, Staff, Star, Steel, Still, Stock, Stone, Strong, Summer, Swan, Swine, Sword, Yellow, Val, Wart, Water, Well, Wheat, White, Wild, Winter, Wolf, Wool, Wor"
6
+  syllablesEnd = "bank, borne, borough, brook, burg, burgh, bury, castle, cester, cliff, crest, croft, dale, dam, dorf, edge, field, ford, gate, grad, hall, ham, hollow, holm, hurst, keep, kirk, land, ley, lyn, mere, mill, minster, mont, moor, mouth, ness, pool, river, shire, shore, side, stead, stoke, ston, thorpe, ton, town, vale, ville, way, wich, wick, wood, worth"
7
+  syllablesPost = "Annex, Barrens, Barrow, Corner, Cove, Crossing, Dell, Dales, Estates, Forest, Furnace, Grove, Haven, Heath, Hill, Junction, Landing, Meadow, Park, Plain, Point, Reserve, Retreat, Ridge, Springs, View, Village, Wells, Woods"
8
+  rules = "$15P_$s$e_$15p"
9
+}
1 11
new file mode 100644
... ...
@@ -0,0 +1,74 @@
1
+import src.console
2
+import collections
3
+
4
+class MessageBox(object):
5
+	def __init__(self, console, num, pos, event=None):
6
+		self.console = console
7
+		self.pos = x,y = pos
8
+		self.messages = collections.deque([], num)
9
+		self.maxlen = -float('inf')
10
+		if event is not None:
11
+			import src.events
12
+			src.events.EventHandler().handle_event(event, self.msg)
13
+
14
+	def msg(self, msg, *a):
15
+		msg %= a
16
+		self.messages.append(msg)
17
+		self.maxlen = max(self.maxlen, len(msg))
18
+		x,y = self.pos
19
+		for idx, msg in enumerate(self.messages):
20
+			self.console.print_( (x,y+idx), msg.ljust(self.maxlen) )
21
+		return False
22
+
23
+class TextBox(object):
24
+	def __init__(self, console, num, pos, event=None):
25
+		self.console = console
26
+		self.pos = x,y = pos
27
+		self.lines = [''] * num
28
+		self.maxlen = -float('inf')
29
+		if event is not None:
30
+			import src.events
31
+			src.events.EventHandler().handle_event(event, self.set_line)
32
+
33
+	def set_line(self, line, msg, *a):
34
+		msg = msg % a
35
+		self.maxlen = max(self.maxlen, len(msg))
36
+		self.lines[line] = msg
37
+		x,y = self.pos
38
+		self.console.print_( (x,y+line), msg.ljust(self.maxlen) )
39
+		return False
40
+
41
+class Label(object):
42
+	def __init__(self, console, pos, event=None):
43
+		self.console = console
44
+		self.pos = x,y = pos
45
+		self.line = ''
46
+		self.maxlen = -float('inf')
47
+		if event is not None:
48
+			import src.events
49
+			src.events.EventHandler().handle_event(event, self.set_text)
50
+	def set_text(self, msg, *a):
51
+		msg = msg % a
52
+		self.maxlen = max(self.maxlen, len(msg))
53
+		self.line = msg
54
+		x,y = self.pos
55
+		self.console.print_( (x,y), msg.ljust(self.maxlen) )
56
+		return False
57
+
58
+class Array2DDisplay(object):
59
+	def __init__(self, console, pos, event=None):
60
+		self.console = console
61
+		self.pos = x,y = pos
62
+		self.maxlen = -float('inf')
63
+		self.array = None
64
+		if event is not None:
65
+			import src.events
66
+			src.events.EventHandler().handle_event(event, self.update)
67
+	def associate(self, arr):
68
+		self.array = arr
69
+		return self
70
+	def update(self):
71
+		ox,oy = self.pos
72
+		for x, row in enumerate(self.array):
73
+			for y, cell in enumerate(row):
74
+				self.console.print_( (ox+x,oy+y), str(cell) )
0 75
new file mode 100755
1 76
Binary files /dev/null and b/libtcod.dylib differ
2 77
new file mode 100755
3 78
Binary files /dev/null and b/libtcodgui.dylib differ
4 79
new file mode 100644
... ...
@@ -0,0 +1,1973 @@
1
+#
2
+# libtcod 1.5.2 python wrapper
3
+# Copyright (c) 2008,2009,2010 Jice & Mingos
4
+# All rights reserved.
5
+#
6
+# Redistribution and use in source and binary forms, with or without
7
+# modification, are permitted provided that the following conditions are met:
8
+#     * Redistributions of source code must retain the above copyright
9
+#       notice, this list of conditions and the following disclaimer.
10
+#     * Redistributions in binary form must reproduce the above copyright
11
+#       notice, this list of conditions and the following disclaimer in the
12
+#       documentation and/or other materials provided with the distribution.
13
+#     * The name of Jice or Mingos may not be used to endorse or promote products
14
+#       derived from this software without specific prior written permission.
15
+#
16
+# THIS SOFTWARE IS PROVIDED BY JICE AND MINGOS ``AS IS'' AND ANY
17
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+# DISCLAIMED. IN NO EVENT SHALL JICE OR MINGOS BE LIABLE FOR ANY
20
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+#
27
+
28
+import sys
29
+import ctypes
30
+import struct
31
+from ctypes import *
32
+
33
+if not hasattr(ctypes, "c_bool"):   # for Python < 2.6
34
+    c_bool = c_uint8
35
+
36
+try:  #import NumPy if available
37
+    import numpy
38
+    numpy_available = True
39
+except ImportError:
40
+    numpy_available = False
41
+
42
+LINUX=False
43
+MAC=False
44
+MINGW=False
45
+MSVC=False
46
+if sys.platform.find('linux') != -1:
47
+    _lib = ctypes.cdll['./libtcod.so']
48
+    LINUX=True
49
+elif sys.platform.find('darwin') != -1:
50
+    _lib = ctypes.cdll['./libtcod.dylib']
51
+    MAC = True
52
+elif sys.platform.find('haiku') != -1:
53
+    _lib = ctypes.cdll['./libtcod.so']
54
+    HAIKU = True
55
+else:
56
+    try:
57
+        _lib = ctypes.cdll['./libtcod-mingw.dll']
58
+        MINGW=True
59
+    except WindowsError:
60
+        _lib = ctypes.cdll['./libtcod-VS.dll']
61
+        MSVC=True
62
+    # On Windows, ctypes doesn't work well with function returning structs,
63
+    # so we have to user the _wrapper functions instead
64
+    _lib.TCOD_color_multiply = _lib.TCOD_color_multiply_wrapper
65
+    _lib.TCOD_color_add = _lib.TCOD_color_add_wrapper
66
+    _lib.TCOD_color_multiply_scalar = _lib.TCOD_color_multiply_scalar_wrapper
67
+    _lib.TCOD_color_subtract = _lib.TCOD_color_subtract_wrapper
68
+    _lib.TCOD_color_lerp = _lib.TCOD_color_lerp_wrapper
69
+    _lib.TCOD_console_get_default_background = _lib.TCOD_console_get_default_background_wrapper
70
+    _lib.TCOD_console_get_default_foreground = _lib.TCOD_console_get_default_foreground_wrapper
71
+    _lib.TCOD_console_get_char_background = _lib.TCOD_console_get_char_background_wrapper
72
+    _lib.TCOD_console_get_char_foreground = _lib.TCOD_console_get_char_foreground_wrapper
73
+    _lib.TCOD_console_get_fading_color = _lib.TCOD_console_get_fading_color_wrapper
74
+    _lib.TCOD_image_get_pixel = _lib.TCOD_image_get_pixel_wrapper
75
+    _lib.TCOD_image_get_mipmap_pixel = _lib.TCOD_image_get_mipmap_pixel_wrapper
76
+    _lib.TCOD_parser_get_color_property = _lib.TCOD_parser_get_color_property_wrapper
77
+
78
+HEXVERSION = 0x010502
79
+STRVERSION = "1.5.2"
80
+TECHVERSION = 0x01050200
81
+
82
+############################
83
+# color module
84
+############################
85
+class Color(Structure):
86
+    _fields_ = [('r', c_uint8),
87
+                ('g', c_uint8),
88
+                ('b', c_uint8),
89
+                ]
90
+
91
+    def __eq__(self, c):
92
+        return _lib.TCOD_color_equals(self, c)
93
+
94
+    def __mul__(self, c):
95
+        if isinstance(c,Color):
96
+            return _lib.TCOD_color_multiply(self, c)
97
+        else:
98
+            return _lib.TCOD_color_multiply_scalar(self, c_float(c))
99
+
100
+    def __add__(self, c):
101
+        return _lib.TCOD_color_add(self, c)
102
+
103
+    def __sub__(self, c):
104
+        return _lib.TCOD_color_subtract(self, c)
105
+
106
+    def __repr__(self):
107
+        return "Color(%d,%d,%d)" % (self.r, self.g, self.b)
108
+
109
+    def __getitem__(self, i):
110
+        if type(i) == str:
111
+            return getattr(self, i)
112
+        else:
113
+            return getattr(self, "rgb"[i])
114
+
115
+    def __setitem__(self, i, c):
116
+        if type(i) == str:
117
+            setattr(self, i, c)
118
+        else:
119
+            setattr(self, "rgb"[i], c)
120
+
121
+    def __iter__(self):
122
+        yield self.r
123
+        yield self.g
124
+        yield self.b
125
+
126
+# Should be valid on any platform, check it!  Has to be done after Color is defined.
127
+if MAC:
128
+    from cprotos import setup_protos
129
+    setup_protos(_lib)
130
+
131
+_lib.TCOD_color_equals.restype = c_bool
132
+_lib.TCOD_color_multiply.restype = Color
133
+_lib.TCOD_color_multiply_scalar.restype = Color
134
+_lib.TCOD_color_add.restype = Color
135
+_lib.TCOD_color_subtract.restype = Color
136
+
137
+# default colors
138
+# grey levels
139
+black=Color(0,0,0)
140
+darkest_grey=Color(31,31,31)
141
+darker_grey=Color(63,63,63)
142
+dark_grey=Color(95,95,95)
143
+grey=Color(127,127,127)
144
+light_grey=Color(159,159,159)
145
+lighter_grey=Color(191,191,191)
146
+lightest_grey=Color(223,223,223)
147
+darkest_gray=Color(31,31,31)
148
+darker_gray=Color(63,63,63)
149
+dark_gray=Color(95,95,95)
150
+gray=Color(127,127,127)
151
+light_gray=Color(159,159,159)
152
+lighter_gray=Color(191,191,191)
153
+lightest_gray=Color(223,223,223)
154
+white=Color(255,255,255)
155
+
156
+# sepia
157
+darkest_sepia=Color(31,24,15)
158
+darker_sepia=Color(63,50,31)
159
+dark_sepia=Color(94,75,47)
160
+sepia=Color(127,101,63)
161
+light_sepia=Color(158,134,100)
162
+lighter_sepia=Color(191,171,143)
163
+lightest_sepia=Color(222,211,195)
164
+
165
+#standard colors
166
+red=Color(255,0,0)
167
+flame=Color(255,63,0)
168
+orange=Color(255,127,0)
169
+amber=Color(255,191,0)
170
+yellow=Color(255,255,0)
171
+lime=Color(191,255,0)
172
+chartreuse=Color(127,255,0)
173
+green=Color(0,255,0)
174
+sea=Color(0,255,127)
175
+turquoise=Color(0,255,191)
176
+cyan=Color(0,255,255)
177
+sky=Color(0,191,255)
178
+azure=Color(0,127,255)
179
+blue=Color(0,0,255)
180
+han=Color(63,0,255)
181
+violet=Color(127,0,255)
182
+purple=Color(191,0,255)
183
+fuchsia=Color(255,0,255)
184
+magenta=Color(255,0,191)
185
+pink=Color(255,0,127)
186
+crimson=Color(255,0,63)
187
+
188
+# dark colors
189
+dark_red=Color(191,0,0)
190
+dark_flame=Color(191,47,0)
191
+dark_orange=Color(191,95,0)
192
+dark_amber=Color(191,143,0)
193
+dark_yellow=Color(191,191,0)
194
+dark_lime=Color(143,191,0)
195
+dark_chartreuse=Color(95,191,0)
196
+dark_green=Color(0,191,0)
197
+dark_sea=Color(0,191,95)
198
+dark_turquoise=Color(0,191,143)
199
+dark_cyan=Color(0,191,191)
200
+dark_sky=Color(0,143,191)
201
+dark_azure=Color(0,95,191)
202
+dark_blue=Color(0,0,191)
203
+dark_han=Color(47,0,191)
204
+dark_violet=Color(95,0,191)
205
+dark_purple=Color(143,0,191)
206
+dark_fuchsia=Color(191,0,191)
207
+dark_magenta=Color(191,0,143)
208
+dark_pink=Color(191,0,95)
209
+dark_crimson=Color(191,0,47)
210
+
211
+# darker colors
212
+darker_red=Color(127,0,0)
213
+darker_flame=Color(127,31,0)
214
+darker_orange=Color(127,63,0)
215
+darker_amber=Color(127,95,0)
216
+darker_yellow=Color(127,127,0)
217
+darker_lime=Color(95,127,0)
218
+darker_chartreuse=Color(63,127,0)
219
+darker_green=Color(0,127,0)
220
+darker_sea=Color(0,127,63)
221
+darker_turquoise=Color(0,127,95)
222
+darker_cyan=Color(0,127,127)
223
+darker_sky=Color(0,95,127)
224
+darker_azure=Color(0,63,127)
225
+darker_blue=Color(0,0,127)
226
+darker_han=Color(31,0,127)
227
+darker_violet=Color(63,0,127)
228
+darker_purple=Color(95,0,127)
229
+darker_fuchsia=Color(127,0,127)
230
+darker_magenta=Color(127,0,95)
231
+darker_pink=Color(127,0,63)
232
+darker_crimson=Color(127,0,31)
233
+
234
+# darkest colors
235
+darkest_red=Color(63,0,0)
236
+darkest_flame=Color(63,15,0)
237
+darkest_orange=Color(63,31,0)
238
+darkest_amber=Color(63,47,0)
239
+darkest_yellow=Color(63,63,0)
240
+darkest_lime=Color(47,63,0)
241
+darkest_chartreuse=Color(31,63,0)
242
+darkest_green=Color(0,63,0)
243
+darkest_sea=Color(0,63,31)
244
+darkest_turquoise=Color(0,63,47)
245
+darkest_cyan=Color(0,63,63)
246
+darkest_sky=Color(0,47,63)
247
+darkest_azure=Color(0,31,63)
248
+darkest_blue=Color(0,0,63)
249
+darkest_han=Color(15,0,63)
250
+darkest_violet=Color(31,0,63)
251
+darkest_purple=Color(47,0,63)
252
+darkest_fuchsia=Color(63,0,63)
253
+darkest_magenta=Color(63,0,47)
254
+darkest_pink=Color(63,0,31)
255
+darkest_crimson=Color(63,0,15)
256
+
257
+# light colors
258
+light_red=Color(255,114,114)
259
+light_flame=Color(255,149,114)
260
+light_orange=Color(255,184,114)
261
+light_amber=Color(255,219,114)
262
+light_yellow=Color(255,255,114)
263
+light_lime=Color(219,255,114)
264
+light_chartreuse=Color(184,255,114)
265
+light_green=Color(114,255,114)
266
+light_sea=Color(114,255,184)
267
+light_turquoise=Color(114,255,219)
268
+light_cyan=Color(114,255,255)
269
+light_sky=Color(114,219,255)
270
+light_azure=Color(114,184,255)
271
+light_blue=Color(114,114,255)
272
+light_han=Color(149,114,255)
273
+light_violet=Color(184,114,255)
274
+light_purple=Color(219,114,255)
275
+light_fuchsia=Color(255,114,255)
276
+light_magenta=Color(255,114,219)
277
+light_pink=Color(255,114,184)
278
+light_crimson=Color(255,114,149)
279
+
280
+#lighter colors
281
+lighter_red=Color(255,165,165)
282
+lighter_flame=Color(255,188,165)
283
+lighter_orange=Color(255,210,165)
284
+lighter_amber=Color(255,232,165)
285
+lighter_yellow=Color(255,255,165)
286
+lighter_lime=Color(232,255,165)
287
+lighter_chartreuse=Color(210,255,165)
288
+lighter_green=Color(165,255,165)
289
+lighter_sea=Color(165,255,210)
290
+lighter_turquoise=Color(165,255,232)
291
+lighter_cyan=Color(165,255,255)
292
+lighter_sky=Color(165,232,255)
293
+lighter_azure=Color(165,210,255)
294
+lighter_blue=Color(165,165,255)
295
+lighter_han=Color(188,165,255)
296
+lighter_violet=Color(210,165,255)
297
+lighter_purple=Color(232,165,255)
298
+lighter_fuchsia=Color(255,165,255)
299
+lighter_magenta=Color(255,165,232)
300
+lighter_pink=Color(255,165,210)
301
+lighter_crimson=Color(255,165,188)
302
+
303
+# lightest colors
304
+lightest_red=Color(255,191,191)
305
+lightest_flame=Color(255,207,191)
306
+lightest_orange=Color(255,223,191)
307
+lightest_amber=Color(255,239,191)
308
+lightest_yellow=Color(255,255,191)
309
+lightest_lime=Color(239,255,191)
310
+lightest_chartreuse=Color(223,255,191)
311
+lightest_green=Color(191,255,191)
312
+lightest_sea=Color(191,255,223)
313
+lightest_turquoise=Color(191,255,239)
314
+lightest_cyan=Color(191,255,255)
315
+lightest_sky=Color(191,239,255)
316
+lightest_azure=Color(191,223,255)
317
+lightest_blue=Color(191,191,255)
318
+lightest_han=Color(207,191,255)
319
+lightest_violet=Color(223,191,255)
320
+lightest_purple=Color(239,191,255)
321
+lightest_fuchsia=Color(255,191,255)
322
+lightest_magenta=Color(255,191,239)
323
+lightest_pink=Color(255,191,223)
324
+lightest_crimson=Color(255,191,207)
325
+
326
+# desaturated colors
327
+desaturated_red=Color(127,63,63)
328
+desaturated_flame=Color(127,79,63)
329
+desaturated_orange=Color(127,95,63)
330
+desaturated_amber=Color(127,111,63)
331
+desaturated_yellow=Color(127,127,63)
332
+desaturated_lime=Color(111,127,63)
333
+desaturated_chartreuse=Color(95,127,63)
334
+desaturated_green=Color(63,127,63)
335
+desaturated_sea=Color(63,127,95)
336
+desaturated_turquoise=Color(63,127,111)
337
+desaturated_cyan=Color(63,127,127)
338
+desaturated_sky=Color(63,111,127)
339
+desaturated_azure=Color(63,95,127)
340
+desaturated_blue=Color(63,63,127)
341
+desaturated_han=Color(79,63,127)
342
+desaturated_violet=Color(95,63,127)
343
+desaturated_purple=Color(111,63,127)
344
+desaturated_fuchsia=Color(127,63,127)
345
+desaturated_magenta=Color(127,63,111)
346
+desaturated_pink=Color(127,63,95)
347
+desaturated_crimson=Color(127,63,79)
348
+
349
+# metallic
350
+brass=Color(191,151,96)
351
+copper=Color(197,136,124)
352
+gold=Color(229,191,0)
353
+silver=Color(203,203,203)
354
+
355
+# miscellaneous
356
+celadon=Color(172,255,175)
357
+peach=Color(255,159,127)
358
+
359
+# color functions
360
+_lib.TCOD_color_lerp.restype = Color
361
+def color_lerp(c1, c2, a):
362
+    return _lib.TCOD_color_lerp(c1, c2, c_float(a))
363
+
364
+def color_set_hsv(c, h, s, v):
365
+    _lib.TCOD_color_set_HSV(byref(c), c_float(h), c_float(s), c_float(v))
366
+
367
+def color_get_hsv(c):
368
+    h = c_float()
369
+    s = c_float()
370
+    v = c_float()
371
+    _lib.TCOD_color_get_HSV(c, byref(h), byref(s), byref(v))
372
+    return h.value, s.value, v.value
373
+
374
+def color_scale_HSV(c, scoef, vcoef) :
375
+    _lib.TCOD_color_scale_HSV(byref(c),c_float(scoef),c_float(vcoef))
376
+
377
+def color_gen_map(colors, indexes):
378
+    ccolors = (Color * len(colors))(*colors)
379
+    cindexes = (c_int * len(indexes))(*indexes)
380
+    cres = (Color * (max(indexes) + 1))()
381
+    _lib.TCOD_color_gen_map(cres, len(colors), ccolors, cindexes)
382
+    return cres
383
+
384
+############################
385
+# console module
386
+############################
387
+class Key(Structure):
388
+    _fields_=[('vk', c_int),
389
+              ('c', c_uint8),
390
+              ('pressed', c_bool),
391
+              ('lalt', c_bool),
392
+              ('lctrl', c_bool),
393
+              ('ralt', c_bool),
394
+              ('rctrl', c_bool),
395
+              ('shift', c_bool),
396
+              ]
397
+
398
+class ConsoleBuffer:
399
+    # simple console that allows direct (fast) access to cells. simplifies
400
+    # use of the "fill" functions.
401
+    def __init__(self, width, height, back_r=0, back_g=0, back_b=0, fore_r=0, fore_g=0, fore_b=0, char=' '):
402
+        # initialize with given width and height. values to fill the buffer
403
+        # are optional, defaults to black with no characters.
404
+        n = width * height
405
+        self.width = width
406
+        self.height = height
407
+        self.clear(back_r, back_g, back_b, fore_r, fore_g, fore_b, char)
408
+
409
+    def clear(self, back_r=0, back_g=0, back_b=0, fore_r=0, fore_g=0, fore_b=0, char=' '):
410
+        # clears the console. values to fill it with are optional, defaults
411
+        # to black with no characters.
412
+        n = self.width * self.height
413
+        self.back_r = [back_r] * n
414
+        self.back_g = [back_g] * n
415
+        self.back_b = [back_b] * n
416
+        self.fore_r = [fore_r] * n
417
+        self.fore_g = [fore_g] * n
418
+        self.fore_b = [fore_b] * n
419
+        self.char = [ord(char)] * n
420
+    
421
+    def copy(self):
422
+        # returns a copy of this ConsoleBuffer.
423
+        other = ConsoleBuffer(0, 0)
424
+        other.width = self.width
425
+        other.height = self.height
426
+        other.back_r = list(self.back_r)  # make explicit copies of all lists
427
+        other.back_g = list(self.back_g)
428
+        other.back_b = list(self.back_b)
429
+        other.fore_r = list(self.fore_r)
430
+        other.fore_g = list(self.fore_g)
431
+        other.fore_b = list(self.fore_b)
432
+        other.char = list(self.char)
433
+        return other
434
+    
435
+    def set_fore(self, x, y, r, g, b, char):
436
+        # set the character and foreground color of one cell.
437
+        i = self.width * y + x
438
+        self.fore_r[i] = r
439
+        self.fore_g[i] = g
440
+        self.fore_b[i] = b
441
+        self.char[i] = ord(char)
442
+    
443
+    def set_back(self, x, y, r, g, b):
444
+        # set the background color of one cell.
445
+        i = self.width * y + x
446
+        self.back_r[i] = r
447
+        self.back_g[i] = g
448
+        self.back_b[i] = b
449
+    
450
+    def set(self, x, y, back_r, back_g, back_b, fore_r, fore_g, fore_b, char):
451
+        # set the background color, foreground color and character of one cell.
452
+        i = self.width * y + x
453
+        self.back_r[i] = back_r
454
+        self.back_g[i] = back_g
455
+        self.back_b[i] = back_b
456
+        self.fore_r[i] = fore_r
457
+        self.fore_g[i] = fore_g
458
+        self.fore_b[i] = fore_b
459
+        self.char[i] = ord(char)
460
+    
461
+    def blit(self, dest, fill_fore=True, fill_back=True):
462
+        # use libtcod's "fill" functions to write the buffer to a console.
463
+        if (console_get_width(dest) != self.width or
464
+            console_get_height(dest) != self.height):
465
+            raise ValueError('ConsoleBuffer.blit: Destination console has an incorrect size.')
466
+
467
+        s = struct.Struct('%di' % len(self.back_r))
468
+
469
+        if fill_back:
470
+            _lib.TCOD_console_fill_background(dest, (c_int * len(self.back_r))(*self.back_r), (c_int * len(self.back_g))(*self.back_g), (c_int * len(self.back_b))(*self.back_b))
471
+
472
+        if fill_fore:
473
+            _lib.TCOD_console_fill_foreground(dest, (c_int * len(self.fore_r))(*self.fore_r), (c_int * len(self.fore_g))(*self.fore_g), (c_int * len(self.fore_b))(*self.fore_b))
474
+            _lib.TCOD_console_fill_char(dest, (c_int * len(self.char))(*self.char))
475
+
476
+_lib.TCOD_console_credits_render.restype = c_bool
477
+_lib.TCOD_console_is_fullscreen.restype = c_bool
478
+_lib.TCOD_console_is_window_closed.restype = c_bool
479
+_lib.TCOD_console_has_mouse_focus.restype = c_bool
480
+_lib.TCOD_console_is_active.restype = c_bool
481
+_lib.TCOD_console_get_default_background.restype = Color
482
+_lib.TCOD_console_get_default_foreground.restype = Color
483
+_lib.TCOD_console_get_char_background.restype = Color
484
+_lib.TCOD_console_get_char_foreground.restype = Color
485
+_lib.TCOD_console_get_fading_color.restype = Color
486
+_lib.TCOD_console_is_key_pressed.restype = c_bool
487
+
488
+# background rendering modes
489
+BKGND_NONE = 0
490
+BKGND_SET = 1
491
+BKGND_MULTIPLY = 2
492
+BKGND_LIGHTEN = 3
493
+BKGND_DARKEN = 4
494
+BKGND_SCREEN = 5
495
+BKGND_COLOR_DODGE = 6
496
+BKGND_COLOR_BURN = 7
497
+BKGND_ADD = 8
498
+BKGND_ADDA = 9
499
+BKGND_BURN = 10
500
+BKGND_OVERLAY = 11
501
+BKGND_ALPH = 12
502
+BKGND_DEFAULT=13
503
+
504
+def BKGND_ALPHA(a):
505
+    return BKGND_ALPH | (int(a * 255) << 8)
506
+
507
+def BKGND_ADDALPHA(a):
508
+    return BKGND_ADDA | (int(a * 255) << 8)
509
+
510
+# non blocking key events types
511
+KEY_PRESSED = 1
512
+KEY_RELEASED = 2
513
+# key codes
514
+KEY_NONE = 0
515
+KEY_ESCAPE = 1
516
+KEY_BACKSPACE = 2
517
+KEY_TAB = 3
518
+KEY_ENTER = 4
519
+KEY_SHIFT = 5
520
+KEY_CONTROL = 6
521
+KEY_ALT = 7
522
+KEY_PAUSE = 8
523
+KEY_CAPSLOCK = 9
524
+KEY_PAGEUP = 10
525
+KEY_PAGEDOWN = 11
526
+KEY_END = 12
527
+KEY_HOME = 13
528
+KEY_UP = 14
529
+KEY_LEFT = 15
530
+KEY_RIGHT = 16
531
+KEY_DOWN = 17
532
+KEY_PRINTSCREEN = 18
533
+KEY_INSERT = 19
534
+KEY_DELETE = 20
535
+KEY_LWIN = 21
536
+KEY_RWIN = 22
537
+KEY_APPS = 23
538
+KEY_0 = 24
539
+KEY_1 = 25
540
+KEY_2 = 26
541
+KEY_3 = 27
542
+KEY_4 = 28
543
+KEY_5 = 29
544
+KEY_6 = 30
545
+KEY_7 = 31
546
+KEY_8 = 32
547
+KEY_9 = 33
548
+KEY_KP0 = 34
549
+KEY_KP1 = 35
550
+KEY_KP2 = 36
551
+KEY_KP3 = 37
552
+KEY_KP4 = 38
553
+KEY_KP5 = 39
554
+KEY_KP6 = 40
555
+KEY_KP7 = 41
556
+KEY_KP8 = 42
557
+KEY_KP9 = 43
558
+KEY_KPADD = 44
559
+KEY_KPSUB = 45
560
+KEY_KPDIV = 46
561
+KEY_KPMUL = 47
562
+KEY_KPDEC = 48
563
+KEY_KPENTER = 49
564
+KEY_F1 = 50
565
+KEY_F2 = 51
566
+KEY_F3 = 52
567
+KEY_F4 = 53
568
+KEY_F5 = 54
569
+KEY_F6 = 55
570
+KEY_F7 = 56
571
+KEY_F8 = 57
572
+KEY_F9 = 58
573
+KEY_F10 = 59
574
+KEY_F11 = 60
575
+KEY_F12 = 61
576
+KEY_NUMLOCK = 62
577
+KEY_SCROLLLOCK = 63
578
+KEY_SPACE = 64
579
+KEY_CHAR = 65
580
+# special chars
581
+# single walls
582
+CHAR_HLINE = 196
583
+CHAR_VLINE = 179
584
+CHAR_NE = 191
585
+CHAR_NW = 218
586
+CHAR_SE = 217
587
+CHAR_SW = 192
588
+CHAR_TEEW = 180
589
+CHAR_TEEE = 195
590
+CHAR_TEEN = 193
591
+CHAR_TEES = 194
592
+CHAR_CROSS = 197
593
+# double walls
594
+CHAR_DHLINE = 205
595
+CHAR_DVLINE = 186
596
+CHAR_DNE = 187
597
+CHAR_DNW = 201
598
+CHAR_DSE = 188
599
+CHAR_DSW = 200
600
+CHAR_DTEEW = 185
601
+CHAR_DTEEE = 204
602
+CHAR_DTEEN = 202
603
+CHAR_DTEES = 203
604
+CHAR_DCROSS = 206
605
+# blocks
606
+CHAR_BLOCK1 = 176
607
+CHAR_BLOCK2 = 177
608
+CHAR_BLOCK3 = 178
609
+# arrows
610
+CHAR_ARROW_N = 24
611
+CHAR_ARROW_S = 25
612
+CHAR_ARROW_E = 26
613
+CHAR_ARROW_W = 27
614
+# arrows without tail
615
+CHAR_ARROW2_N = 30
616
+CHAR_ARROW2_S = 31
617
+CHAR_ARROW2_E = 16
618
+CHAR_ARROW2_W = 17
619
+# double arrows
620
+CHAR_DARROW_H = 29
621
+CHAR_DARROW_V = 18
622
+# GUI stuff
623
+CHAR_CHECKBOX_UNSET = 224
624
+CHAR_CHECKBOX_SET = 225
625
+CHAR_RADIO_UNSET = 9
626
+CHAR_RADIO_SET = 10
627
+# sub-pixel resolution kit
628
+CHAR_SUBP_NW = 226
629
+CHAR_SUBP_NE = 227
630
+CHAR_SUBP_N = 228
631
+CHAR_SUBP_SE = 229
632
+CHAR_SUBP_DIAG = 230
633
+CHAR_SUBP_E = 231
634
+CHAR_SUBP_SW = 232
635
+# misc characters
636
+CHAR_BULLET = 7
637
+CHAR_BULLET_INV = 8
638
+CHAR_BULLET_SQUARE = 254
639
+CHAR_CENT = 189
640
+CHAR_CLUB = 5
641
+CHAR_COPYRIGHT = 184
642
+CHAR_CURRENCY = 207
643
+CHAR_DIAMOND = 4
644
+CHAR_DIVISION = 246
645
+CHAR_EXCLAM_DOUBLE = 19
646
+CHAR_FEMALE = 12
647
+CHAR_FUNCTION = 159
648
+CHAR_GRADE = 248
649
+CHAR_HALF = 171
650
+CHAR_HEART = 3
651
+CHAR_LIGHT = 15
652
+CHAR_MALE = 11
653
+CHAR_MULTIPLICATION = 158
654
+CHAR_NOTE = 13
655
+CHAR_NOTE_DOUBLE = 14
656
+CHAR_ONE_QUARTER = 172
657
+CHAR_PILCROW = 20
658
+CHAR_POUND = 156
659
+CHAR_POW1 = 251
660
+CHAR_POW2 = 253
661
+CHAR_POW3 = 252
662
+CHAR_RESERVED = 169
663
+CHAR_SECTION = 21
664
+CHAR_SMILIE = 1
665
+CHAR_SMILIE_INV = 2
666
+CHAR_SPADE = 6
667
+CHAR_THREE_QUARTERS = 243
668
+CHAR_UMLAUT = 249
669
+CHAR_YEN = 190
670
+# font flags
671
+FONT_LAYOUT_ASCII_INCOL = 1
672
+FONT_LAYOUT_ASCII_INROW = 2
673
+FONT_TYPE_GREYSCALE = 4
674
+FONT_TYPE_GRAYSCALE = 4
675
+FONT_LAYOUT_TCOD = 8
676
+# color control codes
677
+COLCTRL_1=1
678
+COLCTRL_2=2
679
+COLCTRL_3=3
680
+COLCTRL_4=4
681
+COLCTRL_5=5
682
+COLCTRL_NUMBER=5
683
+COLCTRL_FORE_RGB=6
684
+COLCTRL_BACK_RGB=7
685
+COLCTRL_STOP=8
686
+# renderers
687
+RENDERER_GLSL=0
688
+RENDERER_OPENGL=1
689
+RENDERER_SDL=2
690
+NB_RENDERERS=3
691
+# alignment
692
+LEFT=0
693
+RIGHT=1
694
+CENTER=2
695
+# initializing the console
696
+def console_init_root(w, h, title, fullscreen=False, renderer=RENDERER_SDL):
697
+    _lib.TCOD_console_init_root(w, h, c_char_p(title), fullscreen, renderer)
698
+
699
+def console_get_width(con):
700
+    return _lib.TCOD_console_get_width(con)
701
+
702
+def console_get_height(con):
703
+    return _lib.TCOD_console_get_height(con)
704
+
705
+def console_set_custom_font(fontFile, flags=FONT_LAYOUT_ASCII_INCOL, nb_char_horiz=0, nb_char_vertic=0):
706
+    _lib.TCOD_console_set_custom_font(c_char_p(fontFile), flags, nb_char_horiz, nb_char_vertic)
707
+
708
+def console_map_ascii_code_to_font(asciiCode, fontCharX, fontCharY):
709
+    if type(asciiCode) == str or type(asciiCode) == bytes:
710
+        _lib.TCOD_console_map_ascii_code_to_font(ord(asciiCode), fontCharX,
711
+                                                 fontCharY)
712
+    else:
713
+        _lib.TCOD_console_map_ascii_code_to_font(asciiCode, fontCharX,
714
+                                                 fontCharY)
715
+
716
+def console_map_ascii_codes_to_font(firstAsciiCode, nbCodes, fontCharX,
717
+                                    fontCharY):
718
+    if type(firstAsciiCode) == str or type(firstAsciiCode) == bytes:
719
+        _lib.TCOD_console_map_ascii_codes_to_font(ord(firstAsciiCode), nbCodes,
720
+                                                  fontCharX, fontCharY)
721
+    else:
722
+        _lib.TCOD_console_map_ascii_codes_to_font(firstAsciiCode, nbCodes,
723
+                                                  fontCharX, fontCharY)
724
+
725
+def console_map_string_to_font(s, fontCharX, fontCharY):
726
+    if type(s) == bytes:
727
+        _lib.TCOD_console_map_string_to_font(s, fontCharX, fontCharY)
728
+    else:
729
+        _lib.TCOD_console_map_string_to_font_utf(s, fontCharX, fontCharY)
730
+
731
+def console_is_fullscreen():
732
+    return _lib.TCOD_console_is_fullscreen()
733
+
734
+def console_set_fullscreen(fullscreen):
735
+    _lib.TCOD_console_set_fullscreen(c_int(fullscreen))
736
+
737
+def console_is_window_closed():
738
+    return _lib.TCOD_console_is_window_closed()
739
+
740
+def console_has_mouse_focus():
741
+    return _lib.TCOD_console_has_mouse_focus()
742
+
743
+def console_is_active():
744
+    return _lib.TCOD_console_is_active()
745
+
746
+def console_set_window_title(title):
747
+    _lib.TCOD_console_set_window_title(c_char_p(title))
748
+
749
+def console_credits():
750
+    _lib.TCOD_console_credits()
751
+
752
+def console_credits_reset():
753
+    _lib.TCOD_console_credits_reset()
754
+
755
+def console_credits_render(x, y, alpha):
756
+    return _lib.TCOD_console_credits_render(x, y, c_int(alpha))
757
+
758
+def console_flush():
759
+    _lib.TCOD_console_flush()
760
+
761
+# drawing on a console
762
+def console_set_default_background(con, col):
763
+    _lib.TCOD_console_set_default_background(con, col)
764
+
765
+def console_set_default_foreground(con, col):
766
+    _lib.TCOD_console_set_default_foreground(con, col)
767
+
768
+def console_clear(con):
769
+    return _lib.TCOD_console_clear(con)
770
+
771
+def console_put_char(con, x, y, c, flag=BKGND_DEFAULT):
772
+    if type(c) == str or type(c) == bytes:
773
+        _lib.TCOD_console_put_char(con, x, y, ord(c), flag)
774
+    else:
775
+        _lib.TCOD_console_put_char(con, x, y, c, flag)
776
+
777
+def console_put_char_ex(con, x, y, c, fore, back):
778
+    if type(c) == str or type(c) == bytes:
779
+        _lib.TCOD_console_put_char_ex(con, x, y, ord(c), fore, back)
780
+    else:
781
+        _lib.TCOD_console_put_char_ex(con, x, y, c, fore, back)
782
+
783
+def console_set_char_background(con, x, y, col, flag=BKGND_SET):
784
+    _lib.TCOD_console_set_char_background(con, x, y, col, flag)
785
+
786
+def console_set_char_foreground(con, x, y, col):
787
+    _lib.TCOD_console_set_char_foreground(con, x, y, col)
788
+
789
+def console_set_char(con, x, y, c):
790
+    if type(c) == str or type(c) == bytes:
791
+        _lib.TCOD_console_set_char(con, x, y, ord(c))
792
+    else:
793
+        _lib.TCOD_console_set_char(con, x, y, c)
794
+
795
+def console_set_background_flag(con, flag):
796
+    _lib.TCOD_console_set_background_flag(con, c_int(flag))
797
+
798
+def console_get_background_flag(con):
799
+    return _lib.TCOD_console_get_background_flag(con)
800
+
801
+def console_set_alignment(con, alignment):
802
+    _lib.TCOD_console_set_alignment(con, c_int(alignment))
803
+
804
+def console_get_alignment(con):
805
+    return _lib.TCOD_console_get_alignment(con)
806
+
807
+def console_print(con, x, y, fmt):
808
+    if type(fmt) == bytes:
809
+        _lib.TCOD_console_print(c_void_p(con), x, y, c_char_p(fmt))
810
+    else:
811
+        _lib.TCOD_console_print_utf(c_void_p(con), x, y, fmt)
812
+
813
+def console_print_ex(con, x, y, flag, alignment, fmt):
814
+    if type(fmt) == bytes:
815
+        _lib.TCOD_console_print_ex(c_void_p(con), x, y, flag, alignment, c_char_p(fmt))
816
+    else:
817
+        _lib.TCOD_console_print_ex_utf(c_void_p(con), x, y, flag, alignment, fmt)
818
+
819
+def console_print_rect(con, x, y, w, h, fmt):
820
+    if type(fmt) == bytes:
821
+        return _lib.TCOD_console_print_rect(c_void_p(con), x, y, w, h, c_char_p(fmt))
822
+    else:
823
+        return _lib.TCOD_console_print_rect_utf(c_void_p(con), x, y, w, h, fmt)
824
+
825
+def console_print_rect_ex(con, x, y, w, h, flag, alignment, fmt):
826
+    if type(fmt) == bytes:
827
+        return _lib.TCOD_console_print_rect_ex(c_void_p(con), x, y, w, h, flag, alignment, c_char_p(fmt))
828
+    else:
829
+        return _lib.TCOD_console_print_rect_ex_utf(c_void_p(con), x, y, w, h, flag, alignment, fmt)
830
+
831
+def console_get_height_rect(con, x, y, w, h, fmt):
832
+    if type(fmt) == bytes:
833
+        return _lib.TCOD_console_get_height_rect(c_void_p(con), x, y, w, h, c_char_p(fmt))
834
+    else:
835
+        return _lib.TCOD_console_get_height_rect_utf(c_void_p(con), x, y, w, h, fmt)
836
+
837
+def console_rect(con, x, y, w, h, clr, flag=BKGND_DEFAULT):
838
+    _lib.TCOD_console_rect(con, x, y, w, h, c_int(clr), flag)
839
+
840
+def console_hline(con, x, y, l, flag=BKGND_DEFAULT):
841
+    _lib.TCOD_console_hline( con, x, y, l, flag)
842
+
843
+def console_vline(con, x, y, l, flag=BKGND_DEFAULT):
844
+    _lib.TCOD_console_vline( con, x, y, l, flag)
845
+
846
+def console_print_frame(con, x, y, w, h, clear=True, flag=BKGND_DEFAULT, fmt=0):
847
+    _lib.TCOD_console_print_frame(c_void_p(con), x, y, w, h, c_int(clear), flag, c_char_p(fmt))
848
+
849
+def console_set_color_control(con,fore,back) :
850
+    _lib.TCOD_console_set_color_control(con,fore,back)
851
+
852
+def console_get_default_background(con):
853
+    return _lib.TCOD_console_get_default_background(con)
854
+
855
+def console_get_default_foreground(con):
856
+    return _lib.TCOD_console_get_default_foreground(con)
857
+
858
+def console_get_char_background(con, x, y):
859
+    return _lib.TCOD_console_get_char_background(con, x, y)
860
+
861
+def console_get_char_foreground(con, x, y):
862
+    return _lib.TCOD_console_get_char_foreground(con, x, y)
863
+
864
+def console_get_char(con, x, y):
865
+    return _lib.TCOD_console_get_char(con, x, y)
866
+
867
+def console_set_fade(fade, fadingColor):
868
+    _lib.TCOD_console_set_fade(fade, fadingColor)
869
+    ##_lib.TCOD_console_set_fade_wrapper(fade, fadingColor)
870
+
871
+def console_get_fade():
872
+    return _lib.TCOD_console_get_fade().value
873
+
874
+def console_get_fading_color():
875
+    return _lib.TCOD_console_get_fading_color()
876
+
877
+# handling keyboard input
878
+def console_wait_for_keypress(flush):
879
+    k=Key()
880
+    _lib.TCOD_console_wait_for_keypress_wrapper(byref(k),c_bool(flush))
881
+    return k
882
+
883
+def console_check_for_keypress(flags=KEY_RELEASED):
884
+    k=Key()
885
+    _lib.TCOD_console_check_for_keypress_wrapper(byref(k),c_int(flags))
886
+    return k
887
+
888
+def console_is_key_pressed(key):
889
+    return _lib.TCOD_console_is_key_pressed(key)
890
+
891
+def console_set_keyboard_repeat(initial_delay, interval):
892
+    _lib.TCOD_console_set_keyboard_repeat(initial_delay, interval)
893
+
894
+def console_disable_keyboard_repeat():
895
+    _lib.TCOD_console_disable_keyboard_repeat()
896
+
897
+# using offscreen consoles
898
+def console_new(w, h):
899
+    return _lib.TCOD_console_new(w, h)
900
+def console_from_file(filename):
901
+    return _lib.TCOD_console_from_file(filename)
902
+def console_get_width(con):
903
+    return _lib.TCOD_console_get_width(con)
904
+
905
+def console_get_height(con):
906
+    return _lib.TCOD_console_get_height(con)
907
+
908
+def console_blit(src, x, y, w, h, dst, xdst, ydst, ffade=1.0,bfade=1.0):
909
+    _lib.TCOD_console_blit(src, x, y, w, h, dst, xdst, ydst, c_float(ffade), c_float(bfade))
910
+
911
+def console_set_key_color(con, col):
912
+    _lib.TCOD_console_set_key_color(con, col)
913
+
914
+def console_delete(con):
915
+    _lib.TCOD_console_delete(con)
916
+
917
+# fast color filling
918
+def console_fill_foreground(con,r,g,b) :
919
+    if len(r) != len(g) or len(r) != len(b):
920
+        raise TypeError('R, G and B must all have the same size.')
921
+
922
+    if (numpy_available and isinstance(r, numpy.ndarray) and
923
+        isinstance(g, numpy.ndarray) and isinstance(b, numpy.ndarray)):
924
+        #numpy arrays, use numpy's ctypes functions
925
+        r = numpy.ascontiguousarray(r, dtype=numpy.int32)
926
+        g = numpy.ascontiguousarray(g, dtype=numpy.int32)
927
+        b = numpy.ascontiguousarray(b, dtype=numpy.int32)
928
+        cr = r.ctypes.data_as(POINTER(c_int))
929
+        cg = g.ctypes.data_as(POINTER(c_int))
930
+        cb = b.ctypes.data_as(POINTER(c_int))
931
+    else:
932
+        # otherwise convert using ctypes arrays
933
+        cr = (c_int * len(r))(*r)
934
+        cg = (c_int * len(g))(*g)
935
+        cb = (c_int * len(b))(*b)
936
+
937
+    _lib.TCOD_console_fill_foreground(con, cr, cg, cb)
938
+
939
+def console_fill_background(con,r,g,b) :
940
+    if len(r) != len(g) or len(r) != len(b):
941
+        raise TypeError('R, G and B must all have the same size.')
942
+
943
+    if (numpy_available and isinstance(r, numpy.ndarray) and
944
+        isinstance(g, numpy.ndarray) and isinstance(b, numpy.ndarray)):
945
+        #numpy arrays, use numpy's ctypes functions
946
+        r = numpy.ascontiguousarray(r, dtype=numpy.int32)
947
+        g = numpy.ascontiguousarray(g, dtype=numpy.int32)
948
+        b = numpy.ascontiguousarray(b, dtype=numpy.int32)
949
+        cr = r.ctypes.data_as(POINTER(c_int))
950
+        cg = g.ctypes.data_as(POINTER(c_int))
951
+        cb = b.ctypes.data_as(POINTER(c_int))
952
+    else:
953
+        # otherwise convert using ctypes arrays
954
+        cr = (c_int * len(r))(*r)
955
+        cg = (c_int * len(g))(*g)
956
+        cb = (c_int * len(b))(*b)
957
+
958
+    _lib.TCOD_console_fill_background(con, cr, cg, cb)
959
+
960
+def console_fill_char(con,arr) :
961
+    if (numpy_available and isinstance(arr, numpy.ndarray) ):
962
+        #numpy arrays, use numpy's ctypes functions
963
+        arr = numpy.ascontiguousarray(arr, dtype=numpy.int32)
964
+        carr = arr.ctypes.data_as(POINTER(c_int))
965
+    else:
966
+        #otherwise convert using the struct module
967
+        carr = struct.pack('%di' % len(arr), *arr)
968
+
969
+    _lib.TCOD_console_fill_char(con, carr)
970
+        
971
+def console_load_asc(con, filename) :
972
+    _lib.TCOD_console_load_asc(con,filename)
973
+def console_save_asc(con, filename) :
974
+    _lib.TCOD_console_save_asc(con,filename)
975
+def console_load_apf(con, filename) :
976
+    _lib.TCOD_console_load_apf(con,filename)
977
+def console_save_apf(con, filename) :
978
+    _lib.TCOD_console_save_apf(con,filename)
979
+
980
+############################
981
+# sys module
982
+############################
983
+_lib.TCOD_sys_get_last_frame_length.restype = c_float
984
+_lib.TCOD_sys_elapsed_seconds.restype = c_float
985
+
986
+# high precision time functions
987
+def sys_set_fps(fps):
988
+    _lib.TCOD_sys_set_fps(fps)
989
+
990
+def sys_get_fps():
991
+    return _lib.TCOD_sys_get_fps()
992
+
993
+def sys_get_last_frame_length():
994
+    return _lib.TCOD_sys_get_last_frame_length()
995
+
996
+def sys_sleep_milli(val):
997
+    _lib.TCOD_sys_sleep_milli(c_uint(val))
998
+
999
+def sys_elapsed_milli():
1000
+    return _lib.TCOD_sys_elapsed_milli()
1001
+
1002
+def sys_elapsed_seconds():
1003
+    return _lib.TCOD_sys_elapsed_seconds()
1004
+
1005
+def sys_set_renderer(renderer):
1006
+    _lib.TCOD_sys_set_renderer(renderer)
1007
+
1008
+def sys_get_renderer():
1009
+    return _lib.TCOD_sys_get_renderer()
1010
+
1011
+# easy screenshots
1012
+def sys_save_screenshot(name=0):
1013
+    _lib.TCOD_sys_save_screenshot(c_char_p(name))
1014
+
1015
+# custom fullscreen resolution
1016
+def sys_force_fullscreen_resolution(width, height):
1017
+    _lib.TCOD_sys_force_fullscreen_resolution(width, height)
1018
+
1019
+def sys_get_current_resolution():
1020
+    w = c_int()
1021
+    h = c_int()
1022
+    _lib.TCOD_sys_get_current_resolution(byref(w), byref(h))
1023
+    return w.value, h.value
1024
+
1025
+def sys_get_char_size():
1026
+    w = c_int()
1027
+    h = c_int()
1028
+    _lib.TCOD_sys_get_char_size(byref(w), byref(h))
1029
+    return w.value, h.value
1030
+
1031
+# update font bitmap
1032
+def sys_update_char(asciiCode, fontx, fonty, img, x, y) :
1033
+    _lib.TCOD_sys_update_char(c_int(asciiCode),c_int(fontx),c_int(fonty),img,c_int(x),c_int(y))
1034
+
1035
+# custom SDL post renderer
1036
+SDL_RENDERER_FUNC = CFUNCTYPE(None, c_void_p)
1037
+def sys_register_SDL_renderer(callback):
1038
+    global sdl_renderer_func
1039
+    sdl_renderer_func = SDL_RENDERER_FUNC(callback)
1040
+    _lib.TCOD_sys_register_SDL_renderer(sdl_renderer_func)
1041
+
1042
+# events
1043
+EVENT_NONE=0
1044
+EVENT_KEY_PRESS=1
1045
+EVENT_KEY_RELEASE=2
1046
+EVENT_KEY=EVENT_KEY_PRESS|EVENT_KEY_RELEASE
1047
+EVENT_MOUSE_MOVE=4
1048
+EVENT_MOUSE_PRESS=8
1049
+EVENT_MOUSE_RELEASE=16
1050
+EVENT_MOUSE=EVENT_MOUSE_MOVE|EVENT_MOUSE_PRESS|EVENT_MOUSE_RELEASE
1051
+EVENT_ANY=EVENT_KEY|EVENT_MOUSE
1052
+def sys_check_for_event(mask,k,m) :
1053
+    return _lib.TCOD_sys_check_for_event(c_int(mask),byref(k),byref(m))
1054
+
1055
+def sys_wait_for_event(mask,k,m,flush) :
1056
+    return _lib.TCOD_sys_wait_for_event(c_int(mask),byref(k),byref(m),c_bool(flush))
1057
+
1058
+############################
1059
+# line module
1060
+############################
1061
+_lib.TCOD_line_step.restype = c_bool
1062
+_lib.TCOD_line.restype=c_bool
1063
+_lib.TCOD_line_step_mt.restype = c_bool
1064
+
1065
+def line_init(xo, yo, xd, yd):
1066
+    _lib.TCOD_line_init(xo, yo, xd, yd)
1067
+
1068
+def line_step():
1069
+    x = c_int()
1070
+    y = c_int()
1071
+    ret = _lib.TCOD_line_step(byref(x), byref(y))
1072
+    if not ret:
1073
+        return x.value, y.value
1074
+    return None,None
1075
+
1076
+def line(xo,yo,xd,yd,py_callback) :
1077
+    LINE_CBK_FUNC=CFUNCTYPE(c_bool,c_int,c_int)
1078
+    c_callback=LINE_CBK_FUNC(py_callback)
1079
+    return _lib.TCOD_line(xo,yo,xd,yd,c_callback)
1080
+
1081
+def line_iter(xo, yo, xd, yd):
1082
+    data = (c_int * 9)()        # struct TCOD_bresenham_data_t
1083
+    _lib.TCOD_line_init_mt(xo, yo, xd, yd, data)
1084
+    x = c_int(xo)
1085
+    y = c_int(yo)
1086
+    done = False
1087
+    while not done:
1088
+        yield x.value, y.value
1089
+        done = _lib.TCOD_line_step_mt(byref(x), byref(y), data)
1090
+
1091
+############################
1092
+# image module
1093
+############################
1094
+_lib.TCOD_image_is_pixel_transparent.restype = c_bool
1095
+_lib.TCOD_image_get_pixel.restype = Color
1096
+_lib.TCOD_image_get_mipmap_pixel.restype = Color
1097
+
1098
+def image_new(width, height):
1099
+    return _lib.TCOD_image_new(width, height)
1100
+
1101
+def image_clear(image,col) :
1102
+    _lib.TCOD_image_clear(image,col)
1103
+
1104
+def image_invert(image) :
1105
+    _lib.TCOD_image_invert(image)
1106
+
1107
+def image_hflip(image) :
1108
+    _lib.TCOD_image_hflip(image)
1109
+
1110
+def image_rotate90(image, num=1) :
1111
+    _lib.TCOD_image_rotate90(image,num)
1112
+
1113
+def image_vflip(image) :
1114
+    _lib.TCOD_image_vflip(image)
1115
+
1116
+def image_scale(image, neww, newh) :
1117
+    _lib.TCOD_image_scale(image,c_int(neww),c_int(newh))
1118
+
1119
+def image_set_key_color(image,col) :
1120
+    _lib.TCOD_image_set_key_color(image,col)
1121
+
1122
+def image_get_alpha(image,x,y) :
1123
+    return _lib.TCOD_image_get_alpha(image,c_int(x),c_int(y))
1124
+
1125
+def image_is_pixel_transparent(image,x,y) :
1126
+    return _lib.TCOD_image_is_pixel_transparent(image,c_int(x),c_int(y))
1127
+
1128
+def image_load(filename):
1129
+    return _lib.TCOD_image_load(c_char_p(filename))
1130
+
1131
+def image_from_console(console):
1132
+    return _lib.TCOD_image_from_console(console)
1133
+
1134
+def image_refresh_console(image, console):
1135
+    _lib.TCOD_image_refresh_console(image, console)
1136
+
1137
+def image_get_size(image):
1138
+    w=c_int()
1139
+    h=c_int()
1140
+    _lib.TCOD_image_get_size(image, byref(w), byref(h))
1141
+    return w.value, h.value
1142
+
1143
+def image_get_pixel(image, x, y):
1144
+    return _lib.TCOD_image_get_pixel(image, x, y)
1145
+
1146
+def image_get_mipmap_pixel(image, x0, y0, x1, y1):
1147
+    return _lib.TCOD_image_get_mipmap_pixel(image, c_float(x0), c_float(y0),
1148
+                                            c_float(x1), c_float(y1))
1149
+def image_put_pixel(image, x, y, col):
1150
+    _lib.TCOD_image_put_pixel(image, x, y, col)
1151
+    ##_lib.TCOD_image_put_pixel_wrapper(image, x, y, col)
1152
+
1153
+def image_blit(image, console, x, y, bkgnd_flag, scalex, scaley, angle):
1154
+    _lib.TCOD_image_blit(image, console, c_float(x), c_float(y), bkgnd_flag,
1155
+                         c_float(scalex), c_float(scaley), c_float(angle))
1156
+
1157
+def image_blit_rect(image, console, x, y, w, h, bkgnd_flag):
1158
+    _lib.TCOD_image_blit_rect(image, console, x, y, w, h, bkgnd_flag)
1159
+
1160
+def image_blit_2x(image, console, dx, dy, sx=0, sy=0, w=-1, h=-1):
1161
+    _lib.TCOD_image_blit_2x(image, console, dx,dy,sx,sy,w,h)
1162
+
1163
+def image_save(image, filename):
1164
+    _lib.TCOD_image_save(image, c_char_p(filename))
1165
+
1166
+def image_delete(image):
1167
+    _lib.TCOD_image_delete(image)
1168
+
1169
+############################
1170
+# mouse module
1171
+############################
1172
+class Mouse(Structure):
1173
+    _fields_=[('x', c_int),
1174
+              ('y', c_int),
1175
+              ('dx', c_int),
1176
+              ('dy', c_int),
1177
+              ('cx', c_int),
1178
+              ('cy', c_int),
1179
+              ('dcx', c_int),
1180
+              ('dcy', c_int),
1181
+              ('lbutton', c_bool),
1182
+              ('rbutton', c_bool),
1183
+              ('mbutton', c_bool),
1184
+              ('lbutton_pressed', c_bool),
1185
+              ('rbutton_pressed', c_bool),
1186
+              ('mbutton_pressed', c_bool),
1187
+              ('wheel_up', c_bool),
1188
+              ('wheel_down', c_bool),
1189
+              ]
1190
+
1191
+_lib.TCOD_mouse_is_cursor_visible.restype = c_bool
1192
+
1193
+def mouse_show_cursor(visible):
1194
+    _lib.TCOD_mouse_show_cursor(c_int(visible))
1195
+
1196
+def mouse_is_cursor_visible():
1197
+    return _lib.TCOD_mouse_is_cursor_visible()
1198
+
1199
+def mouse_move(x, y):
1200
+    _lib.TCOD_mouse_move(x, y)
1201
+
1202
+def mouse_get_status():
1203
+    mouse=Mouse()
1204
+    _lib.TCOD_mouse_get_status_wrapper(byref(mouse))
1205
+    return mouse
1206
+
1207
+############################
1208
+# parser module
1209
+############################
1210
+_lib.TCOD_struct_get_name.restype = c_char_p
1211
+_lib.TCOD_struct_is_mandatory.restype = c_bool
1212
+_lib.TCOD_parser_has_property.restype = c_bool
1213
+_lib.TCOD_parser_get_bool_property.restype = c_bool
1214
+_lib.TCOD_parser_get_float_property.restype = c_float
1215
+_lib.TCOD_parser_get_string_property.restype = c_char_p
1216
+_lib.TCOD_parser_get_color_property.restype = Color
1217
+
1218
+class Dice(Structure):
1219
+    _fields_=[('nb_dices', c_int),
1220
+              ('nb_faces', c_int),
1221
+              ('multiplier', c_float),
1222
+              ('addsub', c_float),
1223
+              ]
1224
+
1225
+    def __repr__(self):
1226
+        return "Dice(%d, %d, %s, %s)" % (self.nb_dices, self.nb_faces,
1227
+                                      self.multiplier, self.addsub)
1228
+
1229
+class _CValue(Union):
1230
+    _fields_=[('c',c_uint8),
1231
+              ('i',c_int),
1232
+              ('f',c_float),
1233
+              ('s',c_char_p),
1234
+              # JBR03192012 See http://bugs.python.org/issue14354 for why these are not defined as their actual types
1235
+              ('col',c_uint8 * 3),
1236
+              ('dice',c_int * 4),
1237
+              ('custom',c_void_p),
1238
+              ]
1239
+
1240
+_CFUNC_NEW_STRUCT = CFUNCTYPE(c_uint, c_void_p, c_char_p)
1241
+_CFUNC_NEW_FLAG = CFUNCTYPE(c_uint, c_char_p)
1242
+_CFUNC_NEW_PROPERTY = CFUNCTYPE(c_uint, c_char_p, c_int, _CValue)
1243
+
1244
+class _CParserListener(Structure):
1245
+    _fields_=[('new_struct', _CFUNC_NEW_STRUCT),
1246
+              ('new_flag',_CFUNC_NEW_FLAG),
1247
+              ('new_property',_CFUNC_NEW_PROPERTY),
1248
+              ('end_struct',_CFUNC_NEW_STRUCT),
1249
+              ('error',_CFUNC_NEW_FLAG),
1250
+              ]
1251
+
1252
+# property types
1253
+TYPE_NONE = 0
1254
+TYPE_BOOL = 1
1255
+TYPE_CHAR = 2
1256
+TYPE_INT = 3
1257
+TYPE_FLOAT = 4
1258
+TYPE_STRING = 5
1259
+TYPE_COLOR = 6
1260
+TYPE_DICE = 7
1261
+TYPE_VALUELIST00 = 8
1262
+TYPE_VALUELIST01 = 9
1263
+TYPE_VALUELIST02 = 10
1264
+TYPE_VALUELIST03 = 11
1265
+TYPE_VALUELIST04 = 12
1266
+TYPE_VALUELIST05 = 13
1267
+TYPE_VALUELIST06 = 14
1268
+TYPE_VALUELIST07 = 15
1269
+TYPE_VALUELIST08 = 16
1270
+TYPE_VALUELIST09 = 17
1271
+TYPE_VALUELIST10 = 18
1272
+TYPE_VALUELIST11 = 19
1273
+TYPE_VALUELIST12 = 20
1274
+TYPE_VALUELIST13 = 21
1275
+TYPE_VALUELIST14 = 22
1276
+TYPE_VALUELIST15 = 23
1277
+TYPE_LIST = 1024
1278
+
1279
+def _convert_TCODList(clist, typ):
1280
+    res = list()
1281
+    for i in range(_lib.TCOD_list_size(clist)):
1282
+        elt = _lib.TCOD_list_get(clist, i)
1283
+        elt = cast(elt, c_void_p)
1284
+        if typ == TYPE_BOOL:
1285
+            elt = c_bool.from_buffer(elt).value
1286
+        elif typ == TYPE_CHAR:
1287
+            elt = c_char.from_buffer(elt).value
1288
+        elif typ == TYPE_INT:
1289
+            elt = c_int.from_buffer(elt).value
1290
+        elif typ == TYPE_FLOAT:
1291
+            elt = c_float.from_buffer(elt).value
1292
+        elif typ == TYPE_STRING or TYPE_VALUELIST15 >= typ >= TYPE_VALUELIST00:
1293
+            elt = cast(elt, c_char_p).value
1294
+        elif typ == TYPE_COLOR:
1295
+            elt = Color.from_buffer_copy(elt)
1296
+        elif typ == TYPE_DICE:
1297
+            # doesn't work
1298
+            elt = Dice.from_buffer_copy(elt)
1299
+        res.append(elt)
1300
+    return res
1301
+
1302
+def parser_new():
1303
+    return _lib.TCOD_parser_new()
1304
+
1305
+def parser_new_struct(parser, name):
1306
+    return _lib.TCOD_parser_new_struct(parser, name)
1307
+
1308
+def struct_add_flag(struct, name):
1309
+    _lib.TCOD_struct_add_flag(struct, name)
1310
+
1311
+def struct_add_property(struct, name, typ, mandatory):
1312
+    _lib.TCOD_struct_add_property(struct, name, typ, c_bool(mandatory))
1313
+
1314
+def struct_add_value_list(struct, name, value_list, mandatory):
1315
+    CARRAY = c_char_p * (len(value_list) + 1)
1316
+    cvalue_list = CARRAY()
1317
+    for i in range(len(value_list)):
1318
+        cvalue_list[i] = cast(value_list[i], c_char_p)
1319
+    cvalue_list[len(value_list)] = 0
1320
+    _lib.TCOD_struct_add_value_list(struct, name, cvalue_list, c_bool(mandatory))
1321
+
1322
+def struct_add_list_property(struct, name, typ, mandatory):
1323
+    _lib.TCOD_struct_add_list_property(struct, name, typ, c_bool(mandatory))
1324
+
1325
+def struct_add_structure(struct, sub_struct):
1326
+    _lib.TCOD_struct_add_structure(struct, sub_struct)
1327
+
1328
+def struct_get_name(struct):
1329
+    return _lib.TCOD_struct_get_name(struct)
1330
+
1331
+def struct_is_mandatory(struct, name):
1332
+    return _lib.TCOD_struct_is_mandatory(struct, name)
1333
+
1334
+def struct_get_type(struct, name):
1335
+    return _lib.TCOD_struct_get_type(struct, name)
1336
+
1337
+def parser_run(parser, filename, listener=0):
1338
+    if listener != 0:
1339
+        clistener=_CParserListener()
1340
+        def value_converter(name, typ, value):
1341
+            if typ == TYPE_BOOL:
1342
+                return listener.new_property(name, typ, value.c == 1)
1343
+            elif typ == TYPE_CHAR:
1344
+                return listener.new_property(name, typ, '%c' % (value.c & 0xFF))
1345
+            elif typ == TYPE_INT:
1346
+                return listener.new_property(name, typ, value.i)
1347
+            elif typ == TYPE_FLOAT:
1348
+                return listener.new_property(name, typ, value.f)
1349
+            elif typ == TYPE_STRING or \
1350
+                 TYPE_VALUELIST15 >= typ >= TYPE_VALUELIST00:
1351
+                 return listener.new_property(name, typ, value.s)
1352
+            elif typ == TYPE_COLOR:
1353
+                col = cast(value.col, POINTER(Color)).contents
1354
+                return listener.new_property(name, typ, col)
1355
+            elif typ == TYPE_DICE:
1356
+                dice = cast(value.dice, POINTER(Dice)).contents
1357
+                return listener.new_property(name, typ, dice)
1358
+            elif typ & TYPE_LIST:
1359
+                return listener.new_property(name, typ,
1360
+                                        _convert_TCODList(value.custom, typ & 0xFF))
1361
+            return True
1362
+        clistener.new_struct = _CFUNC_NEW_STRUCT(listener.new_struct)
1363
+        clistener.new_flag = _CFUNC_NEW_FLAG(listener.new_flag)
1364
+        clistener.new_property = _CFUNC_NEW_PROPERTY(value_converter)
1365
+        clistener.end_struct = _CFUNC_NEW_STRUCT(listener.end_struct)
1366
+        clistener.error = _CFUNC_NEW_FLAG(listener.error)
1367
+        _lib.TCOD_parser_run(parser, c_char_p(filename), byref(clistener))
1368
+    else:
1369
+        _lib.TCOD_parser_run(parser, c_char_p(filename), 0)
1370
+
1371
+def parser_delete(parser):
1372
+    _lib.TCOD_parser_delete(parser)
1373
+
1374
+def parser_has_property(parser, name):
1375
+    return _lib.TCOD_parser_has_property(parser, c_char_p(name))
1376
+
1377
+def parser_get_bool_property(parser, name):
1378
+    return _lib.TCOD_parser_get_bool_property(parser, c_char_p(name))
1379
+
1380
+def parser_get_int_property(parser, name):
1381
+    return _lib.TCOD_parser_get_int_property(parser, c_char_p(name))
1382
+
1383
+def parser_get_char_property(parser, name):
1384
+    return '%c' % _lib.TCOD_parser_get_char_property(parser, c_char_p(name))
1385
+
1386
+def parser_get_float_property(parser, name):
1387
+    return _lib.TCOD_parser_get_float_property(parser, c_char_p(name))
1388
+
1389
+def parser_get_string_property(parser, name):
1390
+    return _lib.TCOD_parser_get_string_property(parser, c_char_p(name))
1391
+
1392
+def parser_get_color_property(parser, name):
1393
+    return _lib.TCOD_parser_get_color_property(parser, c_char_p(name))
1394
+
1395
+def parser_get_dice_property(parser, name):
1396
+    d = Dice()
1397
+    _lib.TCOD_parser_get_dice_property_py(c_void_p(parser), c_char_p(name), byref(d))
1398
+    return d
1399
+
1400
+def parser_get_list_property(parser, name, typ):
1401
+    clist = _lib.TCOD_parser_get_list_property(parser, c_char_p(name), c_int(typ))
1402
+    return _convert_TCODList(clist, typ)
1403
+
1404
+############################
1405
+# random module
1406
+############################
1407
+_lib.TCOD_random_get_float.restype = c_float
1408
+_lib.TCOD_random_get_double.restype = c_double
1409
+
1410
+RNG_MT = 0
1411
+RNG_CMWC = 1
1412
+
1413
+DISTRIBUTION_LINEAR = 0
1414
+DISTRIBUTION_GAUSSIAN = 1
1415
+DISTRIBUTION_GAUSSIAN_RANGE = 2
1416
+DISTRIBUTION_GAUSSIAN_INVERSE = 3
1417
+DISTRIBUTION_GAUSSIAN_RANGE_INVERSE = 4
1418
+
1419
+def random_get_instance():
1420
+    return _lib.TCOD_random_get_instance()
1421
+
1422
+def random_new(algo=RNG_CMWC):
1423
+    return _lib.TCOD_random_new(algo)
1424
+
1425
+def random_new_from_seed(seed, algo=RNG_CMWC):
1426
+    return _lib.TCOD_random_new_from_seed(algo,c_uint(seed))
1427
+
1428
+def random_set_distribution(rnd, dist) :
1429
+	_lib.TCOD_random_set_distribution(rnd, dist)
1430
+
1431
+def random_get_int(rnd, mi, ma):
1432
+    return _lib.TCOD_random_get_int(rnd, mi, ma)
1433
+
1434
+def random_get_float(rnd, mi, ma):
1435
+    return _lib.TCOD_random_get_float(rnd, c_float(mi), c_float(ma))
1436
+
1437
+def random_get_double(rnd, mi, ma):
1438
+    return _lib.TCOD_random_get_double(rnd, c_double(mi), c_double(ma))
1439
+
1440
+def random_get_int_mean(rnd, mi, ma, mean):
1441
+    return _lib.TCOD_random_get_int_mean(rnd, mi, ma, mean)
1442
+
1443
+def random_get_float_mean(rnd, mi, ma, mean):
1444
+    return _lib.TCOD_random_get_float_mean(rnd, c_float(mi), c_float(ma), c_float(mean))
1445
+
1446
+def random_get_double_mean(rnd, mi, ma, mean):
1447
+    return _lib.TCOD_random_get_double_mean(rnd, c_double(mi), c_double(ma), c_double(mean))
1448
+
1449
+def random_save(rnd):
1450
+    return _lib.TCOD_random_save(rnd)
1451
+
1452
+def random_restore(rnd, backup):
1453
+    _lib.TCOD_random_restore(rnd, backup)
1454
+
1455
+def random_delete(rnd):
1456
+    _lib.TCOD_random_delete(rnd)
1457
+
1458
+############################
1459
+# noise module
1460
+############################
1461
+_lib.TCOD_noise_get.restype = c_float
1462
+_lib.TCOD_noise_get_ex.restype = c_float
1463
+_lib.TCOD_noise_get_fbm.restype = c_float
1464
+_lib.TCOD_noise_get_fbm_ex.restype = c_float
1465
+_lib.TCOD_noise_get_turbulence.restype = c_float
1466
+_lib.TCOD_noise_get_turbulence_ex.restype = c_float
1467
+
1468
+NOISE_DEFAULT_HURST = 0.5
1469
+NOISE_DEFAULT_LACUNARITY = 2.0
1470
+
1471
+NOISE_DEFAULT = 0
1472
+NOISE_PERLIN = 1
1473
+NOISE_SIMPLEX = 2
1474
+NOISE_WAVELET = 4
1475
+
1476
+_NOISE_PACKER_FUNC = (None,
1477
+                      (c_float * 1),
1478
+                      (c_float * 2),
1479
+                      (c_float * 3),
1480
+                      (c_float * 4),
1481
+                      )
1482
+
1483
+def noise_new(dim, h=NOISE_DEFAULT_HURST, l=NOISE_DEFAULT_LACUNARITY, random=0):
1484
+    return _lib.TCOD_noise_new(dim, c_float(h), c_float(l), random)
1485
+
1486
+def noise_set_type(n, typ) :
1487
+    _lib.TCOD_noise_set_type(n,typ)
1488
+
1489
+def noise_get(n, f, typ=NOISE_DEFAULT):
1490
+    return _lib.TCOD_noise_get_ex(n, _NOISE_PACKER_FUNC[len(f)](*f), typ)
1491
+
1492
+def noise_get_fbm(n, f, oc, typ=NOISE_DEFAULT):
1493
+    return _lib.TCOD_noise_get_fbm_ex(n, _NOISE_PACKER_FUNC[len(f)](*f), c_float(oc), typ)
1494
+
1495
+def noise_get_turbulence(n, f, oc, typ=NOISE_DEFAULT):
1496
+    return _lib.TCOD_noise_get_turbulence_ex(n, _NOISE_PACKER_FUNC[len(f)](*f), c_float(oc), typ)
1497
+
1498
+def noise_delete(n):
1499
+    _lib.TCOD_noise_delete(n)
1500
+
1501
+############################
1502
+# fov module
1503
+############################
1504
+_lib.TCOD_map_is_in_fov.restype = c_bool
1505
+_lib.TCOD_map_is_transparent.restype = c_bool
1506
+_lib.TCOD_map_is_walkable.restype = c_bool
1507
+
1508
+FOV_BASIC = 0
1509
+FOV_DIAMOND = 1
1510
+FOV_SHADOW = 2
1511
+FOV_PERMISSIVE_0 = 3
1512
+FOV_PERMISSIVE_1 = 4
1513
+FOV_PERMISSIVE_2 = 5
1514
+FOV_PERMISSIVE_3 = 6
1515
+FOV_PERMISSIVE_4 = 7
1516
+FOV_PERMISSIVE_5 = 8
1517
+FOV_PERMISSIVE_6 = 9
1518
+FOV_PERMISSIVE_7 = 10
1519
+FOV_PERMISSIVE_8 = 11
1520
+FOV_RESTRICTIVE = 12
1521
+NB_FOV_ALGORITHMS = 13
1522
+
1523
+def FOV_PERMISSIVE(p) :
1524
+    return FOV_PERMISSIVE_0+p
1525
+
1526
+def map_new(w, h):
1527
+    return _lib.TCOD_map_new(w, h)
1528
+
1529
+def map_copy(source, dest):
1530
+    return _lib.TCOD_map_copy(source, dest)
1531
+
1532
+def map_set_properties(m, x, y, isTrans, isWalk):
1533
+    _lib.TCOD_map_set_properties(m, x, y, c_int(isTrans), c_int(isWalk))
1534
+
1535
+def map_clear(m,walkable=False,transparent=False):
1536
+    _lib.TCOD_map_clear(m,c_int(walkable),c_int(transparent))
1537
+
1538
+def map_compute_fov(m, x, y, radius=0, light_walls=True, algo=FOV_RESTRICTIVE ):
1539
+    _lib.TCOD_map_compute_fov(m, x, y, c_int(radius), c_bool(light_walls), c_int(algo))
1540
+
1541
+def map_is_in_fov(m, x, y):
1542
+    return _lib.TCOD_map_is_in_fov(m, x, y)
1543
+
1544
+def map_is_transparent(m, x, y):
1545
+    return _lib.TCOD_map_is_transparent(m, x, y)
1546
+
1547
+def map_is_walkable(m, x, y):
1548
+    return _lib.TCOD_map_is_walkable(m, x, y)
1549
+
1550
+def map_delete(m):
1551
+    return _lib.TCOD_map_delete(m)
1552
+
1553
+def map_get_width(map):
1554
+    return _lib.TCOD_map_get_width(map)
1555
+
1556
+def map_get_height(map):
1557
+    return _lib.TCOD_map_get_height(map)
1558
+
1559
+############################
1560
+# pathfinding module
1561
+############################
1562
+_lib.TCOD_path_compute.restype = c_bool
1563
+_lib.TCOD_path_is_empty.restype = c_bool
1564
+_lib.TCOD_path_walk.restype = c_bool
1565
+
1566
+PATH_CBK_FUNC = CFUNCTYPE(c_float, c_int, c_int, c_int, c_int, py_object)
1567
+
1568
+def path_new_using_map(m, dcost=1.41):
1569
+    return (_lib.TCOD_path_new_using_map(c_void_p(m), c_float(dcost)), None)
1570
+
1571
+def path_new_using_function(w, h, func, userdata=0, dcost=1.41):
1572
+    cbk_func = PATH_CBK_FUNC(func)
1573
+    return (_lib.TCOD_path_new_using_function(w, h, cbk_func,
1574
+            py_object(userdata), c_float(dcost)), cbk_func)
1575
+
1576
+def path_compute(p, ox, oy, dx, dy):
1577
+    return _lib.TCOD_path_compute(p[0], ox, oy, dx, dy)
1578
+
1579
+def path_get_origin(p):
1580
+    x = c_int()
1581
+    y = c_int()
1582
+    _lib.TCOD_path_get_origin(p[0], byref(x), byref(y))
1583
+    return x.value, y.value
1584
+
1585
+def path_get_destination(p):
1586
+    x = c_int()
1587
+    y = c_int()
1588
+    _lib.TCOD_path_get_destination(p[0], byref(x), byref(y))
1589
+    return x.value, y.value
1590
+
1591
+def path_size(p):
1592
+    return _lib.TCOD_path_size(p[0])
1593
+
1594
+def path_reverse(p):
1595
+    _lib.TCOD_path_reverse(p[0])  
1596
+
1597
+def path_get(p, idx):
1598
+    x = c_int()
1599
+    y = c_int()
1600
+    _lib.TCOD_path_get(p[0], idx, byref(x), byref(y))
1601
+    return x.value, y.value
1602
+
1603
+def path_is_empty(p):
1604
+    return _lib.TCOD_path_is_empty(p[0])
1605
+
1606
+def path_walk(p, recompute):
1607
+    x = c_int()
1608
+    y = c_int()
1609
+    if _lib.TCOD_path_walk(p[0], byref(x), byref(y), c_int(recompute)):
1610
+        return x.value, y.value
1611
+    return None,None
1612
+
1613
+def path_delete(p):
1614
+    _lib.TCOD_path_delete(p[0])
1615
+
1616
+_lib.TCOD_dijkstra_path_set.restype = c_bool
1617
+_lib.TCOD_dijkstra_is_empty.restype = c_bool
1618
+_lib.TCOD_dijkstra_path_walk.restype = c_bool
1619
+_lib.TCOD_dijkstra_get_distance.restype = c_float
1620
+
1621
+def dijkstra_new(m, dcost=1.41):
1622
+    return (_lib.TCOD_dijkstra_new(c_void_p(m), c_float(dcost)), None)
1623
+
1624
+def dijkstra_new_using_function(w, h, func, userdata=0, dcost=1.41):
1625
+    cbk_func = PATH_CBK_FUNC(func)
1626
+    return (_lib.TCOD_path_dijkstra_using_function(w, h, cbk_func,
1627
+            py_object(userdata), c_float(dcost)), cbk_func)
1628
+
1629
+def dijkstra_compute(p, ox, oy):
1630
+    _lib.TCOD_dijkstra_compute(p[0], c_int(ox), c_int(oy))
1631
+
1632
+def dijkstra_path_set(p, x, y):
1633
+    return _lib.TCOD_dijkstra_path_set(p[0], c_int(x), c_int(y))
1634
+
1635
+def dijkstra_get_distance(p, x, y):
1636
+    return _lib.TCOD_dijkstra_get_distance(p[0], c_int(x), c_int(y))
1637
+
1638
+def dijkstra_size(p):
1639
+    return _lib.TCOD_dijkstra_size(p[0])
1640
+
1641
+def dijkstra_reverse(p):
1642
+    _lib.TCOD_dijkstra_reverse(p[0])
1643
+
1644
+def dijkstra_get(p, idx):
1645
+    x = c_int()
1646
+    y = c_int()
1647
+    _lib.TCOD_dijkstra_get(p[0], c_int(idx), byref(x), byref(y))
1648
+    return x.value, y.value
1649
+
1650
+def dijkstra_is_empty(p):
1651
+    return _lib.TCOD_dijkstra_is_empty(p[0])
1652
+
1653
+def dijkstra_path_walk(p):
1654
+    x = c_int()
1655
+    y = c_int()
1656
+    if _lib.TCOD_dijkstra_path_walk(p[0], byref(x), byref(y)):
1657
+        return x.value, y.value
1658
+    return None,None
1659
+
1660
+def dijkstra_delete(p):
1661
+    _lib.TCOD_dijkstra_delete(p[0])
1662
+
1663
+############################
1664
+# bsp module
1665
+############################
1666
+class _CBsp(Structure):
1667
+    _fields_ = [('next', c_void_p),
1668
+                ('father', c_void_p),
1669
+                ('son', c_void_p),
1670
+                ('x', c_int),
1671
+                ('y', c_int),
1672
+                ('w', c_int),
1673
+                ('h', c_int),
1674
+                ('position', c_int),
1675
+                ('level', c_uint8),
1676
+                ('horizontal', c_bool),
1677
+                ]
1678
+
1679
+_lib.TCOD_bsp_new_with_size.restype = POINTER(_CBsp)
1680
+_lib.TCOD_bsp_left.restype = POINTER(_CBsp)
1681
+_lib.TCOD_bsp_right.restype = POINTER(_CBsp)
1682
+_lib.TCOD_bsp_father.restype = POINTER(_CBsp)
1683
+_lib.TCOD_bsp_is_leaf.restype = c_bool
1684
+_lib.TCOD_bsp_contains.restype = c_bool
1685
+_lib.TCOD_bsp_find_node.restype = POINTER(_CBsp)
1686
+
1687
+BSP_CBK_FUNC = CFUNCTYPE(c_int, c_void_p, c_void_p)
1688
+
1689
+# python class encapsulating the _CBsp pointer
1690
+class Bsp(object):
1691
+    def __init__(self, cnode):
1692
+        pcbsp = cast(cnode, POINTER(_CBsp))
1693
+        self.p = pcbsp
1694
+
1695
+    def getx(self):
1696
+        return self.p.contents.x
1697
+    def setx(self, value):
1698
+        self.p.contents.x = value
1699
+    x = property(getx, setx)
1700
+
1701
+    def gety(self):
1702
+        return self.p.contents.y
1703
+    def sety(self, value):
1704
+        self.p.contents.y = value
1705
+    y = property(gety, sety)
1706
+
1707
+    def getw(self):
1708
+        return self.p.contents.w
1709
+    def setw(self, value):
1710
+        self.p.contents.w = value
1711
+    w = property(getw, setw)
1712
+
1713
+    def geth(self):
1714
+        return self.p.contents.h
1715
+    def seth(self, value):
1716
+        self.p.contents.h = value
1717
+    h = property(geth, seth)
1718
+
1719
+    def getpos(self):
1720
+        return self.p.contents.position
1721
+    def setpos(self, value):
1722
+        self.p.contents.position = value
1723
+    position = property(getpos, setpos)
1724
+
1725
+    def gethor(self):
1726
+        return self.p.contents.horizontal
1727
+    def sethor(self,value):
1728
+        self.p.contents.horizontal = value
1729
+    horizontal = property(gethor, sethor)
1730
+
1731
+    def getlev(self):
1732
+        return self.p.contents.level
1733
+    def setlev(self,value):
1734
+        self.p.contents.level = value
1735
+    level = property(getlev, setlev)
1736
+
1737
+
1738
+def bsp_new_with_size(x, y, w, h):
1739
+    return Bsp(_lib.TCOD_bsp_new_with_size(x, y, w, h))
1740
+
1741
+def bsp_split_once(node, horizontal, position):
1742
+    _lib.TCOD_bsp_split_once(node.p, c_int(horizontal), position)
1743
+
1744
+def bsp_split_recursive(node, randomizer, nb, minHSize, minVSize, maxHRatio,
1745
+                        maxVRatio):
1746
+    _lib.TCOD_bsp_split_recursive(node.p, randomizer, nb, minHSize, minVSize,
1747
+                                  c_float(maxHRatio), c_float(maxVRatio))
1748
+
1749
+def bsp_resize(node, x, y, w, h):
1750
+    _lib.TCOD_bsp_resize(node.p, x, y, w, h)
1751
+
1752
+def bsp_left(node):
1753
+    return Bsp(_lib.TCOD_bsp_left(node.p))
1754
+
1755
+def bsp_right(node):
1756
+    return Bsp(_lib.TCOD_bsp_right(node.p))
1757
+
1758
+def bsp_father(node):
1759
+    return Bsp(_lib.TCOD_bsp_father(node.p))
1760
+
1761
+def bsp_is_leaf(node):
1762
+    return _lib.TCOD_bsp_is_leaf(node.p)
1763
+
1764
+def bsp_contains(node, cx, cy):
1765
+    return _lib.TCOD_bsp_contains(node.p, cx, cy)
1766
+
1767
+def bsp_find_node(node, cx, cy):
1768
+    return Bsp(_lib.TCOD_bsp_find_node(node.p, cx, cy))
1769
+
1770
+def _bsp_traverse(node, callback, userData, func):
1771
+    # convert the c node into a python node
1772
+    #before passing it to the actual callback
1773
+    def node_converter(cnode, data):
1774
+        node = Bsp(cnode)
1775
+        return callback(node, data)
1776
+    cbk_func = BSP_CBK_FUNC(node_converter)
1777
+    func(node.p, cbk_func, userData)
1778
+
1779
+def bsp_traverse_pre_order(node, callback, userData=0):
1780
+    _bsp_traverse(node, callback, userData, _lib.TCOD_bsp_traverse_pre_order)
1781
+
1782
+def bsp_traverse_in_order(node, callback, userData=0):
1783
+    _bsp_traverse(node, callback, userData, _lib.TCOD_bsp_traverse_in_order)
1784
+
1785
+def bsp_traverse_post_order(node, callback, userData=0):
1786
+    _bsp_traverse(node, callback, userData, _lib.TCOD_bsp_traverse_post_order)
1787
+
1788
+def bsp_traverse_level_order(node, callback, userData=0):
1789
+    _bsp_traverse(node, callback, userData, _lib.TCOD_bsp_traverse_level_order)
1790
+
1791
+def bsp_traverse_inverted_level_order(node, callback, userData=0):
1792
+    _bsp_traverse(node, callback, userData,
1793
+                  _lib.TCOD_bsp_traverse_inverted_level_order)
1794
+
1795
+def bsp_remove_sons(node):
1796
+    _lib.TCOD_bsp_remove_sons(node.p)
1797
+
1798
+def bsp_delete(node):
1799
+    _lib.TCOD_bsp_delete(node.p)
1800
+
1801
+############################
1802
+# heightmap module
1803
+############################
1804
+class _CHeightMap(Structure):
1805
+    _fields_=[('w', c_int),
1806
+              ('h', c_int),
1807
+              ('values', POINTER(c_float)),
1808
+              ]
1809
+
1810
+_lib.TCOD_heightmap_new.restype = POINTER(_CHeightMap)
1811
+_lib.TCOD_heightmap_get_value.restype = c_float
1812
+_lib.TCOD_heightmap_has_land_on_border.restype = c_bool
1813
+
1814
+class HeightMap(object):
1815
+    def __init__(self, chm):
1816
+        pchm = cast(chm, POINTER(_CHeightMap))
1817
+        self.p = pchm
1818
+
1819
+    def getw(self):
1820
+        return self.p.contents.w
1821
+    def setw(self, value):
1822
+        self.p.contents.w = value
1823
+    w = property(getw, setw)
1824
+
1825
+    def geth(self):
1826
+        return self.p.contents.h
1827
+    def seth(self, value):
1828
+        self.p.contents.h = value
1829
+    h = property(geth, seth)
1830
+
1831
+def heightmap_new(w, h):
1832
+    phm = _lib.TCOD_heightmap_new(w, h)
1833
+    return HeightMap(phm)
1834
+
1835
+def heightmap_set_value(hm, x, y, value):
1836
+    _lib.TCOD_heightmap_set_value(hm.p, x, y, c_float(value))
1837
+
1838
+def heightmap_add(hm, value):
1839
+    _lib.TCOD_heightmap_add(hm.p, c_float(value))
1840
+
1841
+def heightmap_scale(hm, value):
1842
+    _lib.TCOD_heightmap_scale(hm.p, c_float(value))
1843
+
1844
+def heightmap_clear(hm):
1845
+    _lib.TCOD_heightmap_clear(hm.p)
1846
+
1847
+def heightmap_clamp(hm, mi, ma):
1848
+    _lib.TCOD_heightmap_clamp(hm.p, c_float(mi),c_float(ma))
1849
+
1850
+def heightmap_copy(hm1, hm2):
1851
+    _lib.TCOD_heightmap_copy(hm1.p, hm2.p)
1852
+
1853
+def heightmap_normalize(hm,  mi=0.0, ma=1.0):
1854
+    _lib.TCOD_heightmap_normalize(hm.p, c_float(mi), c_float(ma))
1855
+
1856
+def heightmap_lerp_hm(hm1, hm2, hm3, coef):
1857
+    _lib.TCOD_heightmap_lerp_hm(hm1.p, hm2.p, hm3.p, c_float(coef))
1858
+
1859
+def heightmap_add_hm(hm1, hm2, hm3):
1860
+    _lib.TCOD_heightmap_add_hm(hm1.p, hm2.p, hm3.p)
1861
+
1862
+def heightmap_multiply_hm(hm1, hm2, hm3):
1863
+    _lib.TCOD_heightmap_multiply_hm(hm1.p, hm2.p, hm3.p)
1864
+
1865
+def heightmap_add_hill(hm, x, y, radius, height):
1866
+    _lib.TCOD_heightmap_add_hill(hm.p, c_float( x), c_float( y),
1867
+                                 c_float( radius), c_float( height))
1868
+
1869
+def heightmap_dig_hill(hm, x, y, radius, height):
1870
+    _lib.TCOD_heightmap_dig_hill(hm.p, c_float( x), c_float( y),
1871
+                                 c_float( radius), c_float( height))
1872
+
1873
+def heightmap_mid_point_displacement(hm, rng, roughness):
1874
+    _lib.TCOD_heightmap_mid_point_displacement(hm.p, rng, c_float(roughness))
1875
+
1876
+def heightmap_rain_erosion(hm, nbDrops, erosionCoef, sedimentationCoef, rnd=0):
1877
+    _lib.TCOD_heightmap_rain_erosion(hm.p, nbDrops, c_float( erosionCoef),
1878
+                                     c_float( sedimentationCoef), rnd)
1879
+
1880
+def heightmap_kernel_transform(hm, kernelsize, dx, dy, weight, minLevel,
1881
+                               maxLevel):
1882
+    FARRAY = c_float * kernelsize
1883
+    IARRAY = c_int * kernelsize
1884
+    cdx = IARRAY(*dx)
1885
+    cdy = IARRAY(*dy)
1886
+    cweight = FARRAY(*weight)
1887
+    _lib.TCOD_heightmap_kernel_transform(hm.p, kernelsize, cdx, cdy, cweight,
1888
+                                         c_float(minLevel), c_float(maxLevel))
1889
+
1890
+def heightmap_add_voronoi(hm, nbPoints, nbCoef, coef, rnd=0):
1891
+    FARRAY = c_float * nbCoef
1892
+    ccoef = FARRAY(*coef)
1893
+    _lib.TCOD_heightmap_add_voronoi(hm.p, nbPoints, nbCoef, ccoef, rnd)
1894
+
1895
+def heightmap_add_fbm(hm, noise, mulx, muly, addx, addy, octaves, delta, scale):
1896
+    _lib.TCOD_heightmap_add_fbm(hm.p, noise, c_float(mulx), c_float(muly),
1897
+                                c_float(addx), c_float(addy),
1898
+                                c_float(octaves), c_float(delta),
1899
+                                c_float(scale))
1900
+def heightmap_scale_fbm(hm, noise, mulx, muly, addx, addy, octaves, delta,
1901
+                        scale):
1902
+    _lib.TCOD_heightmap_scale_fbm(hm.p, noise, c_float(mulx), c_float(muly),
1903
+                                  c_float(addx), c_float(addy),
1904
+                                  c_float(octaves), c_float(delta),
1905
+                                  c_float(scale))
1906
+def heightmap_dig_bezier(hm, px, py, startRadius, startDepth, endRadius,
1907
+                         endDepth):
1908
+    IARRAY = c_int * 4
1909
+    cpx = IARRAY(*px)
1910
+    cpy = IARRAY(*py)
1911
+    _lib.TCOD_heightmap_dig_bezier(hm.p, cpx, cpy, c_float(startRadius),
1912
+                                   c_float(startDepth), c_float(endRadius),
1913
+                                   c_float(endDepth))
1914
+
1915
+def heightmap_get_value(hm, x, y):
1916
+    return _lib.TCOD_heightmap_get_value(hm.p, x, y)
1917
+
1918
+def heightmap_get_interpolated_value(hm, x, y):
1919
+    return _lib.TCOD_heightmap_get_interpolated_value(hm.p, c_float(x),
1920
+                                                     c_float(y))
1921
+
1922
+def heightmap_get_slope(hm, x, y):
1923
+    return _lib.TCOD_heightmap_get_slope(hm.p, x, y)
1924
+
1925
+def heightmap_get_normal(hm, x, y, waterLevel):
1926
+    FARRAY = c_float * 3
1927
+    cn = FARRAY()
1928
+    _lib.TCOD_heightmap_get_normal(hm.p, c_float(x), c_float(y), cn,
1929
+                                   c_float(waterLevel))
1930
+    return cn[0], cn[1], cn[2]
1931
+
1932
+def heightmap_count_cells(hm, mi, ma):
1933
+    return _lib.TCOD_heightmap_count_cells(hm.p, c_float(mi), c_float(ma))
1934
+
1935
+def heightmap_has_land_on_border(hm, waterlevel):
1936
+    return _lib.TCOD_heightmap_has_land_on_border(hm.p, c_float(waterlevel))
1937
+
1938
+def heightmap_get_minmax(hm):
1939
+    mi = c_float()
1940
+    ma = c_float()
1941
+    _lib.TCOD_heightmap_get_minmax(hm.p, byref(mi), byref(ma))
1942
+    return mi.value, ma.value
1943
+
1944
+def heightmap_delete(hm):
1945
+    _lib.TCOD_heightmap_delete(hm.p)
1946
+
1947
+
1948
+############################
1949
+# name generator module
1950
+############################
1951
+_lib.TCOD_namegen_generate.restype = c_char_p
1952
+_lib.TCOD_namegen_generate_custom.restype = c_char_p
1953
+
1954
+def namegen_parse(filename,random=0) :
1955
+    _lib.TCOD_namegen_parse(filename,random)
1956
+
1957
+def namegen_generate(name) :
1958
+    return _lib.TCOD_namegen_generate(name, 0)
1959
+
1960
+def namegen_generate_custom(name, rule) :
1961
+    return _lib.TCOD_namegen_generate(name, rule, 0)
1962
+
1963
+def namegen_get_sets():
1964
+    nb=_lib.TCOD_namegen_get_nb_sets_wrapper()
1965
+    SARRAY = c_char_p * nb;
1966
+    setsa = SARRAY()
1967
+    _lib.TCOD_namegen_get_sets_wrapper(setsa)
1968
+    return list(setsa)
1969
+
1970
+def namegen_destroy() :
1971
+    _lib.TCOD_namegen_destroy()
1972
+
1973
+
0 1974
new file mode 100755
1 1975
Binary files /dev/null and b/libtcodxx.dylib differ
2 1976
new file mode 100644
... ...
@@ -0,0 +1,138 @@
1
+import os
2
+if __name__ == '__main__':
3
+	HOME=os.environ['HOME']
4
+	execfile(os.path.join(HOME, 'python_envs', 'roguelike', 'bin', 'activate_this.py'),
5
+				dict(__file__=os.path.join(HOME, 'python_envs', 'roguelike', 'bin', 'activate_this.py')))
6
+
7
+import scipy.signal
8
+import random
9
+#random.seed(2)
10
+
11
+import libtcodpy as tc
12
+import numpy as np
13
+import scipy.signal as sig
14
+
15
+from src import console
16
+from src import events
17
+from gui import text_display
18
+
19
+import random
20
+import bisect
21
+
22
+from twisted.internet import reactor
23
+import twisted.internet
24
+
25
+
26
+WIDTH = 155
27
+HEIGHT = 87
28
+
29
+def scale_array(arr, min, max):
30
+	omin, omax = arr.min(), arr.max()
31
+	arr -= omin
32
+	arr *= (max - min)
33
+	arr /= (omax - omin)
34
+	arr += min
35
+	return arr
36
+
37
+cm = np.array([[1,1,1],[1,0,1],[1,1,1]])
38
+#cm = np.random.random_integers(0,np.random.random_integers(1,3), (3,3))
39
+gens = 0
40
+def change(arr):
41
+	global gens
42
+	gens += 1
43
+	live = arr == 1
44
+	new = sig.convolve2d(arr,cm,'same')
45
+	new = sig.convolve2d(arr,cm,'same', 'wrap')
46
+	arr[live & (new < 2)] = 0
47
+	arr[live & (new > 3)] = 0
48
+	arr[new == 3] = 1
49
+
50
+pattern = np.array(
51
+	[
52
+		[0,0,0,0,0,0,0],
53
+		[0,0,0,1,0,0,0],
54
+		[0,1,1,0,0,0,0],
55
+		[0,0,1,0,0,0,0],
56
+		[0,1,0,0,1,0,0],
57
+		[0,0,0,0,0,1,0],
58
+		[0,0,1,0,0,1,0],
59
+		[0,0,0,1,0,1,0],
60
+		[0,0,1,0,0,0,0],
61
+		[0,0,0,0,0,0,0]
62
+	]
63
+)
64
+			
65
+class Application(object):
66
+	def __init__(self):
67
+		self.screen = console.Screen(WIDTH, HEIGHT+5)
68
+		self.console = console.Console(WIDTH, HEIGHT, self.screen)
69
+		self.border = console.Console(WIDTH, 5, self.screen, (0,HEIGHT))
70
+		self.message_console = console.Console(WIDTH-2, 5, self.screen, (1,HEIGHT))
71
+		self.messages = text_display.MessageBox(self.message_console, 5, (22,0), 'msg')
72
+		self.fps_display = text_display.Label(self.message_console, (0,0), None)
73
+		self.generations = text_display.Label(self.message_console, (0,1), None)
74
+		self.rule = text_display.Array2DDisplay(self.message_console, (5,0), None)
75
+		self.rule.associate(cm)
76
+
77
+		self.tc_events = events.TCODEventHandler()
78
+		self.events = events.EventHandler()
79
+
80
+		#tc.sys_set_fps(30)
81
+		#self.arr = np.random.random_integers(0,1,(HEIGHT,WIDTH))
82
+		self.arr = np.zeros((HEIGHT,WIDTH))
83
+		self.arr[HEIGHT/2-5:HEIGHT/2+5,WIDTH/2-4:WIDTH/2+3] = pattern
84
+
85
+	def tick_actor(self, actor):
86
+		keep = actor.tick()
87
+		if not keep:
88
+			self.actors.remove(actor)
89
+			self.objects.append(actor)
90
+
91
+	def update_actors(self):
92
+		self.player.tick()
93
+
94
+	def tick_actors(self, player):
95
+		print 'actor_tick'
96
+		to_pop = []
97
+		for idx,actor in enumerate(self.actors[1:],1):
98
+			if not actor.tick():
99
+				bisect.insort(to_pop, idx)
100
+		for pop in reversed(to_pop):
101
+			actor = self.actors.pop(pop)
102
+			self.objects.append(actor)
103
+
104
+	def init(self):
105
+		self.screen.init("test")
106
+		self.border.fill(0,0,64)
107
+		self.border.blit()
108
+		self.message_console.fill(0,0,128)
109
+		self.rule.update()
110
+		#self.player.draw()
111
+		#for overlay in self.actors + self.objects:
112
+		#   overlay.draw()
113
+
114
+	def tick(self):
115
+		self.tc_events.tick()
116
+		self.fps_display.set_text('%d', tc.sys_get_fps())
117
+		self.generations.set_text('%d' % gens)
118
+		#self.update_actors()
119
+		#self.map.draw(self.console)
120
+		#change(self.arr)
121
+		c = self.arr*255
122
+		tc.console_fill_background(self.console.con, c,c,c)
123
+
124
+		self.console.blit()
125
+		self.message_console.blit()
126
+		tc.console_flush()
127
+		if tc.console_is_window_closed():
128
+			reactor.stop()
129
+		else:
130
+			reactor.callLater(0, self.tick)
131
+
132
+
133
+if __name__ == '__main__':
134
+	app = Application()
135
+	app.init()
136
+	reactor.callWhenRunning(app.tick)
137
+	reactor.run()
138
+
0 139
new file mode 100644
... ...
@@ -0,0 +1,17 @@
1
+import numpy as np
2
+from scipy import signal
3
+
4
+class SmellMap(object):
5
+	def __init__(self, size_x, size_y):
6
+		self.map = np.zeros((size_x, size_y), int)
7
+	def tick(self):
8
+		self.map -= 1
9
+		self.map[self.map<0] = 0
10
+	def impress(self, pos, degree):
11
+		self.map[pos] = degree
12
+	def get_move(self, pos):
13
+		x,y = pos
14
+		neighbours = self.map[x-1:x+2,y-1:y+2]
15
+		neighbours[1,1] = 0
16
+		dx,dy = np.unravel_index(neighbours.argmax(), neighbours.shape)
17
+		return dx-1, dy-1
1 19
new file mode 100644
... ...
@@ -0,0 +1,55 @@
1
+import libtcodpy as tc
2
+import numpy as np
3
+
4
+class Console(object):
5
+	# TBI: must have a self.con member with the console to be drawn on
6
+	@property
7
+	def dim(self):
8
+		return self.width, self.height
9
+
10
+	def __init__(self, w,h, parent=None, offset=(0,0)):
11
+		self.width = w
12
+		self.height = h
13
+		self.offset = offset
14
+		self.parent = parent
15
+
16
+		if parent is None:
17
+			self.con = 0
18
+		else:
19
+			self.con = tc.console_new(w,h)
20
+
21
+	def blit(self):
22
+		if self.parent is not None:
23
+			xdst,ydst = self.offset
24
+			tc.console_blit(self.con, 0,0, self.width, self.height, self.parent.con, xdst,ydst)
25
+
26
+	def set_bg(self, r,g,b):
27
+		tc.console_set_default_background(self.con, r,g,b)
28
+
29
+	def set_fg(self, r,g,b):
30
+		tc.console_set_default_foreground(self.con, r,g,b)
31
+
32
+	def clear(self):
33
+		tc.console_clear(self.con)
34
+
35
+	def fill(self, r,g,b):
36
+		r = np.ones(self.dim) * r
37
+		g = np.ones(self.dim) * g
38
+		b = np.ones(self.dim) * b
39
+		tc.console_fill_background(self.con, r,g,b)
40
+
41
+	def print_(self, pos, msg, *fmt):
42
+		x,y = pos
43
+		tc.console_print(self.con, x,y, msg % fmt)
44
+
45
+
46
+
47
+
48
+class Screen(Console):
49
+	# Root console
50
+	def init(self, title, fullscreen=False):
51
+		tc.console_init_root(self.width, self.height, title, fullscreen, 2)
52
+		return self
53
+
54
+	def flush(self):
55
+		tc.console_flush()
0 56
new file mode 100644
... ...
@@ -0,0 +1,44 @@
1
+import libtcodpy as tc
2
+import collections
3
+
4
+class EventHandler(object):
5
+	events = {}
6
+	def register_event(self, event):
7
+		return self.events.setdefault(event, [])
8
+	def handle_event(self, event, cb, *a, **kw):
9
+		cbs = self.register_event(event)
10
+		cbs.append( (cb, a, kw) )
11
+	def trigger_event(self, event, *a, **kw):
12
+		for cb, args, kwargs in self.events.get(event,[]):
13
+			kw.update(kwargs)
14
+			a += args
15
+			result = cb(*a, **kw)
16
+			if result is not None and not result: break
17
+
18
+
19
+class TCODEventHandler(object):
20
+	def __init__(self):
21
+		self.key = tc.Key()
22
+		self.mouse = tc.Mouse()
23
+		self.cbs = {}
24
+
25
+	def register(self, event, cb):
26
+		self.cbs.setdefault(event,[]).append(cb)
27
+
28
+	def tick(self):
29
+		tc.sys_check_for_event(tc.EVENT_KEY_PRESS|tc.EVENT_MOUSE|tc.KEY_PRESSED,
30
+			self.key, self.mouse
31
+		)
32
+
33
+		alt, shift, ctrl = self.key.lalt|self.key.ralt, self.key.shift, self.key.lctrl|self.key.rctrl
34
+		char = chr(self.key.c)
35
+		if char != '\x00' and char in self.cbs:
36
+			for cb in self.cbs[char]:
37
+				cb(alt,shift,ctrl)
38
+
39
+		elif self.key.vk in self.cbs:
40
+			for cb in self.cbs[self.key.vk]:
41
+				cb(alt,shift,ctrl)
42
+
43
+
44
+
0 45
new file mode 100644
1 46
Binary files /dev/null and b/terminal.png differ