raylib-bindings 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/rlgl.rb CHANGED
@@ -1,648 +1,648 @@
1
- # Yet another raylib wrapper for Ruby
2
- #
3
- # * https://github.com/vaiorabbit/raylib-bindings
4
- #
5
- # [NOTICE] This is an automatically generated file.
6
-
7
- require 'ffi'
8
-
9
- module Raylib
10
- extend FFI::Library
11
- # Define/Macro
12
-
13
- RLGL_VERSION = "4.0"
14
- RL_DEFAULT_BATCH_BUFFER_ELEMENTS = 8192
15
- RL_DEFAULT_BATCH_BUFFERS = 1
16
- RL_DEFAULT_BATCH_DRAWCALLS = 256
17
- RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS = 4
18
- RL_MAX_MATRIX_STACK_SIZE = 32
19
- RL_MAX_SHADER_LOCATIONS = 32
20
- RL_CULL_DISTANCE_NEAR = 0.01
21
- RL_CULL_DISTANCE_FAR = 1000.0
22
- RL_TEXTURE_WRAP_S = 0x2802
23
- RL_TEXTURE_WRAP_T = 0x2803
24
- RL_TEXTURE_MAG_FILTER = 0x2800
25
- RL_TEXTURE_MIN_FILTER = 0x2801
26
- RL_TEXTURE_FILTER_NEAREST = 0x2600
27
- RL_TEXTURE_FILTER_LINEAR = 0x2601
28
- RL_TEXTURE_FILTER_MIP_NEAREST = 0x2700
29
- RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR = 0x2702
30
- RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST = 0x2701
31
- RL_TEXTURE_FILTER_MIP_LINEAR = 0x2703
32
- RL_TEXTURE_FILTER_ANISOTROPIC = 0x3000
33
- RL_TEXTURE_WRAP_REPEAT = 0x2901
34
- RL_TEXTURE_WRAP_CLAMP = 0x812F
35
- RL_TEXTURE_WRAP_MIRROR_REPEAT = 0x8370
36
- RL_TEXTURE_WRAP_MIRROR_CLAMP = 0x8742
37
- RL_MODELVIEW = 0x1700
38
- RL_PROJECTION = 0x1701
39
- RL_TEXTURE = 0x1702
40
- RL_LINES = 0x0001
41
- RL_TRIANGLES = 0x0004
42
- RL_QUADS = 0x0007
43
- RL_UNSIGNED_BYTE = 0x1401
44
- RL_FLOAT = 0x1406
45
- RL_STREAM_DRAW = 0x88E0
46
- RL_STREAM_READ = 0x88E1
47
- RL_STREAM_COPY = 0x88E2
48
- RL_STATIC_DRAW = 0x88E4
49
- RL_STATIC_READ = 0x88E5
50
- RL_STATIC_COPY = 0x88E6
51
- RL_DYNAMIC_DRAW = 0x88E8
52
- RL_DYNAMIC_READ = 0x88E9
53
- RL_DYNAMIC_COPY = 0x88EA
54
- RL_FRAGMENT_SHADER = 0x8B30
55
- RL_VERTEX_SHADER = 0x8B31
56
- RL_COMPUTE_SHADER = 0x91B9
57
-
58
- # Enum
59
-
60
- OPENGL_11 = 1
61
- OPENGL_21 = 2
62
- OPENGL_33 = 3
63
- OPENGL_43 = 4
64
- OPENGL_ES_20 = 5
65
- RL_ATTACHMENT_COLOR_CHANNEL0 = 0
66
- RL_ATTACHMENT_COLOR_CHANNEL1 = 1
67
- RL_ATTACHMENT_COLOR_CHANNEL2 = 2
68
- RL_ATTACHMENT_COLOR_CHANNEL3 = 3
69
- RL_ATTACHMENT_COLOR_CHANNEL4 = 4
70
- RL_ATTACHMENT_COLOR_CHANNEL5 = 5
71
- RL_ATTACHMENT_COLOR_CHANNEL6 = 6
72
- RL_ATTACHMENT_COLOR_CHANNEL7 = 7
73
- RL_ATTACHMENT_DEPTH = 100
74
- RL_ATTACHMENT_STENCIL = 200
75
- RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0
76
- RL_ATTACHMENT_CUBEMAP_NEGATIVE_X = 1
77
- RL_ATTACHMENT_CUBEMAP_POSITIVE_Y = 2
78
- RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y = 3
79
- RL_ATTACHMENT_CUBEMAP_POSITIVE_Z = 4
80
- RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z = 5
81
- RL_ATTACHMENT_TEXTURE2D = 100
82
- RL_ATTACHMENT_RENDERBUFFER = 200
83
- RL_LOG_ALL = 0
84
- RL_LOG_TRACE = 1
85
- RL_LOG_DEBUG = 2
86
- RL_LOG_INFO = 3
87
- RL_LOG_WARNING = 4
88
- RL_LOG_ERROR = 5
89
- RL_LOG_FATAL = 6
90
- RL_LOG_NONE = 7
91
- RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1
92
- RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2
93
- RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3
94
- RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8 = 4
95
- RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = 5
96
- RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = 6
97
- RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = 7
98
- RL_PIXELFORMAT_UNCOMPRESSED_R32 = 8
99
- RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9
100
- RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10
101
- RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 11
102
- RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12
103
- RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13
104
- RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14
105
- RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 15
106
- RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 16
107
- RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17
108
- RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 18
109
- RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19
110
- RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20
111
- RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21
112
- RL_TEXTURE_FILTER_POINT = 0
113
- RL_TEXTURE_FILTER_BILINEAR = 1
114
- RL_TEXTURE_FILTER_TRILINEAR = 2
115
- RL_TEXTURE_FILTER_ANISOTROPIC_4X = 3
116
- RL_TEXTURE_FILTER_ANISOTROPIC_8X = 4
117
- RL_TEXTURE_FILTER_ANISOTROPIC_16X = 5
118
- RL_BLEND_ALPHA = 0
119
- RL_BLEND_ADDITIVE = 1
120
- RL_BLEND_MULTIPLIED = 2
121
- RL_BLEND_ADD_COLORS = 3
122
- RL_BLEND_SUBTRACT_COLORS = 4
123
- RL_BLEND_CUSTOM = 5
124
- RL_SHADER_LOC_VERTEX_POSITION = 0
125
- RL_SHADER_LOC_VERTEX_TEXCOORD01 = 1
126
- RL_SHADER_LOC_VERTEX_TEXCOORD02 = 2
127
- RL_SHADER_LOC_VERTEX_NORMAL = 3
128
- RL_SHADER_LOC_VERTEX_TANGENT = 4
129
- RL_SHADER_LOC_VERTEX_COLOR = 5
130
- RL_SHADER_LOC_MATRIX_MVP = 6
131
- RL_SHADER_LOC_MATRIX_VIEW = 7
132
- RL_SHADER_LOC_MATRIX_PROJECTION = 8
133
- RL_SHADER_LOC_MATRIX_MODEL = 9
134
- RL_SHADER_LOC_MATRIX_NORMAL = 10
135
- RL_SHADER_LOC_VECTOR_VIEW = 11
136
- RL_SHADER_LOC_COLOR_DIFFUSE = 12
137
- RL_SHADER_LOC_COLOR_SPECULAR = 13
138
- RL_SHADER_LOC_COLOR_AMBIENT = 14
139
- RL_SHADER_LOC_MAP_ALBEDO = 15
140
- RL_SHADER_LOC_MAP_METALNESS = 16
141
- RL_SHADER_LOC_MAP_NORMAL = 17
142
- RL_SHADER_LOC_MAP_ROUGHNESS = 18
143
- RL_SHADER_LOC_MAP_OCCLUSION = 19
144
- RL_SHADER_LOC_MAP_EMISSION = 20
145
- RL_SHADER_LOC_MAP_HEIGHT = 21
146
- RL_SHADER_LOC_MAP_CUBEMAP = 22
147
- RL_SHADER_LOC_MAP_IRRADIANCE = 23
148
- RL_SHADER_LOC_MAP_PREFILTER = 24
149
- RL_SHADER_LOC_MAP_BRDF = 25
150
- RL_SHADER_UNIFORM_FLOAT = 0
151
- RL_SHADER_UNIFORM_VEC2 = 1
152
- RL_SHADER_UNIFORM_VEC3 = 2
153
- RL_SHADER_UNIFORM_VEC4 = 3
154
- RL_SHADER_UNIFORM_INT = 4
155
- RL_SHADER_UNIFORM_IVEC2 = 5
156
- RL_SHADER_UNIFORM_IVEC3 = 6
157
- RL_SHADER_UNIFORM_IVEC4 = 7
158
- RL_SHADER_UNIFORM_SAMPLER2D = 8
159
- RL_SHADER_ATTRIB_FLOAT = 0
160
- RL_SHADER_ATTRIB_VEC2 = 1
161
- RL_SHADER_ATTRIB_VEC3 = 2
162
- RL_SHADER_ATTRIB_VEC4 = 3
163
-
164
- # Typedef
165
-
166
- typedef :int, :rlGlVersion
167
- typedef :int, :rlFramebufferAttachType
168
- typedef :int, :rlFramebufferAttachTextureType
169
- typedef :int, :rlTraceLogLevel
170
- typedef :int, :rlPixelFormat
171
- typedef :int, :rlTextureFilter
172
- typedef :int, :rlBlendMode
173
- typedef :int, :rlShaderLocationIndex
174
- typedef :int, :rlShaderUniformDataType
175
- typedef :int, :rlShaderAttributeDataType
176
-
177
- # Struct
178
-
179
- class RlVertexBuffer < FFI::Struct
180
- layout(
181
- :elementCount, :int,
182
- :vertices, :pointer,
183
- :texcoords, :pointer,
184
- :colors, :pointer,
185
- :indices, :pointer,
186
- :vaoId, :uint,
187
- :vboId, [:uint, 4],
188
- )
189
- end
190
-
191
- class RlDrawCall < FFI::Struct
192
- layout(
193
- :mode, :int,
194
- :vertexCount, :int,
195
- :vertexAlignment, :int,
196
- :textureId, :uint,
197
- )
198
- end
199
-
200
- class RlRenderBatch < FFI::Struct
201
- layout(
202
- :bufferCount, :int,
203
- :currentBuffer, :int,
204
- :vertexBuffer, :pointer,
205
- :draws, :pointer,
206
- :drawCounter, :int,
207
- :currentDepth, :float,
208
- )
209
- end
210
-
211
-
212
- # Function
213
-
214
- def self.setup_rlgl_symbols()
215
- symbols = [
216
- :rlMatrixMode,
217
- :rlPushMatrix,
218
- :rlPopMatrix,
219
- :rlLoadIdentity,
220
- :rlTranslatef,
221
- :rlRotatef,
222
- :rlScalef,
223
- :rlMultMatrixf,
224
- :rlFrustum,
225
- :rlOrtho,
226
- :rlViewport,
227
- :rlBegin,
228
- :rlEnd,
229
- :rlVertex2i,
230
- :rlVertex2f,
231
- :rlVertex3f,
232
- :rlTexCoord2f,
233
- :rlNormal3f,
234
- :rlColor4ub,
235
- :rlColor3f,
236
- :rlColor4f,
237
- :rlEnableVertexArray,
238
- :rlDisableVertexArray,
239
- :rlEnableVertexBuffer,
240
- :rlDisableVertexBuffer,
241
- :rlEnableVertexBufferElement,
242
- :rlDisableVertexBufferElement,
243
- :rlEnableVertexAttribute,
244
- :rlDisableVertexAttribute,
245
- :rlActiveTextureSlot,
246
- :rlEnableTexture,
247
- :rlDisableTexture,
248
- :rlEnableTextureCubemap,
249
- :rlDisableTextureCubemap,
250
- :rlTextureParameters,
251
- :rlEnableShader,
252
- :rlDisableShader,
253
- :rlEnableFramebuffer,
254
- :rlDisableFramebuffer,
255
- :rlActiveDrawBuffers,
256
- :rlEnableColorBlend,
257
- :rlDisableColorBlend,
258
- :rlEnableDepthTest,
259
- :rlDisableDepthTest,
260
- :rlEnableDepthMask,
261
- :rlDisableDepthMask,
262
- :rlEnableBackfaceCulling,
263
- :rlDisableBackfaceCulling,
264
- :rlEnableScissorTest,
265
- :rlDisableScissorTest,
266
- :rlScissor,
267
- :rlEnableWireMode,
268
- :rlDisableWireMode,
269
- :rlSetLineWidth,
270
- :rlGetLineWidth,
271
- :rlEnableSmoothLines,
272
- :rlDisableSmoothLines,
273
- :rlEnableStereoRender,
274
- :rlDisableStereoRender,
275
- :rlIsStereoRenderEnabled,
276
- :rlClearColor,
277
- :rlClearScreenBuffers,
278
- :rlCheckErrors,
279
- :rlSetBlendMode,
280
- :rlSetBlendFactors,
281
- :rlglInit,
282
- :rlglClose,
283
- :rlLoadExtensions,
284
- :rlGetVersion,
285
- :rlGetFramebufferWidth,
286
- :rlGetFramebufferHeight,
287
- :rlGetTextureIdDefault,
288
- :rlGetShaderIdDefault,
289
- :rlGetShaderLocsDefault,
290
- :rlLoadRenderBatch,
291
- :rlUnloadRenderBatch,
292
- :rlDrawRenderBatch,
293
- :rlSetRenderBatchActive,
294
- :rlDrawRenderBatchActive,
295
- :rlCheckRenderBatchLimit,
296
- :rlSetTexture,
297
- :rlLoadVertexArray,
298
- :rlLoadVertexBuffer,
299
- :rlLoadVertexBufferElement,
300
- :rlUpdateVertexBuffer,
301
- :rlUnloadVertexArray,
302
- :rlUnloadVertexBuffer,
303
- :rlSetVertexAttribute,
304
- :rlSetVertexAttributeDivisor,
305
- :rlSetVertexAttributeDefault,
306
- :rlDrawVertexArray,
307
- :rlDrawVertexArrayElements,
308
- :rlDrawVertexArrayInstanced,
309
- :rlDrawVertexArrayElementsInstanced,
310
- :rlLoadTexture,
311
- :rlLoadTextureDepth,
312
- :rlLoadTextureCubemap,
313
- :rlUpdateTexture,
314
- :rlGetGlTextureFormats,
315
- :rlGetPixelFormatName,
316
- :rlUnloadTexture,
317
- :rlGenTextureMipmaps,
318
- :rlReadTexturePixels,
319
- :rlReadScreenPixels,
320
- :rlLoadFramebuffer,
321
- :rlFramebufferAttach,
322
- :rlFramebufferComplete,
323
- :rlUnloadFramebuffer,
324
- :rlLoadShaderCode,
325
- :rlCompileShader,
326
- :rlLoadShaderProgram,
327
- :rlUnloadShaderProgram,
328
- :rlGetLocationUniform,
329
- :rlGetLocationAttrib,
330
- :rlSetUniform,
331
- :rlSetUniformMatrix,
332
- :rlSetUniformSampler,
333
- :rlSetShader,
334
- :rlLoadComputeShaderProgram,
335
- :rlComputeShaderDispatch,
336
- :rlLoadShaderBuffer,
337
- :rlUnloadShaderBuffer,
338
- :rlUpdateShaderBufferElements,
339
- :rlGetShaderBufferSize,
340
- :rlReadShaderBufferElements,
341
- :rlBindShaderBuffer,
342
- :rlCopyBuffersElements,
343
- :rlBindImageTexture,
344
- :rlGetMatrixModelview,
345
- :rlGetMatrixProjection,
346
- :rlGetMatrixTransform,
347
- :rlGetMatrixProjectionStereo,
348
- :rlGetMatrixViewOffsetStereo,
349
- :rlSetMatrixProjection,
350
- :rlSetMatrixModelview,
351
- :rlSetMatrixProjectionStereo,
352
- :rlSetMatrixViewOffsetStereo,
353
- :rlLoadDrawCube,
354
- :rlLoadDrawQuad,
355
- ]
356
- args = {
357
- :rlMatrixMode => [:int],
358
- :rlPushMatrix => [],
359
- :rlPopMatrix => [],
360
- :rlLoadIdentity => [],
361
- :rlTranslatef => [:float, :float, :float],
362
- :rlRotatef => [:float, :float, :float, :float],
363
- :rlScalef => [:float, :float, :float],
364
- :rlMultMatrixf => [:pointer],
365
- :rlFrustum => [:double, :double, :double, :double, :double, :double],
366
- :rlOrtho => [:double, :double, :double, :double, :double, :double],
367
- :rlViewport => [:int, :int, :int, :int],
368
- :rlBegin => [:int],
369
- :rlEnd => [],
370
- :rlVertex2i => [:int, :int],
371
- :rlVertex2f => [:float, :float],
372
- :rlVertex3f => [:float, :float, :float],
373
- :rlTexCoord2f => [:float, :float],
374
- :rlNormal3f => [:float, :float, :float],
375
- :rlColor4ub => [:uchar, :uchar, :uchar, :uchar],
376
- :rlColor3f => [:float, :float, :float],
377
- :rlColor4f => [:float, :float, :float, :float],
378
- :rlEnableVertexArray => [:uint],
379
- :rlDisableVertexArray => [],
380
- :rlEnableVertexBuffer => [:uint],
381
- :rlDisableVertexBuffer => [],
382
- :rlEnableVertexBufferElement => [:uint],
383
- :rlDisableVertexBufferElement => [],
384
- :rlEnableVertexAttribute => [:uint],
385
- :rlDisableVertexAttribute => [:uint],
386
- :rlActiveTextureSlot => [:int],
387
- :rlEnableTexture => [:uint],
388
- :rlDisableTexture => [],
389
- :rlEnableTextureCubemap => [:uint],
390
- :rlDisableTextureCubemap => [],
391
- :rlTextureParameters => [:uint, :int, :int],
392
- :rlEnableShader => [:uint],
393
- :rlDisableShader => [],
394
- :rlEnableFramebuffer => [:uint],
395
- :rlDisableFramebuffer => [],
396
- :rlActiveDrawBuffers => [:int],
397
- :rlEnableColorBlend => [],
398
- :rlDisableColorBlend => [],
399
- :rlEnableDepthTest => [],
400
- :rlDisableDepthTest => [],
401
- :rlEnableDepthMask => [],
402
- :rlDisableDepthMask => [],
403
- :rlEnableBackfaceCulling => [],
404
- :rlDisableBackfaceCulling => [],
405
- :rlEnableScissorTest => [],
406
- :rlDisableScissorTest => [],
407
- :rlScissor => [:int, :int, :int, :int],
408
- :rlEnableWireMode => [],
409
- :rlDisableWireMode => [],
410
- :rlSetLineWidth => [:float],
411
- :rlGetLineWidth => [],
412
- :rlEnableSmoothLines => [],
413
- :rlDisableSmoothLines => [],
414
- :rlEnableStereoRender => [],
415
- :rlDisableStereoRender => [],
416
- :rlIsStereoRenderEnabled => [],
417
- :rlClearColor => [:uchar, :uchar, :uchar, :uchar],
418
- :rlClearScreenBuffers => [],
419
- :rlCheckErrors => [],
420
- :rlSetBlendMode => [:int],
421
- :rlSetBlendFactors => [:int, :int, :int],
422
- :rlglInit => [:int, :int],
423
- :rlglClose => [],
424
- :rlLoadExtensions => [:pointer],
425
- :rlGetVersion => [],
426
- :rlGetFramebufferWidth => [],
427
- :rlGetFramebufferHeight => [],
428
- :rlGetTextureIdDefault => [],
429
- :rlGetShaderIdDefault => [],
430
- :rlGetShaderLocsDefault => [],
431
- :rlLoadRenderBatch => [:int, :int],
432
- :rlUnloadRenderBatch => [RlRenderBatch.by_value],
433
- :rlDrawRenderBatch => [:pointer],
434
- :rlSetRenderBatchActive => [:pointer],
435
- :rlDrawRenderBatchActive => [],
436
- :rlCheckRenderBatchLimit => [:int],
437
- :rlSetTexture => [:uint],
438
- :rlLoadVertexArray => [],
439
- :rlLoadVertexBuffer => [:pointer, :int, :bool],
440
- :rlLoadVertexBufferElement => [:pointer, :int, :bool],
441
- :rlUpdateVertexBuffer => [:uint, :pointer, :int, :int],
442
- :rlUnloadVertexArray => [:uint],
443
- :rlUnloadVertexBuffer => [:uint],
444
- :rlSetVertexAttribute => [:uint, :int, :int, :bool, :int, :pointer],
445
- :rlSetVertexAttributeDivisor => [:uint, :int],
446
- :rlSetVertexAttributeDefault => [:int, :pointer, :int, :int],
447
- :rlDrawVertexArray => [:int, :int],
448
- :rlDrawVertexArrayElements => [:int, :int, :pointer],
449
- :rlDrawVertexArrayInstanced => [:int, :int, :int],
450
- :rlDrawVertexArrayElementsInstanced => [:int, :int, :pointer, :int],
451
- :rlLoadTexture => [:pointer, :int, :int, :int, :int],
452
- :rlLoadTextureDepth => [:int, :int, :bool],
453
- :rlLoadTextureCubemap => [:pointer, :int, :int],
454
- :rlUpdateTexture => [:uint, :int, :int, :int, :int, :int, :pointer],
455
- :rlGetGlTextureFormats => [:int, :pointer, :pointer, :pointer],
456
- :rlGetPixelFormatName => [:uint],
457
- :rlUnloadTexture => [:uint],
458
- :rlGenTextureMipmaps => [:uint, :int, :int, :int, :pointer],
459
- :rlReadTexturePixels => [:uint, :int, :int, :int],
460
- :rlReadScreenPixels => [:int, :int],
461
- :rlLoadFramebuffer => [:int, :int],
462
- :rlFramebufferAttach => [:uint, :uint, :int, :int, :int],
463
- :rlFramebufferComplete => [:uint],
464
- :rlUnloadFramebuffer => [:uint],
465
- :rlLoadShaderCode => [:pointer, :pointer],
466
- :rlCompileShader => [:pointer, :int],
467
- :rlLoadShaderProgram => [:uint, :uint],
468
- :rlUnloadShaderProgram => [:uint],
469
- :rlGetLocationUniform => [:uint, :pointer],
470
- :rlGetLocationAttrib => [:uint, :pointer],
471
- :rlSetUniform => [:int, :pointer, :int, :int],
472
- :rlSetUniformMatrix => [:int, Matrix.by_value],
473
- :rlSetUniformSampler => [:int, :uint],
474
- :rlSetShader => [:uint, :pointer],
475
- :rlLoadComputeShaderProgram => [:uint],
476
- :rlComputeShaderDispatch => [:uint, :uint, :uint],
477
- :rlLoadShaderBuffer => [:ulong_long, :pointer, :int],
478
- :rlUnloadShaderBuffer => [:uint],
479
- :rlUpdateShaderBufferElements => [:uint, :pointer, :ulong_long, :ulong_long],
480
- :rlGetShaderBufferSize => [:uint],
481
- :rlReadShaderBufferElements => [:uint, :pointer, :ulong_long, :ulong_long],
482
- :rlBindShaderBuffer => [:uint, :uint],
483
- :rlCopyBuffersElements => [:uint, :uint, :ulong_long, :ulong_long, :ulong_long],
484
- :rlBindImageTexture => [:uint, :uint, :uint, :int],
485
- :rlGetMatrixModelview => [],
486
- :rlGetMatrixProjection => [],
487
- :rlGetMatrixTransform => [],
488
- :rlGetMatrixProjectionStereo => [:int],
489
- :rlGetMatrixViewOffsetStereo => [:int],
490
- :rlSetMatrixProjection => [Matrix.by_value],
491
- :rlSetMatrixModelview => [Matrix.by_value],
492
- :rlSetMatrixProjectionStereo => [Matrix.by_value, Matrix.by_value],
493
- :rlSetMatrixViewOffsetStereo => [Matrix.by_value, Matrix.by_value],
494
- :rlLoadDrawCube => [],
495
- :rlLoadDrawQuad => [],
496
- }
497
- retvals = {
498
- :rlMatrixMode => :void,
499
- :rlPushMatrix => :void,
500
- :rlPopMatrix => :void,
501
- :rlLoadIdentity => :void,
502
- :rlTranslatef => :void,
503
- :rlRotatef => :void,
504
- :rlScalef => :void,
505
- :rlMultMatrixf => :void,
506
- :rlFrustum => :void,
507
- :rlOrtho => :void,
508
- :rlViewport => :void,
509
- :rlBegin => :void,
510
- :rlEnd => :void,
511
- :rlVertex2i => :void,
512
- :rlVertex2f => :void,
513
- :rlVertex3f => :void,
514
- :rlTexCoord2f => :void,
515
- :rlNormal3f => :void,
516
- :rlColor4ub => :void,
517
- :rlColor3f => :void,
518
- :rlColor4f => :void,
519
- :rlEnableVertexArray => :bool,
520
- :rlDisableVertexArray => :void,
521
- :rlEnableVertexBuffer => :void,
522
- :rlDisableVertexBuffer => :void,
523
- :rlEnableVertexBufferElement => :void,
524
- :rlDisableVertexBufferElement => :void,
525
- :rlEnableVertexAttribute => :void,
526
- :rlDisableVertexAttribute => :void,
527
- :rlActiveTextureSlot => :void,
528
- :rlEnableTexture => :void,
529
- :rlDisableTexture => :void,
530
- :rlEnableTextureCubemap => :void,
531
- :rlDisableTextureCubemap => :void,
532
- :rlTextureParameters => :void,
533
- :rlEnableShader => :void,
534
- :rlDisableShader => :void,
535
- :rlEnableFramebuffer => :void,
536
- :rlDisableFramebuffer => :void,
537
- :rlActiveDrawBuffers => :void,
538
- :rlEnableColorBlend => :void,
539
- :rlDisableColorBlend => :void,
540
- :rlEnableDepthTest => :void,
541
- :rlDisableDepthTest => :void,
542
- :rlEnableDepthMask => :void,
543
- :rlDisableDepthMask => :void,
544
- :rlEnableBackfaceCulling => :void,
545
- :rlDisableBackfaceCulling => :void,
546
- :rlEnableScissorTest => :void,
547
- :rlDisableScissorTest => :void,
548
- :rlScissor => :void,
549
- :rlEnableWireMode => :void,
550
- :rlDisableWireMode => :void,
551
- :rlSetLineWidth => :void,
552
- :rlGetLineWidth => :float,
553
- :rlEnableSmoothLines => :void,
554
- :rlDisableSmoothLines => :void,
555
- :rlEnableStereoRender => :void,
556
- :rlDisableStereoRender => :void,
557
- :rlIsStereoRenderEnabled => :bool,
558
- :rlClearColor => :void,
559
- :rlClearScreenBuffers => :void,
560
- :rlCheckErrors => :void,
561
- :rlSetBlendMode => :void,
562
- :rlSetBlendFactors => :void,
563
- :rlglInit => :void,
564
- :rlglClose => :void,
565
- :rlLoadExtensions => :void,
566
- :rlGetVersion => :int,
567
- :rlGetFramebufferWidth => :int,
568
- :rlGetFramebufferHeight => :int,
569
- :rlGetTextureIdDefault => :uint,
570
- :rlGetShaderIdDefault => :uint,
571
- :rlGetShaderLocsDefault => :pointer,
572
- :rlLoadRenderBatch => RlRenderBatch.by_value,
573
- :rlUnloadRenderBatch => :void,
574
- :rlDrawRenderBatch => :void,
575
- :rlSetRenderBatchActive => :void,
576
- :rlDrawRenderBatchActive => :void,
577
- :rlCheckRenderBatchLimit => :bool,
578
- :rlSetTexture => :void,
579
- :rlLoadVertexArray => :uint,
580
- :rlLoadVertexBuffer => :uint,
581
- :rlLoadVertexBufferElement => :uint,
582
- :rlUpdateVertexBuffer => :void,
583
- :rlUnloadVertexArray => :void,
584
- :rlUnloadVertexBuffer => :void,
585
- :rlSetVertexAttribute => :void,
586
- :rlSetVertexAttributeDivisor => :void,
587
- :rlSetVertexAttributeDefault => :void,
588
- :rlDrawVertexArray => :void,
589
- :rlDrawVertexArrayElements => :void,
590
- :rlDrawVertexArrayInstanced => :void,
591
- :rlDrawVertexArrayElementsInstanced => :void,
592
- :rlLoadTexture => :uint,
593
- :rlLoadTextureDepth => :uint,
594
- :rlLoadTextureCubemap => :uint,
595
- :rlUpdateTexture => :void,
596
- :rlGetGlTextureFormats => :void,
597
- :rlGetPixelFormatName => :pointer,
598
- :rlUnloadTexture => :void,
599
- :rlGenTextureMipmaps => :void,
600
- :rlReadTexturePixels => :pointer,
601
- :rlReadScreenPixels => :pointer,
602
- :rlLoadFramebuffer => :uint,
603
- :rlFramebufferAttach => :void,
604
- :rlFramebufferComplete => :bool,
605
- :rlUnloadFramebuffer => :void,
606
- :rlLoadShaderCode => :uint,
607
- :rlCompileShader => :uint,
608
- :rlLoadShaderProgram => :uint,
609
- :rlUnloadShaderProgram => :void,
610
- :rlGetLocationUniform => :int,
611
- :rlGetLocationAttrib => :int,
612
- :rlSetUniform => :void,
613
- :rlSetUniformMatrix => :void,
614
- :rlSetUniformSampler => :void,
615
- :rlSetShader => :void,
616
- :rlLoadComputeShaderProgram => :uint,
617
- :rlComputeShaderDispatch => :void,
618
- :rlLoadShaderBuffer => :uint,
619
- :rlUnloadShaderBuffer => :void,
620
- :rlUpdateShaderBufferElements => :void,
621
- :rlGetShaderBufferSize => :ulong_long,
622
- :rlReadShaderBufferElements => :void,
623
- :rlBindShaderBuffer => :void,
624
- :rlCopyBuffersElements => :void,
625
- :rlBindImageTexture => :void,
626
- :rlGetMatrixModelview => Matrix.by_value,
627
- :rlGetMatrixProjection => Matrix.by_value,
628
- :rlGetMatrixTransform => Matrix.by_value,
629
- :rlGetMatrixProjectionStereo => Matrix.by_value,
630
- :rlGetMatrixViewOffsetStereo => Matrix.by_value,
631
- :rlSetMatrixProjection => :void,
632
- :rlSetMatrixModelview => :void,
633
- :rlSetMatrixProjectionStereo => :void,
634
- :rlSetMatrixViewOffsetStereo => :void,
635
- :rlLoadDrawCube => :void,
636
- :rlLoadDrawQuad => :void,
637
- }
638
- symbols.each do |sym|
639
- begin
640
- attach_function sym, args[sym], retvals[sym]
641
- rescue FFI::NotFoundError => error
642
- $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
643
- end
644
- end
645
- end
646
-
647
- end
648
-
1
+ # Yet another raylib wrapper for Ruby
2
+ #
3
+ # * https://github.com/vaiorabbit/raylib-bindings
4
+ #
5
+ # [NOTICE] This is an automatically generated file.
6
+
7
+ require 'ffi'
8
+
9
+ module Raylib
10
+ extend FFI::Library
11
+ # Define/Macro
12
+
13
+ RLGL_VERSION = "4.0"
14
+ RL_DEFAULT_BATCH_BUFFER_ELEMENTS = 8192
15
+ RL_DEFAULT_BATCH_BUFFERS = 1
16
+ RL_DEFAULT_BATCH_DRAWCALLS = 256
17
+ RL_DEFAULT_BATCH_MAX_TEXTURE_UNITS = 4
18
+ RL_MAX_MATRIX_STACK_SIZE = 32
19
+ RL_MAX_SHADER_LOCATIONS = 32
20
+ RL_CULL_DISTANCE_NEAR = 0.01
21
+ RL_CULL_DISTANCE_FAR = 1000.0
22
+ RL_TEXTURE_WRAP_S = 0x2802
23
+ RL_TEXTURE_WRAP_T = 0x2803
24
+ RL_TEXTURE_MAG_FILTER = 0x2800
25
+ RL_TEXTURE_MIN_FILTER = 0x2801
26
+ RL_TEXTURE_FILTER_NEAREST = 0x2600
27
+ RL_TEXTURE_FILTER_LINEAR = 0x2601
28
+ RL_TEXTURE_FILTER_MIP_NEAREST = 0x2700
29
+ RL_TEXTURE_FILTER_NEAREST_MIP_LINEAR = 0x2702
30
+ RL_TEXTURE_FILTER_LINEAR_MIP_NEAREST = 0x2701
31
+ RL_TEXTURE_FILTER_MIP_LINEAR = 0x2703
32
+ RL_TEXTURE_FILTER_ANISOTROPIC = 0x3000
33
+ RL_TEXTURE_WRAP_REPEAT = 0x2901
34
+ RL_TEXTURE_WRAP_CLAMP = 0x812F
35
+ RL_TEXTURE_WRAP_MIRROR_REPEAT = 0x8370
36
+ RL_TEXTURE_WRAP_MIRROR_CLAMP = 0x8742
37
+ RL_MODELVIEW = 0x1700
38
+ RL_PROJECTION = 0x1701
39
+ RL_TEXTURE = 0x1702
40
+ RL_LINES = 0x0001
41
+ RL_TRIANGLES = 0x0004
42
+ RL_QUADS = 0x0007
43
+ RL_UNSIGNED_BYTE = 0x1401
44
+ RL_FLOAT = 0x1406
45
+ RL_STREAM_DRAW = 0x88E0
46
+ RL_STREAM_READ = 0x88E1
47
+ RL_STREAM_COPY = 0x88E2
48
+ RL_STATIC_DRAW = 0x88E4
49
+ RL_STATIC_READ = 0x88E5
50
+ RL_STATIC_COPY = 0x88E6
51
+ RL_DYNAMIC_DRAW = 0x88E8
52
+ RL_DYNAMIC_READ = 0x88E9
53
+ RL_DYNAMIC_COPY = 0x88EA
54
+ RL_FRAGMENT_SHADER = 0x8B30
55
+ RL_VERTEX_SHADER = 0x8B31
56
+ RL_COMPUTE_SHADER = 0x91B9
57
+
58
+ # Enum
59
+
60
+ OPENGL_11 = 1
61
+ OPENGL_21 = 2
62
+ OPENGL_33 = 3
63
+ OPENGL_43 = 4
64
+ OPENGL_ES_20 = 5
65
+ RL_ATTACHMENT_COLOR_CHANNEL0 = 0
66
+ RL_ATTACHMENT_COLOR_CHANNEL1 = 1
67
+ RL_ATTACHMENT_COLOR_CHANNEL2 = 2
68
+ RL_ATTACHMENT_COLOR_CHANNEL3 = 3
69
+ RL_ATTACHMENT_COLOR_CHANNEL4 = 4
70
+ RL_ATTACHMENT_COLOR_CHANNEL5 = 5
71
+ RL_ATTACHMENT_COLOR_CHANNEL6 = 6
72
+ RL_ATTACHMENT_COLOR_CHANNEL7 = 7
73
+ RL_ATTACHMENT_DEPTH = 100
74
+ RL_ATTACHMENT_STENCIL = 200
75
+ RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0
76
+ RL_ATTACHMENT_CUBEMAP_NEGATIVE_X = 1
77
+ RL_ATTACHMENT_CUBEMAP_POSITIVE_Y = 2
78
+ RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y = 3
79
+ RL_ATTACHMENT_CUBEMAP_POSITIVE_Z = 4
80
+ RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z = 5
81
+ RL_ATTACHMENT_TEXTURE2D = 100
82
+ RL_ATTACHMENT_RENDERBUFFER = 200
83
+ RL_LOG_ALL = 0
84
+ RL_LOG_TRACE = 1
85
+ RL_LOG_DEBUG = 2
86
+ RL_LOG_INFO = 3
87
+ RL_LOG_WARNING = 4
88
+ RL_LOG_ERROR = 5
89
+ RL_LOG_FATAL = 6
90
+ RL_LOG_NONE = 7
91
+ RL_PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1
92
+ RL_PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2
93
+ RL_PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3
94
+ RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8 = 4
95
+ RL_PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = 5
96
+ RL_PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = 6
97
+ RL_PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = 7
98
+ RL_PIXELFORMAT_UNCOMPRESSED_R32 = 8
99
+ RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9
100
+ RL_PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10
101
+ RL_PIXELFORMAT_COMPRESSED_DXT1_RGB = 11
102
+ RL_PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12
103
+ RL_PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13
104
+ RL_PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14
105
+ RL_PIXELFORMAT_COMPRESSED_ETC1_RGB = 15
106
+ RL_PIXELFORMAT_COMPRESSED_ETC2_RGB = 16
107
+ RL_PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17
108
+ RL_PIXELFORMAT_COMPRESSED_PVRT_RGB = 18
109
+ RL_PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19
110
+ RL_PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20
111
+ RL_PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21
112
+ RL_TEXTURE_FILTER_POINT = 0
113
+ RL_TEXTURE_FILTER_BILINEAR = 1
114
+ RL_TEXTURE_FILTER_TRILINEAR = 2
115
+ RL_TEXTURE_FILTER_ANISOTROPIC_4X = 3
116
+ RL_TEXTURE_FILTER_ANISOTROPIC_8X = 4
117
+ RL_TEXTURE_FILTER_ANISOTROPIC_16X = 5
118
+ RL_BLEND_ALPHA = 0
119
+ RL_BLEND_ADDITIVE = 1
120
+ RL_BLEND_MULTIPLIED = 2
121
+ RL_BLEND_ADD_COLORS = 3
122
+ RL_BLEND_SUBTRACT_COLORS = 4
123
+ RL_BLEND_CUSTOM = 5
124
+ RL_SHADER_LOC_VERTEX_POSITION = 0
125
+ RL_SHADER_LOC_VERTEX_TEXCOORD01 = 1
126
+ RL_SHADER_LOC_VERTEX_TEXCOORD02 = 2
127
+ RL_SHADER_LOC_VERTEX_NORMAL = 3
128
+ RL_SHADER_LOC_VERTEX_TANGENT = 4
129
+ RL_SHADER_LOC_VERTEX_COLOR = 5
130
+ RL_SHADER_LOC_MATRIX_MVP = 6
131
+ RL_SHADER_LOC_MATRIX_VIEW = 7
132
+ RL_SHADER_LOC_MATRIX_PROJECTION = 8
133
+ RL_SHADER_LOC_MATRIX_MODEL = 9
134
+ RL_SHADER_LOC_MATRIX_NORMAL = 10
135
+ RL_SHADER_LOC_VECTOR_VIEW = 11
136
+ RL_SHADER_LOC_COLOR_DIFFUSE = 12
137
+ RL_SHADER_LOC_COLOR_SPECULAR = 13
138
+ RL_SHADER_LOC_COLOR_AMBIENT = 14
139
+ RL_SHADER_LOC_MAP_ALBEDO = 15
140
+ RL_SHADER_LOC_MAP_METALNESS = 16
141
+ RL_SHADER_LOC_MAP_NORMAL = 17
142
+ RL_SHADER_LOC_MAP_ROUGHNESS = 18
143
+ RL_SHADER_LOC_MAP_OCCLUSION = 19
144
+ RL_SHADER_LOC_MAP_EMISSION = 20
145
+ RL_SHADER_LOC_MAP_HEIGHT = 21
146
+ RL_SHADER_LOC_MAP_CUBEMAP = 22
147
+ RL_SHADER_LOC_MAP_IRRADIANCE = 23
148
+ RL_SHADER_LOC_MAP_PREFILTER = 24
149
+ RL_SHADER_LOC_MAP_BRDF = 25
150
+ RL_SHADER_UNIFORM_FLOAT = 0
151
+ RL_SHADER_UNIFORM_VEC2 = 1
152
+ RL_SHADER_UNIFORM_VEC3 = 2
153
+ RL_SHADER_UNIFORM_VEC4 = 3
154
+ RL_SHADER_UNIFORM_INT = 4
155
+ RL_SHADER_UNIFORM_IVEC2 = 5
156
+ RL_SHADER_UNIFORM_IVEC3 = 6
157
+ RL_SHADER_UNIFORM_IVEC4 = 7
158
+ RL_SHADER_UNIFORM_SAMPLER2D = 8
159
+ RL_SHADER_ATTRIB_FLOAT = 0
160
+ RL_SHADER_ATTRIB_VEC2 = 1
161
+ RL_SHADER_ATTRIB_VEC3 = 2
162
+ RL_SHADER_ATTRIB_VEC4 = 3
163
+
164
+ # Typedef
165
+
166
+ typedef :int, :rlGlVersion
167
+ typedef :int, :rlFramebufferAttachType
168
+ typedef :int, :rlFramebufferAttachTextureType
169
+ typedef :int, :rlTraceLogLevel
170
+ typedef :int, :rlPixelFormat
171
+ typedef :int, :rlTextureFilter
172
+ typedef :int, :rlBlendMode
173
+ typedef :int, :rlShaderLocationIndex
174
+ typedef :int, :rlShaderUniformDataType
175
+ typedef :int, :rlShaderAttributeDataType
176
+
177
+ # Struct
178
+
179
+ class RlVertexBuffer < FFI::Struct
180
+ layout(
181
+ :elementCount, :int,
182
+ :vertices, :pointer,
183
+ :texcoords, :pointer,
184
+ :colors, :pointer,
185
+ :indices, :pointer,
186
+ :vaoId, :uint,
187
+ :vboId, [:uint, 4],
188
+ )
189
+ end
190
+
191
+ class RlDrawCall < FFI::Struct
192
+ layout(
193
+ :mode, :int,
194
+ :vertexCount, :int,
195
+ :vertexAlignment, :int,
196
+ :textureId, :uint,
197
+ )
198
+ end
199
+
200
+ class RlRenderBatch < FFI::Struct
201
+ layout(
202
+ :bufferCount, :int,
203
+ :currentBuffer, :int,
204
+ :vertexBuffer, :pointer,
205
+ :draws, :pointer,
206
+ :drawCounter, :int,
207
+ :currentDepth, :float,
208
+ )
209
+ end
210
+
211
+
212
+ # Function
213
+
214
+ def self.setup_rlgl_symbols()
215
+ symbols = [
216
+ :rlMatrixMode,
217
+ :rlPushMatrix,
218
+ :rlPopMatrix,
219
+ :rlLoadIdentity,
220
+ :rlTranslatef,
221
+ :rlRotatef,
222
+ :rlScalef,
223
+ :rlMultMatrixf,
224
+ :rlFrustum,
225
+ :rlOrtho,
226
+ :rlViewport,
227
+ :rlBegin,
228
+ :rlEnd,
229
+ :rlVertex2i,
230
+ :rlVertex2f,
231
+ :rlVertex3f,
232
+ :rlTexCoord2f,
233
+ :rlNormal3f,
234
+ :rlColor4ub,
235
+ :rlColor3f,
236
+ :rlColor4f,
237
+ :rlEnableVertexArray,
238
+ :rlDisableVertexArray,
239
+ :rlEnableVertexBuffer,
240
+ :rlDisableVertexBuffer,
241
+ :rlEnableVertexBufferElement,
242
+ :rlDisableVertexBufferElement,
243
+ :rlEnableVertexAttribute,
244
+ :rlDisableVertexAttribute,
245
+ :rlActiveTextureSlot,
246
+ :rlEnableTexture,
247
+ :rlDisableTexture,
248
+ :rlEnableTextureCubemap,
249
+ :rlDisableTextureCubemap,
250
+ :rlTextureParameters,
251
+ :rlEnableShader,
252
+ :rlDisableShader,
253
+ :rlEnableFramebuffer,
254
+ :rlDisableFramebuffer,
255
+ :rlActiveDrawBuffers,
256
+ :rlEnableColorBlend,
257
+ :rlDisableColorBlend,
258
+ :rlEnableDepthTest,
259
+ :rlDisableDepthTest,
260
+ :rlEnableDepthMask,
261
+ :rlDisableDepthMask,
262
+ :rlEnableBackfaceCulling,
263
+ :rlDisableBackfaceCulling,
264
+ :rlEnableScissorTest,
265
+ :rlDisableScissorTest,
266
+ :rlScissor,
267
+ :rlEnableWireMode,
268
+ :rlDisableWireMode,
269
+ :rlSetLineWidth,
270
+ :rlGetLineWidth,
271
+ :rlEnableSmoothLines,
272
+ :rlDisableSmoothLines,
273
+ :rlEnableStereoRender,
274
+ :rlDisableStereoRender,
275
+ :rlIsStereoRenderEnabled,
276
+ :rlClearColor,
277
+ :rlClearScreenBuffers,
278
+ :rlCheckErrors,
279
+ :rlSetBlendMode,
280
+ :rlSetBlendFactors,
281
+ :rlglInit,
282
+ :rlglClose,
283
+ :rlLoadExtensions,
284
+ :rlGetVersion,
285
+ :rlGetFramebufferWidth,
286
+ :rlGetFramebufferHeight,
287
+ :rlGetTextureIdDefault,
288
+ :rlGetShaderIdDefault,
289
+ :rlGetShaderLocsDefault,
290
+ :rlLoadRenderBatch,
291
+ :rlUnloadRenderBatch,
292
+ :rlDrawRenderBatch,
293
+ :rlSetRenderBatchActive,
294
+ :rlDrawRenderBatchActive,
295
+ :rlCheckRenderBatchLimit,
296
+ :rlSetTexture,
297
+ :rlLoadVertexArray,
298
+ :rlLoadVertexBuffer,
299
+ :rlLoadVertexBufferElement,
300
+ :rlUpdateVertexBuffer,
301
+ :rlUnloadVertexArray,
302
+ :rlUnloadVertexBuffer,
303
+ :rlSetVertexAttribute,
304
+ :rlSetVertexAttributeDivisor,
305
+ :rlSetVertexAttributeDefault,
306
+ :rlDrawVertexArray,
307
+ :rlDrawVertexArrayElements,
308
+ :rlDrawVertexArrayInstanced,
309
+ :rlDrawVertexArrayElementsInstanced,
310
+ :rlLoadTexture,
311
+ :rlLoadTextureDepth,
312
+ :rlLoadTextureCubemap,
313
+ :rlUpdateTexture,
314
+ :rlGetGlTextureFormats,
315
+ :rlGetPixelFormatName,
316
+ :rlUnloadTexture,
317
+ :rlGenTextureMipmaps,
318
+ :rlReadTexturePixels,
319
+ :rlReadScreenPixels,
320
+ :rlLoadFramebuffer,
321
+ :rlFramebufferAttach,
322
+ :rlFramebufferComplete,
323
+ :rlUnloadFramebuffer,
324
+ :rlLoadShaderCode,
325
+ :rlCompileShader,
326
+ :rlLoadShaderProgram,
327
+ :rlUnloadShaderProgram,
328
+ :rlGetLocationUniform,
329
+ :rlGetLocationAttrib,
330
+ :rlSetUniform,
331
+ :rlSetUniformMatrix,
332
+ :rlSetUniformSampler,
333
+ :rlSetShader,
334
+ :rlLoadComputeShaderProgram,
335
+ :rlComputeShaderDispatch,
336
+ :rlLoadShaderBuffer,
337
+ :rlUnloadShaderBuffer,
338
+ :rlUpdateShaderBufferElements,
339
+ :rlGetShaderBufferSize,
340
+ :rlReadShaderBufferElements,
341
+ :rlBindShaderBuffer,
342
+ :rlCopyBuffersElements,
343
+ :rlBindImageTexture,
344
+ :rlGetMatrixModelview,
345
+ :rlGetMatrixProjection,
346
+ :rlGetMatrixTransform,
347
+ :rlGetMatrixProjectionStereo,
348
+ :rlGetMatrixViewOffsetStereo,
349
+ :rlSetMatrixProjection,
350
+ :rlSetMatrixModelview,
351
+ :rlSetMatrixProjectionStereo,
352
+ :rlSetMatrixViewOffsetStereo,
353
+ :rlLoadDrawCube,
354
+ :rlLoadDrawQuad,
355
+ ]
356
+ args = {
357
+ :rlMatrixMode => [:int],
358
+ :rlPushMatrix => [],
359
+ :rlPopMatrix => [],
360
+ :rlLoadIdentity => [],
361
+ :rlTranslatef => [:float, :float, :float],
362
+ :rlRotatef => [:float, :float, :float, :float],
363
+ :rlScalef => [:float, :float, :float],
364
+ :rlMultMatrixf => [:pointer],
365
+ :rlFrustum => [:double, :double, :double, :double, :double, :double],
366
+ :rlOrtho => [:double, :double, :double, :double, :double, :double],
367
+ :rlViewport => [:int, :int, :int, :int],
368
+ :rlBegin => [:int],
369
+ :rlEnd => [],
370
+ :rlVertex2i => [:int, :int],
371
+ :rlVertex2f => [:float, :float],
372
+ :rlVertex3f => [:float, :float, :float],
373
+ :rlTexCoord2f => [:float, :float],
374
+ :rlNormal3f => [:float, :float, :float],
375
+ :rlColor4ub => [:uchar, :uchar, :uchar, :uchar],
376
+ :rlColor3f => [:float, :float, :float],
377
+ :rlColor4f => [:float, :float, :float, :float],
378
+ :rlEnableVertexArray => [:uint],
379
+ :rlDisableVertexArray => [],
380
+ :rlEnableVertexBuffer => [:uint],
381
+ :rlDisableVertexBuffer => [],
382
+ :rlEnableVertexBufferElement => [:uint],
383
+ :rlDisableVertexBufferElement => [],
384
+ :rlEnableVertexAttribute => [:uint],
385
+ :rlDisableVertexAttribute => [:uint],
386
+ :rlActiveTextureSlot => [:int],
387
+ :rlEnableTexture => [:uint],
388
+ :rlDisableTexture => [],
389
+ :rlEnableTextureCubemap => [:uint],
390
+ :rlDisableTextureCubemap => [],
391
+ :rlTextureParameters => [:uint, :int, :int],
392
+ :rlEnableShader => [:uint],
393
+ :rlDisableShader => [],
394
+ :rlEnableFramebuffer => [:uint],
395
+ :rlDisableFramebuffer => [],
396
+ :rlActiveDrawBuffers => [:int],
397
+ :rlEnableColorBlend => [],
398
+ :rlDisableColorBlend => [],
399
+ :rlEnableDepthTest => [],
400
+ :rlDisableDepthTest => [],
401
+ :rlEnableDepthMask => [],
402
+ :rlDisableDepthMask => [],
403
+ :rlEnableBackfaceCulling => [],
404
+ :rlDisableBackfaceCulling => [],
405
+ :rlEnableScissorTest => [],
406
+ :rlDisableScissorTest => [],
407
+ :rlScissor => [:int, :int, :int, :int],
408
+ :rlEnableWireMode => [],
409
+ :rlDisableWireMode => [],
410
+ :rlSetLineWidth => [:float],
411
+ :rlGetLineWidth => [],
412
+ :rlEnableSmoothLines => [],
413
+ :rlDisableSmoothLines => [],
414
+ :rlEnableStereoRender => [],
415
+ :rlDisableStereoRender => [],
416
+ :rlIsStereoRenderEnabled => [],
417
+ :rlClearColor => [:uchar, :uchar, :uchar, :uchar],
418
+ :rlClearScreenBuffers => [],
419
+ :rlCheckErrors => [],
420
+ :rlSetBlendMode => [:int],
421
+ :rlSetBlendFactors => [:int, :int, :int],
422
+ :rlglInit => [:int, :int],
423
+ :rlglClose => [],
424
+ :rlLoadExtensions => [:pointer],
425
+ :rlGetVersion => [],
426
+ :rlGetFramebufferWidth => [],
427
+ :rlGetFramebufferHeight => [],
428
+ :rlGetTextureIdDefault => [],
429
+ :rlGetShaderIdDefault => [],
430
+ :rlGetShaderLocsDefault => [],
431
+ :rlLoadRenderBatch => [:int, :int],
432
+ :rlUnloadRenderBatch => [RlRenderBatch.by_value],
433
+ :rlDrawRenderBatch => [:pointer],
434
+ :rlSetRenderBatchActive => [:pointer],
435
+ :rlDrawRenderBatchActive => [],
436
+ :rlCheckRenderBatchLimit => [:int],
437
+ :rlSetTexture => [:uint],
438
+ :rlLoadVertexArray => [],
439
+ :rlLoadVertexBuffer => [:pointer, :int, :bool],
440
+ :rlLoadVertexBufferElement => [:pointer, :int, :bool],
441
+ :rlUpdateVertexBuffer => [:uint, :pointer, :int, :int],
442
+ :rlUnloadVertexArray => [:uint],
443
+ :rlUnloadVertexBuffer => [:uint],
444
+ :rlSetVertexAttribute => [:uint, :int, :int, :bool, :int, :pointer],
445
+ :rlSetVertexAttributeDivisor => [:uint, :int],
446
+ :rlSetVertexAttributeDefault => [:int, :pointer, :int, :int],
447
+ :rlDrawVertexArray => [:int, :int],
448
+ :rlDrawVertexArrayElements => [:int, :int, :pointer],
449
+ :rlDrawVertexArrayInstanced => [:int, :int, :int],
450
+ :rlDrawVertexArrayElementsInstanced => [:int, :int, :pointer, :int],
451
+ :rlLoadTexture => [:pointer, :int, :int, :int, :int],
452
+ :rlLoadTextureDepth => [:int, :int, :bool],
453
+ :rlLoadTextureCubemap => [:pointer, :int, :int],
454
+ :rlUpdateTexture => [:uint, :int, :int, :int, :int, :int, :pointer],
455
+ :rlGetGlTextureFormats => [:int, :pointer, :pointer, :pointer],
456
+ :rlGetPixelFormatName => [:uint],
457
+ :rlUnloadTexture => [:uint],
458
+ :rlGenTextureMipmaps => [:uint, :int, :int, :int, :pointer],
459
+ :rlReadTexturePixels => [:uint, :int, :int, :int],
460
+ :rlReadScreenPixels => [:int, :int],
461
+ :rlLoadFramebuffer => [:int, :int],
462
+ :rlFramebufferAttach => [:uint, :uint, :int, :int, :int],
463
+ :rlFramebufferComplete => [:uint],
464
+ :rlUnloadFramebuffer => [:uint],
465
+ :rlLoadShaderCode => [:pointer, :pointer],
466
+ :rlCompileShader => [:pointer, :int],
467
+ :rlLoadShaderProgram => [:uint, :uint],
468
+ :rlUnloadShaderProgram => [:uint],
469
+ :rlGetLocationUniform => [:uint, :pointer],
470
+ :rlGetLocationAttrib => [:uint, :pointer],
471
+ :rlSetUniform => [:int, :pointer, :int, :int],
472
+ :rlSetUniformMatrix => [:int, Matrix.by_value],
473
+ :rlSetUniformSampler => [:int, :uint],
474
+ :rlSetShader => [:uint, :pointer],
475
+ :rlLoadComputeShaderProgram => [:uint],
476
+ :rlComputeShaderDispatch => [:uint, :uint, :uint],
477
+ :rlLoadShaderBuffer => [:ulong_long, :pointer, :int],
478
+ :rlUnloadShaderBuffer => [:uint],
479
+ :rlUpdateShaderBufferElements => [:uint, :pointer, :ulong_long, :ulong_long],
480
+ :rlGetShaderBufferSize => [:uint],
481
+ :rlReadShaderBufferElements => [:uint, :pointer, :ulong_long, :ulong_long],
482
+ :rlBindShaderBuffer => [:uint, :uint],
483
+ :rlCopyBuffersElements => [:uint, :uint, :ulong_long, :ulong_long, :ulong_long],
484
+ :rlBindImageTexture => [:uint, :uint, :uint, :int],
485
+ :rlGetMatrixModelview => [],
486
+ :rlGetMatrixProjection => [],
487
+ :rlGetMatrixTransform => [],
488
+ :rlGetMatrixProjectionStereo => [:int],
489
+ :rlGetMatrixViewOffsetStereo => [:int],
490
+ :rlSetMatrixProjection => [Matrix.by_value],
491
+ :rlSetMatrixModelview => [Matrix.by_value],
492
+ :rlSetMatrixProjectionStereo => [Matrix.by_value, Matrix.by_value],
493
+ :rlSetMatrixViewOffsetStereo => [Matrix.by_value, Matrix.by_value],
494
+ :rlLoadDrawCube => [],
495
+ :rlLoadDrawQuad => [],
496
+ }
497
+ retvals = {
498
+ :rlMatrixMode => :void,
499
+ :rlPushMatrix => :void,
500
+ :rlPopMatrix => :void,
501
+ :rlLoadIdentity => :void,
502
+ :rlTranslatef => :void,
503
+ :rlRotatef => :void,
504
+ :rlScalef => :void,
505
+ :rlMultMatrixf => :void,
506
+ :rlFrustum => :void,
507
+ :rlOrtho => :void,
508
+ :rlViewport => :void,
509
+ :rlBegin => :void,
510
+ :rlEnd => :void,
511
+ :rlVertex2i => :void,
512
+ :rlVertex2f => :void,
513
+ :rlVertex3f => :void,
514
+ :rlTexCoord2f => :void,
515
+ :rlNormal3f => :void,
516
+ :rlColor4ub => :void,
517
+ :rlColor3f => :void,
518
+ :rlColor4f => :void,
519
+ :rlEnableVertexArray => :bool,
520
+ :rlDisableVertexArray => :void,
521
+ :rlEnableVertexBuffer => :void,
522
+ :rlDisableVertexBuffer => :void,
523
+ :rlEnableVertexBufferElement => :void,
524
+ :rlDisableVertexBufferElement => :void,
525
+ :rlEnableVertexAttribute => :void,
526
+ :rlDisableVertexAttribute => :void,
527
+ :rlActiveTextureSlot => :void,
528
+ :rlEnableTexture => :void,
529
+ :rlDisableTexture => :void,
530
+ :rlEnableTextureCubemap => :void,
531
+ :rlDisableTextureCubemap => :void,
532
+ :rlTextureParameters => :void,
533
+ :rlEnableShader => :void,
534
+ :rlDisableShader => :void,
535
+ :rlEnableFramebuffer => :void,
536
+ :rlDisableFramebuffer => :void,
537
+ :rlActiveDrawBuffers => :void,
538
+ :rlEnableColorBlend => :void,
539
+ :rlDisableColorBlend => :void,
540
+ :rlEnableDepthTest => :void,
541
+ :rlDisableDepthTest => :void,
542
+ :rlEnableDepthMask => :void,
543
+ :rlDisableDepthMask => :void,
544
+ :rlEnableBackfaceCulling => :void,
545
+ :rlDisableBackfaceCulling => :void,
546
+ :rlEnableScissorTest => :void,
547
+ :rlDisableScissorTest => :void,
548
+ :rlScissor => :void,
549
+ :rlEnableWireMode => :void,
550
+ :rlDisableWireMode => :void,
551
+ :rlSetLineWidth => :void,
552
+ :rlGetLineWidth => :float,
553
+ :rlEnableSmoothLines => :void,
554
+ :rlDisableSmoothLines => :void,
555
+ :rlEnableStereoRender => :void,
556
+ :rlDisableStereoRender => :void,
557
+ :rlIsStereoRenderEnabled => :bool,
558
+ :rlClearColor => :void,
559
+ :rlClearScreenBuffers => :void,
560
+ :rlCheckErrors => :void,
561
+ :rlSetBlendMode => :void,
562
+ :rlSetBlendFactors => :void,
563
+ :rlglInit => :void,
564
+ :rlglClose => :void,
565
+ :rlLoadExtensions => :void,
566
+ :rlGetVersion => :int,
567
+ :rlGetFramebufferWidth => :int,
568
+ :rlGetFramebufferHeight => :int,
569
+ :rlGetTextureIdDefault => :uint,
570
+ :rlGetShaderIdDefault => :uint,
571
+ :rlGetShaderLocsDefault => :pointer,
572
+ :rlLoadRenderBatch => RlRenderBatch.by_value,
573
+ :rlUnloadRenderBatch => :void,
574
+ :rlDrawRenderBatch => :void,
575
+ :rlSetRenderBatchActive => :void,
576
+ :rlDrawRenderBatchActive => :void,
577
+ :rlCheckRenderBatchLimit => :bool,
578
+ :rlSetTexture => :void,
579
+ :rlLoadVertexArray => :uint,
580
+ :rlLoadVertexBuffer => :uint,
581
+ :rlLoadVertexBufferElement => :uint,
582
+ :rlUpdateVertexBuffer => :void,
583
+ :rlUnloadVertexArray => :void,
584
+ :rlUnloadVertexBuffer => :void,
585
+ :rlSetVertexAttribute => :void,
586
+ :rlSetVertexAttributeDivisor => :void,
587
+ :rlSetVertexAttributeDefault => :void,
588
+ :rlDrawVertexArray => :void,
589
+ :rlDrawVertexArrayElements => :void,
590
+ :rlDrawVertexArrayInstanced => :void,
591
+ :rlDrawVertexArrayElementsInstanced => :void,
592
+ :rlLoadTexture => :uint,
593
+ :rlLoadTextureDepth => :uint,
594
+ :rlLoadTextureCubemap => :uint,
595
+ :rlUpdateTexture => :void,
596
+ :rlGetGlTextureFormats => :void,
597
+ :rlGetPixelFormatName => :pointer,
598
+ :rlUnloadTexture => :void,
599
+ :rlGenTextureMipmaps => :void,
600
+ :rlReadTexturePixels => :pointer,
601
+ :rlReadScreenPixels => :pointer,
602
+ :rlLoadFramebuffer => :uint,
603
+ :rlFramebufferAttach => :void,
604
+ :rlFramebufferComplete => :bool,
605
+ :rlUnloadFramebuffer => :void,
606
+ :rlLoadShaderCode => :uint,
607
+ :rlCompileShader => :uint,
608
+ :rlLoadShaderProgram => :uint,
609
+ :rlUnloadShaderProgram => :void,
610
+ :rlGetLocationUniform => :int,
611
+ :rlGetLocationAttrib => :int,
612
+ :rlSetUniform => :void,
613
+ :rlSetUniformMatrix => :void,
614
+ :rlSetUniformSampler => :void,
615
+ :rlSetShader => :void,
616
+ :rlLoadComputeShaderProgram => :uint,
617
+ :rlComputeShaderDispatch => :void,
618
+ :rlLoadShaderBuffer => :uint,
619
+ :rlUnloadShaderBuffer => :void,
620
+ :rlUpdateShaderBufferElements => :void,
621
+ :rlGetShaderBufferSize => :ulong_long,
622
+ :rlReadShaderBufferElements => :void,
623
+ :rlBindShaderBuffer => :void,
624
+ :rlCopyBuffersElements => :void,
625
+ :rlBindImageTexture => :void,
626
+ :rlGetMatrixModelview => Matrix.by_value,
627
+ :rlGetMatrixProjection => Matrix.by_value,
628
+ :rlGetMatrixTransform => Matrix.by_value,
629
+ :rlGetMatrixProjectionStereo => Matrix.by_value,
630
+ :rlGetMatrixViewOffsetStereo => Matrix.by_value,
631
+ :rlSetMatrixProjection => :void,
632
+ :rlSetMatrixModelview => :void,
633
+ :rlSetMatrixProjectionStereo => :void,
634
+ :rlSetMatrixViewOffsetStereo => :void,
635
+ :rlLoadDrawCube => :void,
636
+ :rlLoadDrawQuad => :void,
637
+ }
638
+ symbols.each do |sym|
639
+ begin
640
+ attach_function sym, args[sym], retvals[sym]
641
+ rescue FFI::NotFoundError => error
642
+ $stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
643
+ end
644
+ end
645
+ end
646
+
647
+ end
648
+