libtcod 0.0.2 → 0.0.3

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