libtcod 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
Binary file
Binary file
@@ -1,11 +1,11 @@
1
- require 'ffi'
2
- require 'libtcod/version'
3
- require 'libtcod/struct'
4
- require 'libtcod/consts'
5
- require 'libtcod/bindings'
6
- require 'libtcod/color_consts'
7
- require 'libtcod/system'
8
- require 'libtcod/console'
9
- require 'libtcod/map'
10
-
11
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
1
+ require 'ffi'
2
+ require 'libtcod/version'
3
+ require 'libtcod/struct'
4
+ require 'libtcod/consts'
5
+ require 'libtcod/bindings'
6
+ require 'libtcod/color_consts'
7
+ require 'libtcod/system'
8
+ require 'libtcod/console'
9
+ require 'libtcod/map'
10
+
11
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
@@ -1,654 +1,657 @@
1
- APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
2
-
3
- module TCOD
4
- extend FFI::Library
5
-
6
- if RUBY_PLATFORM.include?('mingw32')
7
- ffi_lib ['libtcod-mingw', File.join(APP_ROOT, "clib/i686/libtcod-mingw.dll").gsub('/', '\\')]
8
- elsif RUBY_PLATFORM.include?('x86_64')
9
- if RUBY_PLATFORM.include?('darwin')
10
- ffi_lib ['libtcod', File.join(APP_ROOT, "clib/amd64/libtcod.dylib")]
11
- else
12
- ffi_lib ['libtcod', File.join(APP_ROOT, "clib/amd64/libtcod.so")]
13
- end
14
- else
15
- if RUBY_PLATFORM.include?('darwin')
16
- ffi_lib ['libtcod', File.join(APP_ROOT, "clib/i686/libtcod.dylib")]
17
- else
18
- ffi_lib ['libtcod', File.join(APP_ROOT, "clib/i686/libtcod.so")]
19
- end
20
- end
21
-
22
- # Remove redundant namespacing
23
- def self.tcod_function(sym, *args)
24
- attach_function(sym[5..-1].to_sym, sym, *args)
25
- end
26
-
27
- ### Color module
28
- class Color < FFI::Struct
29
- layout :r, :uchar,
30
- :g, :uchar,
31
- :b, :uchar
32
-
33
- def self.rgb(r,g,b)
34
- TCOD.color_RGB(r,g,b)
35
- end
36
-
37
- def self.hsv(h,s,v)
38
- TCOD.color_HSV(h,s,v)
39
- end
40
-
41
- def ==(col)
42
- TCOD.color_equals(self, col)
43
- end
44
-
45
- def *(col_or_float)
46
- if col_or_float.is_a? Color
47
- TCOD.color_multiply(self, col_or_float)
48
- else
49
- TCOD.color_multiply_scalar(self, col_or_float)
50
- end
51
- end
52
-
53
- def to_s
54
- "<Color #{self[:r]}, #{self[:g]}, #{self[:b]}>"
55
- end
56
- end
57
-
58
- tcod_function :TCOD_color_RGB, [ :uchar, :uchar, :uchar ], Color.val
59
- tcod_function :TCOD_color_HSV, [ :float, :float, :float ], Color.val
60
- tcod_function :TCOD_color_equals, [ Color.val, Color.val ], :bool
61
- tcod_function :TCOD_color_add, [ Color.val, Color.val ], Color.val
62
- tcod_function :TCOD_color_subtract, [ Color.val, Color.val ], Color.val
63
- tcod_function :TCOD_color_multiply, [ Color.val, Color.val ], Color.val
64
- tcod_function :TCOD_color_multiply_scalar, [ Color.val, :float ], Color.val
65
- tcod_function :TCOD_color_lerp, [ Color.val, Color.val, :float ], Color.val
66
- tcod_function :TCOD_color_set_HSV, [ :pointer, :float, :float, :float ], :void
67
- tcod_function :TCOD_color_get_HSV, [ Color.val, :pointer, :pointer, :pointer ], :void
68
- tcod_function :TCOD_color_get_hue, [ Color.val ], :float
69
- tcod_function :TCOD_color_set_hue, [ :pointer, :float ], :void
70
- tcod_function :TCOD_color_get_saturation, [ Color.val ], :float
71
- tcod_function :TCOD_color_set_saturation, [ :pointer, :float ], :void
72
- tcod_function :TCOD_color_get_value, [ Color.val ], :float
73
- tcod_function :TCOD_color_set_value, [ :pointer, :float ], :void
74
- tcod_function :TCOD_color_shift_hue, [ :pointer, :float ], :void
75
- tcod_function :TCOD_color_scale_HSV, [ :pointer, :float, :float ], :void
76
- tcod_function :TCOD_color_gen_map, [ :pointer, :int, :pointer, :pointer ], :void
77
-
78
- ### Console module
79
- class Key < MethodStruct
80
- layout :vk, :int,
81
- :c, :uchar,
82
- :pressed, :bool,
83
- :lalt, :bool,
84
- :lctrl, :bool,
85
- :ralt, :bool,
86
- :rctrl, :bool,
87
- :shift, :bool
88
-
89
- def c
90
- self[:c].chr
91
- end
92
- end
93
-
94
- TCOD_renderer_t = :int
95
- TCOD_bkgnd_flag_t = :int
96
- TCOD_alignment_t = :int
97
- TCOD_keycode_t = :int
98
- TCOD_colctrl_t = :int
99
- TCOD_console_t = :pointer
100
-
101
- tcod_function :TCOD_console_init_root, [ :int, :int, :string, :bool, TCOD_renderer_t ], :void
102
- tcod_function :TCOD_console_set_window_title, [ :string ], :void
103
- tcod_function :TCOD_console_set_fullscreen, [ :bool ], :void
104
- tcod_function :TCOD_console_is_fullscreen, [ ], :bool
105
- tcod_function :TCOD_console_is_window_closed, [ ], :bool
106
- tcod_function :TCOD_console_set_custom_font, [ :string, :int, :int, :int ], :void
107
- tcod_function :TCOD_console_map_ascii_code_to_font, [ :int, :int, :int ], :void
108
- tcod_function :TCOD_console_map_ascii_codes_to_font, [ :int, :int, :int, :int ], :void
109
- tcod_function :TCOD_console_map_string_to_font, [ :string, :int, :int ], :void
110
- tcod_function :TCOD_console_set_dirty, [ :int, :int, :int, :int ], :void
111
- tcod_function :TCOD_console_set_default_background, [ :pointer, Color.val ], :void
112
- tcod_function :TCOD_console_set_default_foreground, [ :pointer, Color.val ], :void
113
- tcod_function :TCOD_console_clear, [ :pointer ], :void
114
- tcod_function :TCOD_console_set_char_background, [ :pointer, :int, :int, Color.val, TCOD_bkgnd_flag_t ], :void
115
- tcod_function :TCOD_console_set_char_foreground, [ :pointer, :int, :int, Color.val ], :void
116
- tcod_function :TCOD_console_set_char, [ :pointer, :int, :int, :int ], :void
117
- tcod_function :TCOD_console_put_char, [ :pointer, :int, :int, :int, TCOD_bkgnd_flag_t ], :void
118
- tcod_function :TCOD_console_put_char_ex, [ :pointer, :int, :int, :int, Color.val, Color.val ], :void
119
- tcod_function :TCOD_console_set_background_flag, [ :pointer, TCOD_bkgnd_flag_t ], :void
120
- tcod_function :TCOD_console_get_background_flag, [ :pointer ], TCOD_bkgnd_flag_t
121
- tcod_function :TCOD_console_set_alignment, [ :pointer, TCOD_alignment_t ], :void
122
- tcod_function :TCOD_console_get_alignment, [ :pointer ], TCOD_alignment_t
123
- tcod_function :TCOD_console_print, [ :pointer, :int, :int, :string, :varargs ], :void
124
- tcod_function :TCOD_console_print_ex, [ :pointer, :int, :int, TCOD_bkgnd_flag_t, TCOD_alignment_t, :string, :varargs ], :void
125
- tcod_function :TCOD_console_print_rect, [ :pointer, :int, :int, :int, :int, :string, :varargs ], :int
126
- tcod_function :TCOD_console_print_rect_ex, [ :pointer, :int, :int, :int, :int, TCOD_bkgnd_flag_t, TCOD_alignment_t, :string, :varargs ], :int
127
- tcod_function :TCOD_console_get_height_rect, [ :pointer, :int, :int, :int, :int, :string, :varargs ], :int
128
- tcod_function :TCOD_console_rect, [ :pointer, :int, :int, :int, :int, :bool, TCOD_bkgnd_flag_t ], :void
129
- tcod_function :TCOD_console_hline, [ :pointer, :int, :int, :int, TCOD_bkgnd_flag_t ], :void
130
- tcod_function :TCOD_console_vline, [ :pointer, :int, :int, :int, TCOD_bkgnd_flag_t ], :void
131
- tcod_function :TCOD_console_print_frame, [ :pointer, :int, :int, :int, :int, :bool, TCOD_bkgnd_flag_t, :string, :varargs ], :void
132
- tcod_function :TCOD_console_map_string_to_font_utf, [ :pointer, :int, :int ], :void
133
- tcod_function :TCOD_console_print_utf, [ :pointer, :int, :int, :pointer, :varargs ], :void
134
- tcod_function :TCOD_console_print_ex_utf, [ :pointer, :int, :int, TCOD_bkgnd_flag_t, TCOD_alignment_t, :pointer, :varargs ], :void
135
- tcod_function :TCOD_console_print_rect_utf, [ :pointer, :int, :int, :int, :int, :pointer, :varargs ], :int
136
- tcod_function :TCOD_console_print_rect_ex_utf, [ :pointer, :int, :int, :int, :int, TCOD_bkgnd_flag_t, TCOD_alignment_t, :pointer, :varargs ], :int
137
- tcod_function :TCOD_console_get_height_rect_utf, [ :pointer, :int, :int, :int, :int, :pointer, :varargs ], :int
138
- tcod_function :TCOD_console_get_default_background, [ :pointer ], Color.val
139
- tcod_function :TCOD_console_get_default_foreground, [ :pointer ], Color.val
140
- tcod_function :TCOD_console_get_char_background, [ :pointer, :int, :int ], Color.val
141
- tcod_function :TCOD_console_get_char_foreground, [ :pointer, :int, :int ], Color.val
142
- tcod_function :TCOD_console_get_char, [ :pointer, :int, :int ], :int
143
- tcod_function :TCOD_console_set_fade, [ :uchar, Color.val ], :void
144
- tcod_function :TCOD_console_get_fade, [ ], :uchar
145
- tcod_function :TCOD_console_get_fading_color, [ ], Color.val
146
- tcod_function :TCOD_console_flush, [ ], :void
147
- tcod_function :TCOD_console_set_color_control, [ TCOD_colctrl_t, Color.val, Color.val ], :void
148
- tcod_function :TCOD_console_check_for_keypress, [ :int ], Key.val
149
- tcod_function :TCOD_console_wait_for_keypress, [ :bool ], Key.val
150
- tcod_function :TCOD_console_set_keyboard_repeat, [ :int, :int ], :void
151
- tcod_function :TCOD_console_disable_keyboard_repeat, [ ], :void
152
- tcod_function :TCOD_console_is_key_pressed, [ TCOD_keycode_t ], :bool
153
- tcod_function :TCOD_console_from_file, [ :string ], :pointer
154
- tcod_function :TCOD_console_load_asc, [ :pointer, :string ], :bool
155
- tcod_function :TCOD_console_load_apf, [ :pointer, :string ], :bool
156
- tcod_function :TCOD_console_save_asc, [ :pointer, :string ], :bool
157
- tcod_function :TCOD_console_save_apf, [ :pointer, :string ], :bool
158
- tcod_function :TCOD_console_new, [ :int, :int ], :pointer
159
- tcod_function :TCOD_console_get_width, [ :pointer ], :int
160
- tcod_function :TCOD_console_get_height, [ :pointer ], :int
161
- tcod_function :TCOD_console_set_key_color, [ :pointer, Color.val ], :void
162
- tcod_function :TCOD_console_blit, [ :pointer, :int, :int, :int, :int, :pointer, :int, :int, :float, :float ], :void
163
- tcod_function :TCOD_console_delete, [ :pointer ], :void
164
- tcod_function :TCOD_console_credits, [ ], :void
165
- tcod_function :TCOD_console_credits_reset, [ ], :void
166
- tcod_function :TCOD_console_credits_render, [ :int, :int, :bool ], :bool
167
-
168
- ### System module
169
- EVENT_KEY_PRESS = 1
170
- EVENT_MOUSE_RELEASE = 16
171
- EVENT_KEY_RELEASE = 2
172
- EVENT_MOUSE_MOVE = 4
173
- EVENT_MOUSE_PRESS = 8
174
- EVENT_MOUSE = EVENT_MOUSE_MOVE|EVENT_MOUSE_PRESS|EVENT_MOUSE_RELEASE
175
- EVENT_KEY = EVENT_KEY_PRESS|EVENT_KEY_RELEASE
176
- EVENT_ANY = EVENT_KEY|EVENT_MOUSE
177
-
178
- TCOD_image_t = :pointer
179
- TCOD_list_t = :pointer
180
-
181
- tcod_function :TCOD_sys_elapsed_milli, [ ], :uint32
182
- tcod_function :TCOD_sys_elapsed_seconds, [ ], :float
183
- tcod_function :TCOD_sys_sleep_milli, [ :uint32 ], :void
184
- tcod_function :TCOD_sys_save_screenshot, [ :string ], :void
185
- tcod_function :TCOD_sys_force_fullscreen_resolution, [ :int, :int ], :void
186
- tcod_function :TCOD_sys_set_renderer, [ TCOD_renderer_t ], :void
187
- tcod_function :TCOD_sys_get_renderer, [ ], TCOD_renderer_t
188
- tcod_function :TCOD_sys_set_fps, [ :int ], :void
189
- tcod_function :TCOD_sys_get_fps, [ ], :int
190
- tcod_function :TCOD_sys_get_last_frame_length, [ ], :float
191
- tcod_function :TCOD_sys_get_current_resolution, [ :pointer, :pointer ], :void
192
- tcod_function :TCOD_sys_get_fullscreen_offsets, [ :pointer, :pointer ], :void
193
- tcod_function :TCOD_sys_update_char, [ :int, :int, :int, TCOD_image_t, :int, :int ], :void
194
- tcod_function :TCOD_sys_get_char_size, [ :pointer, :pointer ], :void
195
- #tcod_function :TCOD_sys_get_sdl_window, [ ], :pointer
196
-
197
- tcod_function :TCOD_sys_wait_for_event, [ :int, :pointer, :pointer, :bool ], :int
198
- tcod_function :TCOD_sys_check_for_event, [ :int, :pointer, :pointer ], :int
199
- tcod_function :TCOD_sys_create_directory, [ :string ], :bool
200
- tcod_function :TCOD_sys_delete_file, [ :string ], :bool
201
- tcod_function :TCOD_sys_delete_directory, [ :string ], :bool
202
- tcod_function :TCOD_sys_is_directory, [ :string ], :bool
203
- tcod_function :TCOD_sys_get_directory_content, [ :string, :string ], TCOD_list_t
204
- tcod_function :TCOD_sys_file_exists, [ :string, :varargs ], :bool
205
- tcod_function :TCOD_sys_read_file, [ :string, :pointer, :pointer ], :bool
206
- tcod_function :TCOD_sys_write_file, [ :string, :pointer, :uint32 ], :bool
207
- tcod_function :TCOD_sys_clipboard_set, [ :string ], :void
208
- tcod_function :TCOD_sys_clipboard_get, [ ], :string
209
- tcod_function :TCOD_thread_new, [ callback([ :pointer ], :int), :pointer ], :pointer
210
- tcod_function :TCOD_thread_delete, [ :pointer ], :void
211
- tcod_function :TCOD_sys_get_num_cores, [ ], :int
212
- tcod_function :TCOD_thread_wait, [ :pointer ], :void
213
- tcod_function :TCOD_mutex_new, [ ], :pointer
214
- tcod_function :TCOD_mutex_in, [ :pointer ], :void
215
- tcod_function :TCOD_mutex_out, [ :pointer ], :void
216
- tcod_function :TCOD_mutex_delete, [ :pointer ], :void
217
- tcod_function :TCOD_semaphore_new, [ :int ], :pointer
218
- tcod_function :TCOD_semaphore_lock, [ :pointer ], :void
219
- tcod_function :TCOD_semaphore_unlock, [ :pointer ], :void
220
- tcod_function :TCOD_semaphore_delete, [ :pointer ], :void
221
- tcod_function :TCOD_condition_new, [ ], :pointer
222
- tcod_function :TCOD_condition_signal, [ :pointer ], :void
223
- tcod_function :TCOD_condition_broadcast, [ :pointer ], :void
224
- tcod_function :TCOD_condition_wait, [ :pointer, :pointer ], :void
225
- tcod_function :TCOD_condition_delete, [ :pointer ], :void
226
- tcod_function :TCOD_load_library, [ :string ], :pointer
227
- tcod_function :TCOD_get_function_address, [ :pointer, :string ], :pointer
228
- tcod_function :TCOD_close_library, [ :pointer ], :void
229
- callback(:SDL_renderer_t, [ :pointer ], :void)
230
- tcod_function :TCOD_sys_register_SDL_renderer, [ :SDL_renderer_t ], :void
231
-
232
- ### Line module
233
- class BresenhamData < MethodStruct
234
- layout(
235
- :stepx, :int,
236
- :stepy, :int,
237
- :e, :int,
238
- :deltax, :int,
239
- :deltay, :int,
240
- :origx, :int,
241
- :origy, :int,
242
- :destx, :int,
243
- :desty, :int
244
- )
245
- end
246
- callback(:TCOD_line_listener_t, [ :int, :int ], :bool)
247
- tcod_function :TCOD_line_init, [ :int, :int, :int, :int ], :void
248
- tcod_function :TCOD_line_step, [ :pointer, :pointer ], :bool
249
- tcod_function :TCOD_line, [ :int, :int, :int, :int, :TCOD_line_listener_t ], :bool
250
- tcod_function :TCOD_line_init_mt, [ :int, :int, :int, :int, :pointer ], :void
251
- tcod_function :TCOD_line_step_mt, [ :pointer, :pointer, :pointer ], :bool
252
- tcod_function :TCOD_line_mt, [ :int, :int, :int, :int, :TCOD_line_listener_t, :pointer ], :bool
253
-
254
- ### Image module
255
- tcod_function :TCOD_image_new, [ :int, :int ], :pointer
256
- tcod_function :TCOD_image_from_console, [ TCOD_console_t ], :pointer
257
- tcod_function :TCOD_image_refresh_console, [ :pointer, TCOD_console_t ], :void
258
- tcod_function :TCOD_image_load, [ :string ], :pointer
259
- tcod_function :TCOD_image_clear, [ :pointer, Color.val ], :void
260
- tcod_function :TCOD_image_invert, [ :pointer ], :void
261
- tcod_function :TCOD_image_hflip, [ :pointer ], :void
262
- tcod_function :TCOD_image_rotate90, [ :pointer, :int ], :void
263
- tcod_function :TCOD_image_vflip, [ :pointer ], :void
264
- tcod_function :TCOD_image_scale, [ :pointer, :int, :int ], :void
265
- tcod_function :TCOD_image_save, [ :pointer, :string ], :void
266
- tcod_function :TCOD_image_get_size, [ :pointer, :pointer, :pointer ], :void
267
- tcod_function :TCOD_image_get_pixel, [ :pointer, :int, :int ], Color.val
268
- tcod_function :TCOD_image_get_alpha, [ :pointer, :int, :int ], :int
269
- tcod_function :TCOD_image_get_mipmap_pixel, [ :pointer, :float, :float, :float, :float ], Color.val
270
- tcod_function :TCOD_image_put_pixel, [ :pointer, :int, :int, Color.val ], :void
271
- tcod_function :TCOD_image_blit, [ :pointer, TCOD_console_t, :float, :float, TCOD_bkgnd_flag_t, :float, :float, :float ], :void
272
- tcod_function :TCOD_image_blit_rect, [ :pointer, TCOD_console_t, :int, :int, :int, :int, TCOD_bkgnd_flag_t ], :void
273
- tcod_function :TCOD_image_blit_2x, [ :pointer, TCOD_console_t, :int, :int, :int, :int, :int, :int ], :void
274
- tcod_function :TCOD_image_delete, [ :pointer ], :void
275
- tcod_function :TCOD_image_set_key_color, [ :pointer, Color.val ], :void
276
- tcod_function :TCOD_image_is_pixel_transparent, [ :pointer, :int, :int ], :bool
277
-
278
- ### Mouse module
279
- class Mouse < MethodStruct
280
- layout(
281
- :x, :int,
282
- :y, :int,
283
- :dx, :int,
284
- :dy, :int,
285
- :cx, :int,
286
- :cy, :int,
287
- :dcx, :int,
288
- :dcy, :int,
289
- :lbutton, :bool,
290
- :rbutton, :bool,
291
- :mbutton, :bool,
292
- :lbutton_pressed, :bool,
293
- :rbutton_pressed, :bool,
294
- :mbutton_pressed, :bool,
295
- :wheel_up, :bool,
296
- :wheel_down, :bool
297
- )
298
- end
299
- tcod_function :TCOD_mouse_show_cursor, [ :bool ], :void
300
- tcod_function :TCOD_mouse_get_status, [ ], Mouse
301
- tcod_function :TCOD_mouse_is_cursor_visible, [ ], :bool
302
- tcod_function :TCOD_mouse_move, [ :int, :int ], :void
303
- #tcod_function :TCOD_mouse_includes_touch, [ :bool ], :void
304
-
305
- ### Parser module
306
- TYPE_NONE = 0
307
- TYPE_BOOL = 1
308
- TYPE_VALUELIST02 = 10
309
- TYPE_LIST = 1024
310
- TYPE_VALUELIST03 = 11
311
- TYPE_VALUELIST04 = 12
312
- TYPE_VALUELIST05 = 13
313
- TYPE_VALUELIST06 = 14
314
- TYPE_VALUELIST07 = 15
315
- TYPE_VALUELIST08 = 16
316
- TYPE_VALUELIST09 = 17
317
- TYPE_VALUELIST10 = 18
318
- TYPE_VALUELIST11 = 19
319
- TYPE_CHAR = 2
320
- TYPE_VALUELIST12 = 20
321
- TYPE_VALUELIST13 = 21
322
- TYPE_VALUELIST14 = 22
323
- TYPE_VALUELIST15 = 23
324
- TYPE_CUSTOM00 = 24
325
- TYPE_CUSTOM01 = 25
326
- TYPE_CUSTOM02 = 26
327
- TYPE_CUSTOM03 = 27
328
- TYPE_CUSTOM04 = 28
329
- TYPE_CUSTOM05 = 29
330
- TYPE_INT = 3
331
- TYPE_CUSTOM06 = 30
332
- TYPE_CUSTOM07 = 31
333
- TYPE_CUSTOM08 = 32
334
- TYPE_CUSTOM09 = 33
335
- TYPE_CUSTOM10 = 34
336
- TYPE_CUSTOM11 = 35
337
- TYPE_CUSTOM12 = 36
338
- TYPE_CUSTOM13 = 37
339
- TYPE_CUSTOM14 = 38
340
- TYPE_CUSTOM15 = 39
341
- TYPE_FLOAT = 4
342
- TYPE_STRING = 5
343
- TYPE_COLOR = 6
344
- TYPE_DICE = 7
345
- TYPE_VALUELIST00 = 8
346
- TYPE_VALUELIST01 = 9
347
-
348
- class Dice < MethodStruct
349
- layout(
350
- :nb_rolls, :int,
351
- :nb_faces, :int,
352
- :multiplier, :float,
353
- :addsub, :float
354
- )
355
- end
356
-
357
- class TCODValueT < MethodUnion
358
- layout(
359
- :b, :bool,
360
- :c, :char,
361
- :i, :int32,
362
- :f, :float,
363
- :s, :pointer,
364
- :col, Color,
365
- :dice, Dice,
366
- :list, TCOD_list_t,
367
- :custom, :pointer
368
- )
369
- def s=(str)
370
- @s = FFI::MemoryPointer.from_string(str)
371
- self[:s] = @s
372
- end
373
- def s
374
- @s.get_string(0)
375
- end
376
- end
377
-
378
- class TCODStructIntT < MethodStruct
379
- layout(
380
- :name, :pointer,
381
- :flags, TCOD_list_t,
382
- :props, TCOD_list_t,
383
- :lists, TCOD_list_t,
384
- :structs, TCOD_list_t
385
- )
386
- def name=(str)
387
- @name = FFI::MemoryPointer.from_string(str)
388
- self[:name] = @name
389
- end
390
- def name
391
- @name.get_string(0)
392
- end
393
- end
394
-
395
- callback(:TCOD_parser_custom_t, [ :pointer, :pointer, :pointer, :string ], TCODValueT.val)
396
- class TCODParserIntT < MethodStruct
397
- layout(
398
- :structs, TCOD_list_t,
399
- :customs, [:TCOD_parser_custom_t, 16],
400
- :fatal, :bool,
401
- :props, TCOD_list_t
402
- )
403
- end
404
-
405
- class TCODParserListenerT < MethodStruct
406
- layout(
407
- :new_struct, callback([ :pointer, :string ], :bool),
408
- :new_flag, callback([ :string ], :bool),
409
- :new_property, callback([ :string, :int, TCODValueT ], :bool),
410
- :end_struct, callback([ :pointer, :string ], :bool),
411
- :error, callback([ :string ], :void)
412
- )
413
- end
414
-
415
- tcod_function :TCOD_struct_get_name, [ :pointer ], :string
416
- tcod_function :TCOD_struct_add_property, [ :pointer, :string, :int, :bool ], :void
417
- tcod_function :TCOD_struct_add_list_property, [ :pointer, :string, :int, :bool ], :void
418
- tcod_function :TCOD_struct_add_value_list, [ :pointer, :string, :pointer, :bool ], :void
419
- tcod_function :TCOD_struct_add_value_list_sized, [ :pointer, :string, :pointer, :int, :bool ], :void
420
- tcod_function :TCOD_struct_add_flag, [ :pointer, :string ], :void
421
- tcod_function :TCOD_struct_add_structure, [ :pointer, :pointer ], :void
422
- tcod_function :TCOD_struct_is_mandatory, [ :pointer, :string ], :bool
423
- tcod_function :TCOD_struct_get_type, [ :pointer, :string ], :int
424
-
425
- tcod_function :TCOD_parser_new, [ ], :pointer
426
- tcod_function :TCOD_parser_new_struct, [ :pointer, :string ], :pointer
427
- tcod_function :TCOD_parser_new_custom_type, [ :pointer, :TCOD_parser_custom_t ], :int
428
- tcod_function :TCOD_parser_run, [ :pointer, :string, :pointer ], :void
429
- tcod_function :TCOD_parser_delete, [ :pointer ], :void
430
- tcod_function :TCOD_parser_error, [ :string, :varargs ], :void
431
- tcod_function :TCOD_parser_get_bool_property, [ :pointer, :string ], :bool
432
- tcod_function :TCOD_parser_get_char_property, [ :pointer, :string ], :int
433
- tcod_function :TCOD_parser_get_int_property, [ :pointer, :string ], :int
434
- tcod_function :TCOD_parser_get_float_property, [ :pointer, :string ], :float
435
- tcod_function :TCOD_parser_get_string_property, [ :pointer, :string ], :string
436
- tcod_function :TCOD_parser_get_color_property, [ :pointer, :string ], Color.val
437
- tcod_function :TCOD_parser_get_dice_property, [ :pointer, :string ], Dice.val
438
- tcod_function :TCOD_parser_get_dice_property_py, [ :pointer, :string, :pointer ], :void
439
- tcod_function :TCOD_parser_get_custom_property, [ :pointer, :string ], :pointer
440
- tcod_function :TCOD_parser_get_list_property, [ :pointer, :string, :int ], TCOD_list_t
441
-
442
- tcod_function :TCOD_parse_bool_value, [ ], TCODValueT
443
- tcod_function :TCOD_parse_char_value, [ ], TCODValueT
444
- tcod_function :TCOD_parse_integer_value, [ ], TCODValueT
445
- tcod_function :TCOD_parse_float_value, [ ], TCODValueT
446
- tcod_function :TCOD_parse_string_value, [ ], TCODValueT
447
- tcod_function :TCOD_parse_color_value, [ ], TCODValueT
448
- tcod_function :TCOD_parse_dice_value, [ ], TCODValueT
449
- tcod_function :TCOD_parse_value_list_value, [ :pointer, :int ], TCODValueT
450
- tcod_function :TCOD_parse_property_value, [ :pointer, :pointer, :string, :bool ], TCODValueT
451
-
452
- ### Random module
453
- RNG_MT = 0
454
- RNG_CMWC = 1
455
-
456
- DISTRIBUTION_LINEAR = 0
457
- DISTRIBUTION_GAUSSIAN = 1
458
- DISTRIBUTION_GAUSSIAN_RANGE = 2
459
- DISTRIBUTION_GAUSSIAN_INVERSE = 3
460
- DISTRIBUTION_GAUSSIAN_RANGE_INVERSE = 4
461
-
462
- TCOD_random_algo_t = :int
463
- TCOD_distribution_t = :int
464
- TCOD_random_t = :pointer
465
-
466
- tcod_function :TCOD_random_get_instance, [ ], :pointer
467
- tcod_function :TCOD_random_new, [ TCOD_random_algo_t ], :pointer
468
- tcod_function :TCOD_random_save, [ :pointer ], :pointer
469
- tcod_function :TCOD_random_restore, [ :pointer, :pointer ], :void
470
- tcod_function :TCOD_random_new_from_seed, [ TCOD_random_algo_t, :uint32 ], :pointer
471
- tcod_function :TCOD_random_delete, [ :pointer ], :void
472
- tcod_function :TCOD_random_set_distribution, [ :pointer, TCOD_distribution_t ], :void
473
- tcod_function :TCOD_random_get_int, [ :pointer, :int, :int ], :int
474
- tcod_function :TCOD_random_get_float, [ :pointer, :float, :float ], :float
475
- tcod_function :TCOD_random_get_double, [ :pointer, :double, :double ], :double
476
- tcod_function :TCOD_random_get_int_mean, [ :pointer, :int, :int, :int ], :int
477
- tcod_function :TCOD_random_get_float_mean, [ :pointer, :float, :float, :float ], :float
478
- tcod_function :TCOD_random_get_double_mean, [ :pointer, :double, :double, :double ], :double
479
- tcod_function :TCOD_random_dice_new, [ :string ], Dice.val
480
- tcod_function :TCOD_random_dice_roll, [ :pointer, Dice.val ], :int
481
- tcod_function :TCOD_random_dice_roll_s, [ :pointer, :string ], :int
482
-
483
- ### Noise module
484
- NOISE_DEFAULT_HURST = 0.5
485
- NOISE_DEFAULT_LACUNARITY = 2.0
486
-
487
- NOISE_DEFAULT = 0
488
- NOISE_PERLIN = 1
489
- NOISE_SIMPLEX = 2
490
- NOISE_WAVELET = 4
491
-
492
- tcod_function :TCOD_noise_new, [ :int, :float, :float, TCOD_random_t ], :pointer
493
- tcod_function :TCOD_noise_set_type, [ :pointer, :int ], :void
494
- tcod_function :TCOD_noise_get_ex, [ :pointer, :pointer, :int ], :float
495
- tcod_function :TCOD_noise_get_fbm_ex, [ :pointer, :pointer, :float, :int ], :float
496
- tcod_function :TCOD_noise_get_turbulence_ex, [ :pointer, :pointer, :float, :int ], :float
497
- tcod_function :TCOD_noise_get, [ :pointer, :pointer ], :float
498
- tcod_function :TCOD_noise_get_fbm, [ :pointer, :pointer, :float ], :float
499
- tcod_function :TCOD_noise_get_turbulence, [ :pointer, :pointer, :float ], :float
500
- tcod_function :TCOD_noise_delete, [ :pointer ], :void
501
-
502
- ### FOV module
503
- FOV_BASIC = 0
504
- FOV_DIAMOND = 1
505
- FOV_SHADOW = 2
506
- FOV_PERMISSIVE_0 = 3
507
- FOV_PERMISSIVE_1 = 4
508
- FOV_PERMISSIVE_2 = 5
509
- FOV_PERMISSIVE_3 = 6
510
- FOV_PERMISSIVE_4 = 7
511
- FOV_PERMISSIVE_5 = 8
512
- FOV_PERMISSIVE_6 = 9
513
- FOV_PERMISSIVE_7 = 10
514
- FOV_PERMISSIVE_8 = 11
515
- FOV_RESTRICTIVE = 12
516
- NB_FOV_ALGORITHMS = 13
517
-
518
- TCOD_fov_algorithm_t = :int
519
-
520
- tcod_function :TCOD_map_new, [ :int, :int ], :pointer
521
- tcod_function :TCOD_map_clear, [ :pointer, :bool, :bool ], :void
522
- tcod_function :TCOD_map_copy, [ :pointer, :pointer ], :void
523
- tcod_function :TCOD_map_set_properties, [ :pointer, :int, :int, :bool, :bool ], :void
524
- tcod_function :TCOD_map_delete, [ :pointer ], :void
525
- tcod_function :TCOD_map_compute_fov, [ :pointer, :int, :int, :int, :bool, TCOD_fov_algorithm_t ], :void
526
- tcod_function :TCOD_map_is_in_fov, [ :pointer, :int, :int ], :bool
527
- tcod_function :TCOD_map_set_in_fov, [ :pointer, :int, :int, :bool ], :void
528
- tcod_function :TCOD_map_is_transparent, [ :pointer, :int, :int ], :bool
529
- tcod_function :TCOD_map_is_walkable, [ :pointer, :int, :int ], :bool
530
- tcod_function :TCOD_map_get_width, [ :pointer ], :int
531
- tcod_function :TCOD_map_get_height, [ :pointer ], :int
532
- tcod_function :TCOD_map_get_nb_cells, [ :pointer ], :int
533
-
534
- ### Pathfinding module
535
- TCOD_map_t = :pointer
536
-
537
- callback(:TCOD_path_func_t, [ :int, :int, :int, :int, :pointer ], :float)
538
- tcod_function :TCOD_path_new_using_map, [ TCOD_map_t, :float ], :pointer
539
- tcod_function :TCOD_path_new_using_function, [ :int, :int, :TCOD_path_func_t, :pointer, :float ], :pointer
540
- tcod_function :TCOD_path_compute, [ :pointer, :int, :int, :int, :int ], :bool
541
- tcod_function :TCOD_path_walk, [ :pointer, :pointer, :pointer, :bool ], :bool
542
- tcod_function :TCOD_path_is_empty, [ :pointer ], :bool
543
- tcod_function :TCOD_path_size, [ :pointer ], :int
544
- tcod_function :TCOD_path_reverse, [ :pointer ], :void
545
- tcod_function :TCOD_path_get, [ :pointer, :int, :pointer, :pointer ], :void
546
- tcod_function :TCOD_path_get_origin, [ :pointer, :pointer, :pointer ], :void
547
- tcod_function :TCOD_path_get_destination, [ :pointer, :pointer, :pointer ], :void
548
- tcod_function :TCOD_path_delete, [ :pointer ], :void
549
- tcod_function :TCOD_dijkstra_new, [ TCOD_map_t, :float ], :pointer
550
- tcod_function :TCOD_dijkstra_new_using_function, [ :int, :int, :TCOD_path_func_t, :pointer, :float ], :pointer
551
- tcod_function :TCOD_dijkstra_compute, [ :pointer, :int, :int ], :void
552
- tcod_function :TCOD_dijkstra_get_distance, [ :pointer, :int, :int ], :float
553
- tcod_function :TCOD_dijkstra_path_set, [ :pointer, :int, :int ], :bool
554
- tcod_function :TCOD_dijkstra_is_empty, [ :pointer ], :bool
555
- tcod_function :TCOD_dijkstra_size, [ :pointer ], :int
556
- tcod_function :TCOD_dijkstra_reverse, [ :pointer ], :void
557
- tcod_function :TCOD_dijkstra_get, [ :pointer, :int, :pointer, :pointer ], :void
558
- tcod_function :TCOD_dijkstra_path_walk, [ :pointer, :pointer, :pointer ], :bool
559
- tcod_function :TCOD_dijkstra_delete, [ :pointer ], :void
560
-
561
- ### BSP module
562
- class TCODTreeT < FFI::Struct
563
- layout(
564
- :next, :pointer,
565
- :father, :pointer,
566
- :sons, :pointer
567
- )
568
- end
569
- tcod_function :TCOD_tree_new, [ ], :pointer
570
- tcod_function :TCOD_tree_add_son, [ :pointer, :pointer ], :void
571
-
572
-
573
- class TCODBspT < MethodStruct
574
- layout(
575
- :tree, TCODTreeT,
576
- :x, :int,
577
- :y, :int,
578
- :w, :int,
579
- :h, :int,
580
- :position, :int,
581
- :level, :uint8,
582
- :horizontal, :bool
583
- )
584
- end
585
- callback(:TCOD_bsp_callback_t, [ :pointer, :pointer ], :bool)
586
- tcod_function :TCOD_bsp_new, [ ], :pointer
587
- tcod_function :TCOD_bsp_new_with_size, [ :int, :int, :int, :int ], :pointer
588
- tcod_function :TCOD_bsp_delete, [ :pointer ], :void
589
- tcod_function :TCOD_bsp_left, [ :pointer ], :pointer
590
- tcod_function :TCOD_bsp_right, [ :pointer ], :pointer
591
- tcod_function :TCOD_bsp_father, [ :pointer ], :pointer
592
- tcod_function :TCOD_bsp_is_leaf, [ :pointer ], :bool
593
- tcod_function :TCOD_bsp_traverse_pre_order, [ :pointer, :TCOD_bsp_callback_t, :pointer ], :bool
594
- tcod_function :TCOD_bsp_traverse_in_order, [ :pointer, :TCOD_bsp_callback_t, :pointer ], :bool
595
- tcod_function :TCOD_bsp_traverse_post_order, [ :pointer, :TCOD_bsp_callback_t, :pointer ], :bool
596
- tcod_function :TCOD_bsp_traverse_level_order, [ :pointer, :TCOD_bsp_callback_t, :pointer ], :bool
597
- tcod_function :TCOD_bsp_traverse_inverted_level_order, [ :pointer, :TCOD_bsp_callback_t, :pointer ], :bool
598
- tcod_function :TCOD_bsp_contains, [ :pointer, :int, :int ], :bool
599
- tcod_function :TCOD_bsp_find_node, [ :pointer, :int, :int ], :pointer
600
- tcod_function :TCOD_bsp_resize, [ :pointer, :int, :int, :int, :int ], :void
601
- tcod_function :TCOD_bsp_split_once, [ :pointer, :bool, :int ], :void
602
- tcod_function :TCOD_bsp_split_recursive, [ :pointer, TCOD_random_t, :int, :int, :int, :float, :float ], :void
603
- tcod_function :TCOD_bsp_remove_sons, [ :pointer ], :void
604
-
605
- ### Heightmap module
606
- class TCODHeightmapT < MethodStruct
607
- layout(
608
- :w, :int,
609
- :h, :int,
610
- :values, :pointer
611
- )
612
- end
613
-
614
- TCOD_noise_t = :pointer
615
- float_3 = :pointer # float n[3]
616
- int_4 = :pointer
617
-
618
- tcod_function :TCOD_heightmap_new, [ :int, :int ], :pointer
619
- tcod_function :TCOD_heightmap_delete, [ :pointer ], :void
620
- tcod_function :TCOD_heightmap_get_value, [ :pointer, :int, :int ], :float
621
- tcod_function :TCOD_heightmap_get_interpolated_value, [ :pointer, :float, :float ], :float
622
- tcod_function :TCOD_heightmap_set_value, [ :pointer, :int, :int, :float ], :void
623
- tcod_function :TCOD_heightmap_get_slope, [ :pointer, :int, :int ], :float
624
- tcod_function :TCOD_heightmap_get_normal, [ :pointer, :float, :float, float_3, :float ], :void
625
- tcod_function :TCOD_heightmap_count_cells, [ :pointer, :float, :float ], :int
626
- tcod_function :TCOD_heightmap_has_land_on_border, [ :pointer, :float ], :bool
627
- tcod_function :TCOD_heightmap_get_minmax, [ :pointer, :pointer, :pointer ], :void
628
- tcod_function :TCOD_heightmap_copy, [ :pointer, :pointer ], :void
629
- tcod_function :TCOD_heightmap_add, [ :pointer, :float ], :void
630
- tcod_function :TCOD_heightmap_scale, [ :pointer, :float ], :void
631
- tcod_function :TCOD_heightmap_clamp, [ :pointer, :float, :float ], :void
632
- tcod_function :TCOD_heightmap_normalize, [ :pointer, :float, :float ], :void
633
- tcod_function :TCOD_heightmap_clear, [ :pointer ], :void
634
- tcod_function :TCOD_heightmap_lerp_hm, [ :pointer, :pointer, :pointer, :float ], :void
635
- tcod_function :TCOD_heightmap_add_hm, [ :pointer, :pointer, :pointer ], :void
636
- tcod_function :TCOD_heightmap_multiply_hm, [ :pointer, :pointer, :pointer ], :void
637
- tcod_function :TCOD_heightmap_add_hill, [ :pointer, :float, :float, :float, :float ], :void
638
- tcod_function :TCOD_heightmap_dig_hill, [ :pointer, :float, :float, :float, :float ], :void
639
- tcod_function :TCOD_heightmap_dig_bezier, [ :pointer, int_4, int_4, :float, :float, :float, :float ], :void
640
- tcod_function :TCOD_heightmap_rain_erosion, [ :pointer, :int, :float, :float, TCOD_random_t ], :void
641
- tcod_function :TCOD_heightmap_kernel_transform, [ :pointer, :int, :pointer, :pointer, :pointer, :float, :float ], :void
642
- tcod_function :TCOD_heightmap_add_voronoi, [ :pointer, :int, :int, :pointer, TCOD_random_t ], :void
643
- tcod_function :TCOD_heightmap_add_fbm, [ :pointer, TCOD_noise_t, :float, :float, :float, :float, :float, :float, :float ], :void
644
- tcod_function :TCOD_heightmap_scale_fbm, [ :pointer, TCOD_noise_t, :float, :float, :float, :float, :float, :float, :float ], :void
645
- tcod_function :TCOD_heightmap_islandify, [ :pointer, :float, TCOD_random_t ], :void
646
-
647
-
648
- ### Name Generator module
649
- tcod_function :TCOD_namegen_parse, [ :string, TCOD_random_t ], :void
650
- tcod_function :TCOD_namegen_generate, [ :string, :bool ], :string
651
- tcod_function :TCOD_namegen_generate_custom, [ :string, :string, :bool ], :string
652
- tcod_function :TCOD_namegen_get_sets, [ ], TCOD_list_t
653
- tcod_function :TCOD_namegen_destroy, [ ], :void
654
- end
1
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
2
+
3
+ module TCOD
4
+ extend FFI::Library
5
+
6
+ libname = 'libtcod'
7
+ ext = RUBY_PLATFORM.include?('darwin') ? '.dylib' : '.so'
8
+
9
+ case RUBY_PLATFORM
10
+ when /mingw32/
11
+ libname = 'libtcod-mingw'
12
+ ext = '-mingw.dll'
13
+ platform = 'i686'
14
+ when /powerpc/
15
+ platform = 'powerpc'
16
+ when /x86_64/
17
+ platform = 'amd64'
18
+ when /i.86/
19
+ platform = 'i686'
20
+ end
21
+
22
+ libpath = File.join(APP_ROOT, 'clib', platform, "libtcod#{ext}")
23
+ ffi_lib [libname, libpath]
24
+
25
+ # Remove redundant namespacing
26
+ def self.tcod_function(sym, *args)
27
+ attach_function(sym[5..-1].to_sym, sym, *args)
28
+ end
29
+
30
+ ### Color module
31
+ class Color < FFI::Struct
32
+ layout :r, :uchar,
33
+ :g, :uchar,
34
+ :b, :uchar
35
+
36
+ def self.rgb(r,g,b)
37
+ TCOD.color_RGB(r,g,b)
38
+ end
39
+
40
+ def self.hsv(h,s,v)
41
+ TCOD.color_HSV(h,s,v)
42
+ end
43
+
44
+ def ==(col)
45
+ TCOD.color_equals(self, col)
46
+ end
47
+
48
+ def *(col_or_float)
49
+ if col_or_float.is_a? Color
50
+ TCOD.color_multiply(self, col_or_float)
51
+ else
52
+ TCOD.color_multiply_scalar(self, col_or_float)
53
+ end
54
+ end
55
+
56
+ def to_s
57
+ "<Color #{self[:r]}, #{self[:g]}, #{self[:b]}>"
58
+ end
59
+ end
60
+
61
+ tcod_function :TCOD_color_RGB, [ :uchar, :uchar, :uchar ], Color.val
62
+ tcod_function :TCOD_color_HSV, [ :float, :float, :float ], Color.val
63
+ tcod_function :TCOD_color_equals, [ Color.val, Color.val ], :bool
64
+ tcod_function :TCOD_color_add, [ Color.val, Color.val ], Color.val
65
+ tcod_function :TCOD_color_subtract, [ Color.val, Color.val ], Color.val
66
+ tcod_function :TCOD_color_multiply, [ Color.val, Color.val ], Color.val
67
+ tcod_function :TCOD_color_multiply_scalar, [ Color.val, :float ], Color.val
68
+ tcod_function :TCOD_color_lerp, [ Color.val, Color.val, :float ], Color.val
69
+ tcod_function :TCOD_color_set_HSV, [ :pointer, :float, :float, :float ], :void
70
+ tcod_function :TCOD_color_get_HSV, [ Color.val, :pointer, :pointer, :pointer ], :void
71
+ tcod_function :TCOD_color_get_hue, [ Color.val ], :float
72
+ tcod_function :TCOD_color_set_hue, [ :pointer, :float ], :void
73
+ tcod_function :TCOD_color_get_saturation, [ Color.val ], :float
74
+ tcod_function :TCOD_color_set_saturation, [ :pointer, :float ], :void
75
+ tcod_function :TCOD_color_get_value, [ Color.val ], :float
76
+ tcod_function :TCOD_color_set_value, [ :pointer, :float ], :void
77
+ tcod_function :TCOD_color_shift_hue, [ :pointer, :float ], :void
78
+ tcod_function :TCOD_color_scale_HSV, [ :pointer, :float, :float ], :void
79
+ tcod_function :TCOD_color_gen_map, [ :pointer, :int, :pointer, :pointer ], :void
80
+
81
+ ### Console module
82
+ class Key < MethodStruct
83
+ layout :vk, :int,
84
+ :c, :uchar,
85
+ :pressed, :bool,
86
+ :lalt, :bool,
87
+ :lctrl, :bool,
88
+ :ralt, :bool,
89
+ :rctrl, :bool,
90
+ :shift, :bool
91
+
92
+ def c
93
+ self[:c].chr
94
+ end
95
+ end
96
+
97
+ TCOD_renderer_t = :int
98
+ TCOD_bkgnd_flag_t = :int
99
+ TCOD_alignment_t = :int
100
+ TCOD_keycode_t = :int
101
+ TCOD_colctrl_t = :int
102
+ TCOD_console_t = :pointer
103
+
104
+ tcod_function :TCOD_console_init_root, [ :int, :int, :string, :bool, TCOD_renderer_t ], :void
105
+ tcod_function :TCOD_console_set_window_title, [ :string ], :void
106
+ tcod_function :TCOD_console_set_fullscreen, [ :bool ], :void
107
+ tcod_function :TCOD_console_is_fullscreen, [ ], :bool
108
+ tcod_function :TCOD_console_is_window_closed, [ ], :bool
109
+ tcod_function :TCOD_console_set_custom_font, [ :string, :int, :int, :int ], :void
110
+ tcod_function :TCOD_console_map_ascii_code_to_font, [ :int, :int, :int ], :void
111
+ tcod_function :TCOD_console_map_ascii_codes_to_font, [ :int, :int, :int, :int ], :void
112
+ tcod_function :TCOD_console_map_string_to_font, [ :string, :int, :int ], :void
113
+ tcod_function :TCOD_console_set_dirty, [ :int, :int, :int, :int ], :void
114
+ tcod_function :TCOD_console_set_default_background, [ :pointer, Color.val ], :void
115
+ tcod_function :TCOD_console_set_default_foreground, [ :pointer, Color.val ], :void
116
+ tcod_function :TCOD_console_clear, [ :pointer ], :void
117
+ tcod_function :TCOD_console_set_char_background, [ :pointer, :int, :int, Color.val, TCOD_bkgnd_flag_t ], :void
118
+ tcod_function :TCOD_console_set_char_foreground, [ :pointer, :int, :int, Color.val ], :void
119
+ tcod_function :TCOD_console_set_char, [ :pointer, :int, :int, :int ], :void
120
+ tcod_function :TCOD_console_put_char, [ :pointer, :int, :int, :int, TCOD_bkgnd_flag_t ], :void
121
+ tcod_function :TCOD_console_put_char_ex, [ :pointer, :int, :int, :int, Color.val, Color.val ], :void
122
+ tcod_function :TCOD_console_set_background_flag, [ :pointer, TCOD_bkgnd_flag_t ], :void
123
+ tcod_function :TCOD_console_get_background_flag, [ :pointer ], TCOD_bkgnd_flag_t
124
+ tcod_function :TCOD_console_set_alignment, [ :pointer, TCOD_alignment_t ], :void
125
+ tcod_function :TCOD_console_get_alignment, [ :pointer ], TCOD_alignment_t
126
+ tcod_function :TCOD_console_print, [ :pointer, :int, :int, :string, :varargs ], :void
127
+ tcod_function :TCOD_console_print_ex, [ :pointer, :int, :int, TCOD_bkgnd_flag_t, TCOD_alignment_t, :string, :varargs ], :void
128
+ tcod_function :TCOD_console_print_rect, [ :pointer, :int, :int, :int, :int, :string, :varargs ], :int
129
+ tcod_function :TCOD_console_print_rect_ex, [ :pointer, :int, :int, :int, :int, TCOD_bkgnd_flag_t, TCOD_alignment_t, :string, :varargs ], :int
130
+ tcod_function :TCOD_console_get_height_rect, [ :pointer, :int, :int, :int, :int, :string, :varargs ], :int
131
+ tcod_function :TCOD_console_rect, [ :pointer, :int, :int, :int, :int, :bool, TCOD_bkgnd_flag_t ], :void
132
+ tcod_function :TCOD_console_hline, [ :pointer, :int, :int, :int, TCOD_bkgnd_flag_t ], :void
133
+ tcod_function :TCOD_console_vline, [ :pointer, :int, :int, :int, TCOD_bkgnd_flag_t ], :void
134
+ tcod_function :TCOD_console_print_frame, [ :pointer, :int, :int, :int, :int, :bool, TCOD_bkgnd_flag_t, :string, :varargs ], :void
135
+ tcod_function :TCOD_console_map_string_to_font_utf, [ :pointer, :int, :int ], :void
136
+ tcod_function :TCOD_console_print_utf, [ :pointer, :int, :int, :pointer, :varargs ], :void
137
+ tcod_function :TCOD_console_print_ex_utf, [ :pointer, :int, :int, TCOD_bkgnd_flag_t, TCOD_alignment_t, :pointer, :varargs ], :void
138
+ tcod_function :TCOD_console_print_rect_utf, [ :pointer, :int, :int, :int, :int, :pointer, :varargs ], :int
139
+ tcod_function :TCOD_console_print_rect_ex_utf, [ :pointer, :int, :int, :int, :int, TCOD_bkgnd_flag_t, TCOD_alignment_t, :pointer, :varargs ], :int
140
+ tcod_function :TCOD_console_get_height_rect_utf, [ :pointer, :int, :int, :int, :int, :pointer, :varargs ], :int
141
+ tcod_function :TCOD_console_get_default_background, [ :pointer ], Color.val
142
+ tcod_function :TCOD_console_get_default_foreground, [ :pointer ], Color.val
143
+ tcod_function :TCOD_console_get_char_background, [ :pointer, :int, :int ], Color.val
144
+ tcod_function :TCOD_console_get_char_foreground, [ :pointer, :int, :int ], Color.val
145
+ tcod_function :TCOD_console_get_char, [ :pointer, :int, :int ], :int
146
+ tcod_function :TCOD_console_set_fade, [ :uchar, Color.val ], :void
147
+ tcod_function :TCOD_console_get_fade, [ ], :uchar
148
+ tcod_function :TCOD_console_get_fading_color, [ ], Color.val
149
+ tcod_function :TCOD_console_flush, [ ], :void
150
+ tcod_function :TCOD_console_set_color_control, [ TCOD_colctrl_t, Color.val, Color.val ], :void
151
+ tcod_function :TCOD_console_check_for_keypress, [ :int ], Key.val
152
+ tcod_function :TCOD_console_wait_for_keypress, [ :bool ], Key.val
153
+ tcod_function :TCOD_console_set_keyboard_repeat, [ :int, :int ], :void
154
+ tcod_function :TCOD_console_disable_keyboard_repeat, [ ], :void
155
+ tcod_function :TCOD_console_is_key_pressed, [ TCOD_keycode_t ], :bool
156
+ tcod_function :TCOD_console_from_file, [ :string ], :pointer
157
+ tcod_function :TCOD_console_load_asc, [ :pointer, :string ], :bool
158
+ tcod_function :TCOD_console_load_apf, [ :pointer, :string ], :bool
159
+ tcod_function :TCOD_console_save_asc, [ :pointer, :string ], :bool
160
+ tcod_function :TCOD_console_save_apf, [ :pointer, :string ], :bool
161
+ tcod_function :TCOD_console_new, [ :int, :int ], :pointer
162
+ tcod_function :TCOD_console_get_width, [ :pointer ], :int
163
+ tcod_function :TCOD_console_get_height, [ :pointer ], :int
164
+ tcod_function :TCOD_console_set_key_color, [ :pointer, Color.val ], :void
165
+ tcod_function :TCOD_console_blit, [ :pointer, :int, :int, :int, :int, :pointer, :int, :int, :float, :float ], :void
166
+ tcod_function :TCOD_console_delete, [ :pointer ], :void
167
+ tcod_function :TCOD_console_credits, [ ], :void
168
+ tcod_function :TCOD_console_credits_reset, [ ], :void
169
+ tcod_function :TCOD_console_credits_render, [ :int, :int, :bool ], :bool
170
+
171
+ ### System module
172
+ EVENT_KEY_PRESS = 1
173
+ EVENT_MOUSE_RELEASE = 16
174
+ EVENT_KEY_RELEASE = 2
175
+ EVENT_MOUSE_MOVE = 4
176
+ EVENT_MOUSE_PRESS = 8
177
+ EVENT_MOUSE = EVENT_MOUSE_MOVE|EVENT_MOUSE_PRESS|EVENT_MOUSE_RELEASE
178
+ EVENT_KEY = EVENT_KEY_PRESS|EVENT_KEY_RELEASE
179
+ EVENT_ANY = EVENT_KEY|EVENT_MOUSE
180
+
181
+ TCOD_image_t = :pointer
182
+ TCOD_list_t = :pointer
183
+
184
+ tcod_function :TCOD_sys_elapsed_milli, [ ], :uint32
185
+ tcod_function :TCOD_sys_elapsed_seconds, [ ], :float
186
+ tcod_function :TCOD_sys_sleep_milli, [ :uint32 ], :void
187
+ tcod_function :TCOD_sys_save_screenshot, [ :string ], :void
188
+ tcod_function :TCOD_sys_force_fullscreen_resolution, [ :int, :int ], :void
189
+ tcod_function :TCOD_sys_set_renderer, [ TCOD_renderer_t ], :void
190
+ tcod_function :TCOD_sys_get_renderer, [ ], TCOD_renderer_t
191
+ tcod_function :TCOD_sys_set_fps, [ :int ], :void
192
+ tcod_function :TCOD_sys_get_fps, [ ], :int
193
+ tcod_function :TCOD_sys_get_last_frame_length, [ ], :float
194
+ tcod_function :TCOD_sys_get_current_resolution, [ :pointer, :pointer ], :void
195
+ tcod_function :TCOD_sys_get_fullscreen_offsets, [ :pointer, :pointer ], :void
196
+ tcod_function :TCOD_sys_update_char, [ :int, :int, :int, TCOD_image_t, :int, :int ], :void
197
+ tcod_function :TCOD_sys_get_char_size, [ :pointer, :pointer ], :void
198
+ #tcod_function :TCOD_sys_get_sdl_window, [ ], :pointer
199
+
200
+ tcod_function :TCOD_sys_wait_for_event, [ :int, :pointer, :pointer, :bool ], :int
201
+ tcod_function :TCOD_sys_check_for_event, [ :int, :pointer, :pointer ], :int
202
+ tcod_function :TCOD_sys_create_directory, [ :string ], :bool
203
+ tcod_function :TCOD_sys_delete_file, [ :string ], :bool
204
+ tcod_function :TCOD_sys_delete_directory, [ :string ], :bool
205
+ tcod_function :TCOD_sys_is_directory, [ :string ], :bool
206
+ tcod_function :TCOD_sys_get_directory_content, [ :string, :string ], TCOD_list_t
207
+ tcod_function :TCOD_sys_file_exists, [ :string, :varargs ], :bool
208
+ tcod_function :TCOD_sys_read_file, [ :string, :pointer, :pointer ], :bool
209
+ tcod_function :TCOD_sys_write_file, [ :string, :pointer, :uint32 ], :bool
210
+ tcod_function :TCOD_sys_clipboard_set, [ :string ], :void
211
+ tcod_function :TCOD_sys_clipboard_get, [ ], :string
212
+ tcod_function :TCOD_thread_new, [ callback([ :pointer ], :int), :pointer ], :pointer
213
+ tcod_function :TCOD_thread_delete, [ :pointer ], :void
214
+ tcod_function :TCOD_sys_get_num_cores, [ ], :int
215
+ tcod_function :TCOD_thread_wait, [ :pointer ], :void
216
+ tcod_function :TCOD_mutex_new, [ ], :pointer
217
+ tcod_function :TCOD_mutex_in, [ :pointer ], :void
218
+ tcod_function :TCOD_mutex_out, [ :pointer ], :void
219
+ tcod_function :TCOD_mutex_delete, [ :pointer ], :void
220
+ tcod_function :TCOD_semaphore_new, [ :int ], :pointer
221
+ tcod_function :TCOD_semaphore_lock, [ :pointer ], :void
222
+ tcod_function :TCOD_semaphore_unlock, [ :pointer ], :void
223
+ tcod_function :TCOD_semaphore_delete, [ :pointer ], :void
224
+ tcod_function :TCOD_condition_new, [ ], :pointer
225
+ tcod_function :TCOD_condition_signal, [ :pointer ], :void
226
+ tcod_function :TCOD_condition_broadcast, [ :pointer ], :void
227
+ tcod_function :TCOD_condition_wait, [ :pointer, :pointer ], :void
228
+ tcod_function :TCOD_condition_delete, [ :pointer ], :void
229
+ tcod_function :TCOD_load_library, [ :string ], :pointer
230
+ tcod_function :TCOD_get_function_address, [ :pointer, :string ], :pointer
231
+ tcod_function :TCOD_close_library, [ :pointer ], :void
232
+ callback(:SDL_renderer_t, [ :pointer ], :void)
233
+ tcod_function :TCOD_sys_register_SDL_renderer, [ :SDL_renderer_t ], :void
234
+
235
+ ### Line module
236
+ class BresenhamData < MethodStruct
237
+ layout(
238
+ :stepx, :int,
239
+ :stepy, :int,
240
+ :e, :int,
241
+ :deltax, :int,
242
+ :deltay, :int,
243
+ :origx, :int,
244
+ :origy, :int,
245
+ :destx, :int,
246
+ :desty, :int
247
+ )
248
+ end
249
+ callback(:TCOD_line_listener_t, [ :int, :int ], :bool)
250
+ tcod_function :TCOD_line_init, [ :int, :int, :int, :int ], :void
251
+ tcod_function :TCOD_line_step, [ :pointer, :pointer ], :bool
252
+ tcod_function :TCOD_line, [ :int, :int, :int, :int, :TCOD_line_listener_t ], :bool
253
+ tcod_function :TCOD_line_init_mt, [ :int, :int, :int, :int, :pointer ], :void
254
+ tcod_function :TCOD_line_step_mt, [ :pointer, :pointer, :pointer ], :bool
255
+ tcod_function :TCOD_line_mt, [ :int, :int, :int, :int, :TCOD_line_listener_t, :pointer ], :bool
256
+
257
+ ### Image module
258
+ tcod_function :TCOD_image_new, [ :int, :int ], :pointer
259
+ tcod_function :TCOD_image_from_console, [ TCOD_console_t ], :pointer
260
+ tcod_function :TCOD_image_refresh_console, [ :pointer, TCOD_console_t ], :void
261
+ tcod_function :TCOD_image_load, [ :string ], :pointer
262
+ tcod_function :TCOD_image_clear, [ :pointer, Color.val ], :void
263
+ tcod_function :TCOD_image_invert, [ :pointer ], :void
264
+ tcod_function :TCOD_image_hflip, [ :pointer ], :void
265
+ tcod_function :TCOD_image_rotate90, [ :pointer, :int ], :void
266
+ tcod_function :TCOD_image_vflip, [ :pointer ], :void
267
+ tcod_function :TCOD_image_scale, [ :pointer, :int, :int ], :void
268
+ tcod_function :TCOD_image_save, [ :pointer, :string ], :void
269
+ tcod_function :TCOD_image_get_size, [ :pointer, :pointer, :pointer ], :void
270
+ tcod_function :TCOD_image_get_pixel, [ :pointer, :int, :int ], Color.val
271
+ tcod_function :TCOD_image_get_alpha, [ :pointer, :int, :int ], :int
272
+ tcod_function :TCOD_image_get_mipmap_pixel, [ :pointer, :float, :float, :float, :float ], Color.val
273
+ tcod_function :TCOD_image_put_pixel, [ :pointer, :int, :int, Color.val ], :void
274
+ tcod_function :TCOD_image_blit, [ :pointer, TCOD_console_t, :float, :float, TCOD_bkgnd_flag_t, :float, :float, :float ], :void
275
+ tcod_function :TCOD_image_blit_rect, [ :pointer, TCOD_console_t, :int, :int, :int, :int, TCOD_bkgnd_flag_t ], :void
276
+ tcod_function :TCOD_image_blit_2x, [ :pointer, TCOD_console_t, :int, :int, :int, :int, :int, :int ], :void
277
+ tcod_function :TCOD_image_delete, [ :pointer ], :void
278
+ tcod_function :TCOD_image_set_key_color, [ :pointer, Color.val ], :void
279
+ tcod_function :TCOD_image_is_pixel_transparent, [ :pointer, :int, :int ], :bool
280
+
281
+ ### Mouse module
282
+ class Mouse < MethodStruct
283
+ layout(
284
+ :x, :int,
285
+ :y, :int,
286
+ :dx, :int,
287
+ :dy, :int,
288
+ :cx, :int,
289
+ :cy, :int,
290
+ :dcx, :int,
291
+ :dcy, :int,
292
+ :lbutton, :bool,
293
+ :rbutton, :bool,
294
+ :mbutton, :bool,
295
+ :lbutton_pressed, :bool,
296
+ :rbutton_pressed, :bool,
297
+ :mbutton_pressed, :bool,
298
+ :wheel_up, :bool,
299
+ :wheel_down, :bool
300
+ )
301
+ end
302
+ tcod_function :TCOD_mouse_show_cursor, [ :bool ], :void
303
+ tcod_function :TCOD_mouse_get_status, [ ], Mouse.val
304
+ tcod_function :TCOD_mouse_is_cursor_visible, [ ], :bool
305
+ tcod_function :TCOD_mouse_move, [ :int, :int ], :void
306
+ #tcod_function :TCOD_mouse_includes_touch, [ :bool ], :void
307
+
308
+ ### Parser module
309
+ TYPE_NONE = 0
310
+ TYPE_BOOL = 1
311
+ TYPE_VALUELIST02 = 10
312
+ TYPE_LIST = 1024
313
+ TYPE_VALUELIST03 = 11
314
+ TYPE_VALUELIST04 = 12
315
+ TYPE_VALUELIST05 = 13
316
+ TYPE_VALUELIST06 = 14
317
+ TYPE_VALUELIST07 = 15
318
+ TYPE_VALUELIST08 = 16
319
+ TYPE_VALUELIST09 = 17
320
+ TYPE_VALUELIST10 = 18
321
+ TYPE_VALUELIST11 = 19
322
+ TYPE_CHAR = 2
323
+ TYPE_VALUELIST12 = 20
324
+ TYPE_VALUELIST13 = 21
325
+ TYPE_VALUELIST14 = 22
326
+ TYPE_VALUELIST15 = 23
327
+ TYPE_CUSTOM00 = 24
328
+ TYPE_CUSTOM01 = 25
329
+ TYPE_CUSTOM02 = 26
330
+ TYPE_CUSTOM03 = 27
331
+ TYPE_CUSTOM04 = 28
332
+ TYPE_CUSTOM05 = 29
333
+ TYPE_INT = 3
334
+ TYPE_CUSTOM06 = 30
335
+ TYPE_CUSTOM07 = 31
336
+ TYPE_CUSTOM08 = 32
337
+ TYPE_CUSTOM09 = 33
338
+ TYPE_CUSTOM10 = 34
339
+ TYPE_CUSTOM11 = 35
340
+ TYPE_CUSTOM12 = 36
341
+ TYPE_CUSTOM13 = 37
342
+ TYPE_CUSTOM14 = 38
343
+ TYPE_CUSTOM15 = 39
344
+ TYPE_FLOAT = 4
345
+ TYPE_STRING = 5
346
+ TYPE_COLOR = 6
347
+ TYPE_DICE = 7
348
+ TYPE_VALUELIST00 = 8
349
+ TYPE_VALUELIST01 = 9
350
+
351
+ class Dice < MethodStruct
352
+ layout(
353
+ :nb_rolls, :int,
354
+ :nb_faces, :int,
355
+ :multiplier, :float,
356
+ :addsub, :float
357
+ )
358
+ end
359
+
360
+ class TCODValueT < MethodUnion
361
+ layout(
362
+ :b, :bool,
363
+ :c, :char,
364
+ :i, :int32,
365
+ :f, :float,
366
+ :s, :pointer,
367
+ :col, Color,
368
+ :dice, Dice,
369
+ :list, TCOD_list_t,
370
+ :custom, :pointer
371
+ )
372
+ def s=(str)
373
+ @s = FFI::MemoryPointer.from_string(str)
374
+ self[:s] = @s
375
+ end
376
+ def s
377
+ @s.get_string(0)
378
+ end
379
+ end
380
+
381
+ class TCODStructIntT < MethodStruct
382
+ layout(
383
+ :name, :pointer,
384
+ :flags, TCOD_list_t,
385
+ :props, TCOD_list_t,
386
+ :lists, TCOD_list_t,
387
+ :structs, TCOD_list_t
388
+ )
389
+ def name=(str)
390
+ @name = FFI::MemoryPointer.from_string(str)
391
+ self[:name] = @name
392
+ end
393
+ def name
394
+ @name.get_string(0)
395
+ end
396
+ end
397
+
398
+ callback(:TCOD_parser_custom_t, [ :pointer, :pointer, :pointer, :string ], TCODValueT.val)
399
+ class TCODParserIntT < MethodStruct
400
+ layout(
401
+ :structs, TCOD_list_t,
402
+ :customs, [:TCOD_parser_custom_t, 16],
403
+ :fatal, :bool,
404
+ :props, TCOD_list_t
405
+ )
406
+ end
407
+
408
+ class TCODParserListenerT < MethodStruct
409
+ layout(
410
+ :new_struct, callback([ :pointer, :string ], :bool),
411
+ :new_flag, callback([ :string ], :bool),
412
+ :new_property, callback([ :string, :int, TCODValueT ], :bool),
413
+ :end_struct, callback([ :pointer, :string ], :bool),
414
+ :error, callback([ :string ], :void)
415
+ )
416
+ end
417
+
418
+ tcod_function :TCOD_struct_get_name, [ :pointer ], :string
419
+ tcod_function :TCOD_struct_add_property, [ :pointer, :string, :int, :bool ], :void
420
+ tcod_function :TCOD_struct_add_list_property, [ :pointer, :string, :int, :bool ], :void
421
+ tcod_function :TCOD_struct_add_value_list, [ :pointer, :string, :pointer, :bool ], :void
422
+ tcod_function :TCOD_struct_add_value_list_sized, [ :pointer, :string, :pointer, :int, :bool ], :void
423
+ tcod_function :TCOD_struct_add_flag, [ :pointer, :string ], :void
424
+ tcod_function :TCOD_struct_add_structure, [ :pointer, :pointer ], :void
425
+ tcod_function :TCOD_struct_is_mandatory, [ :pointer, :string ], :bool
426
+ tcod_function :TCOD_struct_get_type, [ :pointer, :string ], :int
427
+
428
+ tcod_function :TCOD_parser_new, [ ], :pointer
429
+ tcod_function :TCOD_parser_new_struct, [ :pointer, :string ], :pointer
430
+ tcod_function :TCOD_parser_new_custom_type, [ :pointer, :TCOD_parser_custom_t ], :int
431
+ tcod_function :TCOD_parser_run, [ :pointer, :string, :pointer ], :void
432
+ tcod_function :TCOD_parser_delete, [ :pointer ], :void
433
+ tcod_function :TCOD_parser_error, [ :string, :varargs ], :void
434
+ tcod_function :TCOD_parser_get_bool_property, [ :pointer, :string ], :bool
435
+ tcod_function :TCOD_parser_get_char_property, [ :pointer, :string ], :int
436
+ tcod_function :TCOD_parser_get_int_property, [ :pointer, :string ], :int
437
+ tcod_function :TCOD_parser_get_float_property, [ :pointer, :string ], :float
438
+ tcod_function :TCOD_parser_get_string_property, [ :pointer, :string ], :string
439
+ tcod_function :TCOD_parser_get_color_property, [ :pointer, :string ], Color.val
440
+ tcod_function :TCOD_parser_get_dice_property, [ :pointer, :string ], Dice.val
441
+ tcod_function :TCOD_parser_get_dice_property_py, [ :pointer, :string, :pointer ], :void
442
+ tcod_function :TCOD_parser_get_custom_property, [ :pointer, :string ], :pointer
443
+ tcod_function :TCOD_parser_get_list_property, [ :pointer, :string, :int ], TCOD_list_t
444
+
445
+ tcod_function :TCOD_parse_bool_value, [ ], TCODValueT
446
+ tcod_function :TCOD_parse_char_value, [ ], TCODValueT
447
+ tcod_function :TCOD_parse_integer_value, [ ], TCODValueT
448
+ tcod_function :TCOD_parse_float_value, [ ], TCODValueT
449
+ tcod_function :TCOD_parse_string_value, [ ], TCODValueT
450
+ tcod_function :TCOD_parse_color_value, [ ], TCODValueT
451
+ tcod_function :TCOD_parse_dice_value, [ ], TCODValueT
452
+ tcod_function :TCOD_parse_value_list_value, [ :pointer, :int ], TCODValueT
453
+ tcod_function :TCOD_parse_property_value, [ :pointer, :pointer, :string, :bool ], TCODValueT
454
+
455
+ ### Random module
456
+ RNG_MT = 0
457
+ RNG_CMWC = 1
458
+
459
+ DISTRIBUTION_LINEAR = 0
460
+ DISTRIBUTION_GAUSSIAN = 1
461
+ DISTRIBUTION_GAUSSIAN_RANGE = 2
462
+ DISTRIBUTION_GAUSSIAN_INVERSE = 3
463
+ DISTRIBUTION_GAUSSIAN_RANGE_INVERSE = 4
464
+
465
+ TCOD_random_algo_t = :int
466
+ TCOD_distribution_t = :int
467
+ TCOD_random_t = :pointer
468
+
469
+ tcod_function :TCOD_random_get_instance, [ ], :pointer
470
+ tcod_function :TCOD_random_new, [ TCOD_random_algo_t ], :pointer
471
+ tcod_function :TCOD_random_save, [ :pointer ], :pointer
472
+ tcod_function :TCOD_random_restore, [ :pointer, :pointer ], :void
473
+ tcod_function :TCOD_random_new_from_seed, [ TCOD_random_algo_t, :uint32 ], :pointer
474
+ tcod_function :TCOD_random_delete, [ :pointer ], :void
475
+ tcod_function :TCOD_random_set_distribution, [ :pointer, TCOD_distribution_t ], :void
476
+ tcod_function :TCOD_random_get_int, [ :pointer, :int, :int ], :int
477
+ tcod_function :TCOD_random_get_float, [ :pointer, :float, :float ], :float
478
+ tcod_function :TCOD_random_get_double, [ :pointer, :double, :double ], :double
479
+ tcod_function :TCOD_random_get_int_mean, [ :pointer, :int, :int, :int ], :int
480
+ tcod_function :TCOD_random_get_float_mean, [ :pointer, :float, :float, :float ], :float
481
+ tcod_function :TCOD_random_get_double_mean, [ :pointer, :double, :double, :double ], :double
482
+ tcod_function :TCOD_random_dice_new, [ :string ], Dice.val
483
+ tcod_function :TCOD_random_dice_roll, [ :pointer, Dice.val ], :int
484
+ tcod_function :TCOD_random_dice_roll_s, [ :pointer, :string ], :int
485
+
486
+ ### Noise module
487
+ NOISE_DEFAULT_HURST = 0.5
488
+ NOISE_DEFAULT_LACUNARITY = 2.0
489
+
490
+ NOISE_DEFAULT = 0
491
+ NOISE_PERLIN = 1
492
+ NOISE_SIMPLEX = 2
493
+ NOISE_WAVELET = 4
494
+
495
+ tcod_function :TCOD_noise_new, [ :int, :float, :float, TCOD_random_t ], :pointer
496
+ tcod_function :TCOD_noise_set_type, [ :pointer, :int ], :void
497
+ tcod_function :TCOD_noise_get_ex, [ :pointer, :pointer, :int ], :float
498
+ tcod_function :TCOD_noise_get_fbm_ex, [ :pointer, :pointer, :float, :int ], :float
499
+ tcod_function :TCOD_noise_get_turbulence_ex, [ :pointer, :pointer, :float, :int ], :float
500
+ tcod_function :TCOD_noise_get, [ :pointer, :pointer ], :float
501
+ tcod_function :TCOD_noise_get_fbm, [ :pointer, :pointer, :float ], :float
502
+ tcod_function :TCOD_noise_get_turbulence, [ :pointer, :pointer, :float ], :float
503
+ tcod_function :TCOD_noise_delete, [ :pointer ], :void
504
+
505
+ ### FOV module
506
+ FOV_BASIC = 0
507
+ FOV_DIAMOND = 1
508
+ FOV_SHADOW = 2
509
+ FOV_PERMISSIVE_0 = 3
510
+ FOV_PERMISSIVE_1 = 4
511
+ FOV_PERMISSIVE_2 = 5
512
+ FOV_PERMISSIVE_3 = 6
513
+ FOV_PERMISSIVE_4 = 7
514
+ FOV_PERMISSIVE_5 = 8
515
+ FOV_PERMISSIVE_6 = 9
516
+ FOV_PERMISSIVE_7 = 10
517
+ FOV_PERMISSIVE_8 = 11
518
+ FOV_RESTRICTIVE = 12
519
+ NB_FOV_ALGORITHMS = 13
520
+
521
+ TCOD_fov_algorithm_t = :int
522
+
523
+ tcod_function :TCOD_map_new, [ :int, :int ], :pointer
524
+ tcod_function :TCOD_map_clear, [ :pointer, :bool, :bool ], :void
525
+ tcod_function :TCOD_map_copy, [ :pointer, :pointer ], :void
526
+ tcod_function :TCOD_map_set_properties, [ :pointer, :int, :int, :bool, :bool ], :void
527
+ tcod_function :TCOD_map_delete, [ :pointer ], :void
528
+ tcod_function :TCOD_map_compute_fov, [ :pointer, :int, :int, :int, :bool, TCOD_fov_algorithm_t ], :void
529
+ tcod_function :TCOD_map_is_in_fov, [ :pointer, :int, :int ], :bool
530
+ tcod_function :TCOD_map_set_in_fov, [ :pointer, :int, :int, :bool ], :void
531
+ tcod_function :TCOD_map_is_transparent, [ :pointer, :int, :int ], :bool
532
+ tcod_function :TCOD_map_is_walkable, [ :pointer, :int, :int ], :bool
533
+ tcod_function :TCOD_map_get_width, [ :pointer ], :int
534
+ tcod_function :TCOD_map_get_height, [ :pointer ], :int
535
+ tcod_function :TCOD_map_get_nb_cells, [ :pointer ], :int
536
+
537
+ ### Pathfinding module
538
+ TCOD_map_t = :pointer
539
+
540
+ callback(:TCOD_path_func_t, [ :int, :int, :int, :int, :pointer ], :float)
541
+ tcod_function :TCOD_path_new_using_map, [ TCOD_map_t, :float ], :pointer
542
+ tcod_function :TCOD_path_new_using_function, [ :int, :int, :TCOD_path_func_t, :pointer, :float ], :pointer
543
+ tcod_function :TCOD_path_compute, [ :pointer, :int, :int, :int, :int ], :bool
544
+ tcod_function :TCOD_path_walk, [ :pointer, :pointer, :pointer, :bool ], :bool
545
+ tcod_function :TCOD_path_is_empty, [ :pointer ], :bool
546
+ tcod_function :TCOD_path_size, [ :pointer ], :int
547
+ tcod_function :TCOD_path_reverse, [ :pointer ], :void
548
+ tcod_function :TCOD_path_get, [ :pointer, :int, :pointer, :pointer ], :void
549
+ tcod_function :TCOD_path_get_origin, [ :pointer, :pointer, :pointer ], :void
550
+ tcod_function :TCOD_path_get_destination, [ :pointer, :pointer, :pointer ], :void
551
+ tcod_function :TCOD_path_delete, [ :pointer ], :void
552
+ tcod_function :TCOD_dijkstra_new, [ TCOD_map_t, :float ], :pointer
553
+ tcod_function :TCOD_dijkstra_new_using_function, [ :int, :int, :TCOD_path_func_t, :pointer, :float ], :pointer
554
+ tcod_function :TCOD_dijkstra_compute, [ :pointer, :int, :int ], :void
555
+ tcod_function :TCOD_dijkstra_get_distance, [ :pointer, :int, :int ], :float
556
+ tcod_function :TCOD_dijkstra_path_set, [ :pointer, :int, :int ], :bool
557
+ tcod_function :TCOD_dijkstra_is_empty, [ :pointer ], :bool
558
+ tcod_function :TCOD_dijkstra_size, [ :pointer ], :int
559
+ tcod_function :TCOD_dijkstra_reverse, [ :pointer ], :void
560
+ tcod_function :TCOD_dijkstra_get, [ :pointer, :int, :pointer, :pointer ], :void
561
+ tcod_function :TCOD_dijkstra_path_walk, [ :pointer, :pointer, :pointer ], :bool
562
+ tcod_function :TCOD_dijkstra_delete, [ :pointer ], :void
563
+
564
+ ### BSP module
565
+ class TCODTreeT < FFI::Struct
566
+ layout(
567
+ :next, :pointer,
568
+ :father, :pointer,
569
+ :sons, :pointer
570
+ )
571
+ end
572
+ tcod_function :TCOD_tree_new, [ ], :pointer
573
+ tcod_function :TCOD_tree_add_son, [ :pointer, :pointer ], :void
574
+
575
+
576
+ class TCODBspT < MethodStruct
577
+ layout(
578
+ :tree, TCODTreeT,
579
+ :x, :int,
580
+ :y, :int,
581
+ :w, :int,
582
+ :h, :int,
583
+ :position, :int,
584
+ :level, :uint8,
585
+ :horizontal, :bool
586
+ )
587
+ end
588
+ callback(:TCOD_bsp_callback_t, [ :pointer, :pointer ], :bool)
589
+ tcod_function :TCOD_bsp_new, [ ], :pointer
590
+ tcod_function :TCOD_bsp_new_with_size, [ :int, :int, :int, :int ], :pointer
591
+ tcod_function :TCOD_bsp_delete, [ :pointer ], :void
592
+ tcod_function :TCOD_bsp_left, [ :pointer ], :pointer
593
+ tcod_function :TCOD_bsp_right, [ :pointer ], :pointer
594
+ tcod_function :TCOD_bsp_father, [ :pointer ], :pointer
595
+ tcod_function :TCOD_bsp_is_leaf, [ :pointer ], :bool
596
+ tcod_function :TCOD_bsp_traverse_pre_order, [ :pointer, :TCOD_bsp_callback_t, :pointer ], :bool
597
+ tcod_function :TCOD_bsp_traverse_in_order, [ :pointer, :TCOD_bsp_callback_t, :pointer ], :bool
598
+ tcod_function :TCOD_bsp_traverse_post_order, [ :pointer, :TCOD_bsp_callback_t, :pointer ], :bool
599
+ tcod_function :TCOD_bsp_traverse_level_order, [ :pointer, :TCOD_bsp_callback_t, :pointer ], :bool
600
+ tcod_function :TCOD_bsp_traverse_inverted_level_order, [ :pointer, :TCOD_bsp_callback_t, :pointer ], :bool
601
+ tcod_function :TCOD_bsp_contains, [ :pointer, :int, :int ], :bool
602
+ tcod_function :TCOD_bsp_find_node, [ :pointer, :int, :int ], :pointer
603
+ tcod_function :TCOD_bsp_resize, [ :pointer, :int, :int, :int, :int ], :void
604
+ tcod_function :TCOD_bsp_split_once, [ :pointer, :bool, :int ], :void
605
+ tcod_function :TCOD_bsp_split_recursive, [ :pointer, TCOD_random_t, :int, :int, :int, :float, :float ], :void
606
+ tcod_function :TCOD_bsp_remove_sons, [ :pointer ], :void
607
+
608
+ ### Heightmap module
609
+ class TCODHeightmapT < MethodStruct
610
+ layout(
611
+ :w, :int,
612
+ :h, :int,
613
+ :values, :pointer
614
+ )
615
+ end
616
+
617
+ TCOD_noise_t = :pointer
618
+ float_3 = :pointer # float n[3]
619
+ int_4 = :pointer
620
+
621
+ tcod_function :TCOD_heightmap_new, [ :int, :int ], :pointer
622
+ tcod_function :TCOD_heightmap_delete, [ :pointer ], :void
623
+ tcod_function :TCOD_heightmap_get_value, [ :pointer, :int, :int ], :float
624
+ tcod_function :TCOD_heightmap_get_interpolated_value, [ :pointer, :float, :float ], :float
625
+ tcod_function :TCOD_heightmap_set_value, [ :pointer, :int, :int, :float ], :void
626
+ tcod_function :TCOD_heightmap_get_slope, [ :pointer, :int, :int ], :float
627
+ tcod_function :TCOD_heightmap_get_normal, [ :pointer, :float, :float, float_3, :float ], :void
628
+ tcod_function :TCOD_heightmap_count_cells, [ :pointer, :float, :float ], :int
629
+ tcod_function :TCOD_heightmap_has_land_on_border, [ :pointer, :float ], :bool
630
+ tcod_function :TCOD_heightmap_get_minmax, [ :pointer, :pointer, :pointer ], :void
631
+ tcod_function :TCOD_heightmap_copy, [ :pointer, :pointer ], :void
632
+ tcod_function :TCOD_heightmap_add, [ :pointer, :float ], :void
633
+ tcod_function :TCOD_heightmap_scale, [ :pointer, :float ], :void
634
+ tcod_function :TCOD_heightmap_clamp, [ :pointer, :float, :float ], :void
635
+ tcod_function :TCOD_heightmap_normalize, [ :pointer, :float, :float ], :void
636
+ tcod_function :TCOD_heightmap_clear, [ :pointer ], :void
637
+ tcod_function :TCOD_heightmap_lerp_hm, [ :pointer, :pointer, :pointer, :float ], :void
638
+ tcod_function :TCOD_heightmap_add_hm, [ :pointer, :pointer, :pointer ], :void
639
+ tcod_function :TCOD_heightmap_multiply_hm, [ :pointer, :pointer, :pointer ], :void
640
+ tcod_function :TCOD_heightmap_add_hill, [ :pointer, :float, :float, :float, :float ], :void
641
+ tcod_function :TCOD_heightmap_dig_hill, [ :pointer, :float, :float, :float, :float ], :void
642
+ tcod_function :TCOD_heightmap_dig_bezier, [ :pointer, int_4, int_4, :float, :float, :float, :float ], :void
643
+ tcod_function :TCOD_heightmap_rain_erosion, [ :pointer, :int, :float, :float, TCOD_random_t ], :void
644
+ tcod_function :TCOD_heightmap_kernel_transform, [ :pointer, :int, :pointer, :pointer, :pointer, :float, :float ], :void
645
+ tcod_function :TCOD_heightmap_add_voronoi, [ :pointer, :int, :int, :pointer, TCOD_random_t ], :void
646
+ tcod_function :TCOD_heightmap_add_fbm, [ :pointer, TCOD_noise_t, :float, :float, :float, :float, :float, :float, :float ], :void
647
+ tcod_function :TCOD_heightmap_scale_fbm, [ :pointer, TCOD_noise_t, :float, :float, :float, :float, :float, :float, :float ], :void
648
+ tcod_function :TCOD_heightmap_islandify, [ :pointer, :float, TCOD_random_t ], :void
649
+
650
+
651
+ ### Name Generator module
652
+ tcod_function :TCOD_namegen_parse, [ :string, TCOD_random_t ], :void
653
+ tcod_function :TCOD_namegen_generate, [ :string, :bool ], :string
654
+ tcod_function :TCOD_namegen_generate_custom, [ :string, :string, :bool ], :string
655
+ tcod_function :TCOD_namegen_get_sets, [ ], TCOD_list_t
656
+ tcod_function :TCOD_namegen_destroy, [ ], :void
657
+ end