raylib-bindings 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/raylib_main.rb CHANGED
@@ -17,6 +17,8 @@ module Raylib
17
17
 
18
18
  # Enum
19
19
 
20
+ # enum ConfigFlags
21
+ # System/Window config flags
20
22
  FLAG_VSYNC_HINT = 64 # Set to try enabling V-Sync on GPU
21
23
  FLAG_FULLSCREEN_MODE = 2 # Set to run program in fullscreen
22
24
  FLAG_WINDOW_RESIZABLE = 4 # Set to allow resizable window
@@ -32,6 +34,9 @@ module Raylib
32
34
  FLAG_WINDOW_MOUSE_PASSTHROUGH = 16384 # Set to support mouse passthrough, only supported when FLAG_WINDOW_UNDECORATED
33
35
  FLAG_MSAA_4X_HINT = 32 # Set to try enabling MSAA 4X
34
36
  FLAG_INTERLACED_HINT = 65536 # Set to try enabling interlaced video format (for V3D)
37
+
38
+ # enum TraceLogLevel
39
+ # Trace log level
35
40
  LOG_ALL = 0 # Display all logs
36
41
  LOG_TRACE = 1 # Trace logging, intended for internal use only
37
42
  LOG_DEBUG = 2 # Debug logging, used for internal debugging, it should be disabled on release builds
@@ -40,6 +45,9 @@ module Raylib
40
45
  LOG_ERROR = 5 # Error logging, used on unrecoverable failures
41
46
  LOG_FATAL = 6 # Fatal logging, used to abort program: exit(EXIT_FAILURE)
42
47
  LOG_NONE = 7 # Disable logging
48
+
49
+ # enum KeyboardKey
50
+ # Keyboard keys (US keyboard layout)
43
51
  KEY_NULL = 0 # Key: NULL, used for no key pressed
44
52
  KEY_APOSTROPHE = 39 # Key: '
45
53
  KEY_COMMA = 44 # Key: ,
@@ -150,6 +158,9 @@ module Raylib
150
158
  KEY_MENU = 82 # Key: Android menu button
151
159
  KEY_VOLUME_UP = 24 # Key: Android volume up button
152
160
  KEY_VOLUME_DOWN = 25 # Key: Android volume down button
161
+
162
+ # enum MouseButton
163
+ # Mouse buttons
153
164
  MOUSE_BUTTON_LEFT = 0 # Mouse button left
154
165
  MOUSE_BUTTON_RIGHT = 1 # Mouse button right
155
166
  MOUSE_BUTTON_MIDDLE = 2 # Mouse button middle (pressed wheel)
@@ -157,6 +168,9 @@ module Raylib
157
168
  MOUSE_BUTTON_EXTRA = 4 # Mouse button extra (advanced mouse device)
158
169
  MOUSE_BUTTON_FORWARD = 5 # Mouse button forward (advanced mouse device)
159
170
  MOUSE_BUTTON_BACK = 6 # Mouse button back (advanced mouse device)
171
+
172
+ # enum MouseCursor
173
+ # Mouse cursor
160
174
  MOUSE_CURSOR_DEFAULT = 0 # Default pointer shape
161
175
  MOUSE_CURSOR_ARROW = 1 # Arrow shape
162
176
  MOUSE_CURSOR_IBEAM = 2 # Text writing cursor shape
@@ -168,6 +182,9 @@ module Raylib
168
182
  MOUSE_CURSOR_RESIZE_NESW = 8 # The top-right to bottom-left diagonal resize/move arrow shape
169
183
  MOUSE_CURSOR_RESIZE_ALL = 9 # The omni-directional resize/move cursor shape
170
184
  MOUSE_CURSOR_NOT_ALLOWED = 10 # The operation-not-allowed shape
185
+
186
+ # enum GamepadButton
187
+ # Gamepad buttons
171
188
  GAMEPAD_BUTTON_UNKNOWN = 0 # Unknown button, just for error checking
172
189
  GAMEPAD_BUTTON_LEFT_FACE_UP = 1 # Gamepad left DPAD up button
173
190
  GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2 # Gamepad left DPAD right button
@@ -186,12 +203,18 @@ module Raylib
186
203
  GAMEPAD_BUTTON_MIDDLE_RIGHT = 15 # Gamepad center buttons, right one (i.e. PS3: Start)
187
204
  GAMEPAD_BUTTON_LEFT_THUMB = 16 # Gamepad joystick pressed button left
188
205
  GAMEPAD_BUTTON_RIGHT_THUMB = 17 # Gamepad joystick pressed button right
206
+
207
+ # enum GamepadAxis
208
+ # Gamepad axis
189
209
  GAMEPAD_AXIS_LEFT_X = 0 # Gamepad left stick X axis
190
210
  GAMEPAD_AXIS_LEFT_Y = 1 # Gamepad left stick Y axis
191
211
  GAMEPAD_AXIS_RIGHT_X = 2 # Gamepad right stick X axis
192
212
  GAMEPAD_AXIS_RIGHT_Y = 3 # Gamepad right stick Y axis
193
213
  GAMEPAD_AXIS_LEFT_TRIGGER = 4 # Gamepad back trigger left, pressure level: [1..-1]
194
214
  GAMEPAD_AXIS_RIGHT_TRIGGER = 5 # Gamepad back trigger right, pressure level: [1..-1]
215
+
216
+ # enum MaterialMapIndex
217
+ # Material map index
195
218
  MATERIAL_MAP_ALBEDO = 0 # Albedo material (same as: MATERIAL_MAP_DIFFUSE)
196
219
  MATERIAL_MAP_METALNESS = 1 # Metalness material (same as: MATERIAL_MAP_SPECULAR)
197
220
  MATERIAL_MAP_NORMAL = 2 # Normal material
@@ -203,6 +226,9 @@ module Raylib
203
226
  MATERIAL_MAP_IRRADIANCE = 8 # Irradiance material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
204
227
  MATERIAL_MAP_PREFILTER = 9 # Prefilter material (NOTE: Uses GL_TEXTURE_CUBE_MAP)
205
228
  MATERIAL_MAP_BRDF = 10 # Brdf material
229
+
230
+ # enum ShaderLocationIndex
231
+ # Shader location index
206
232
  SHADER_LOC_VERTEX_POSITION = 0 # Shader location: vertex attribute: position
207
233
  SHADER_LOC_VERTEX_TEXCOORD01 = 1 # Shader location: vertex attribute: texcoord01
208
234
  SHADER_LOC_VERTEX_TEXCOORD02 = 2 # Shader location: vertex attribute: texcoord02
@@ -229,6 +255,9 @@ module Raylib
229
255
  SHADER_LOC_MAP_IRRADIANCE = 23 # Shader location: samplerCube texture: irradiance
230
256
  SHADER_LOC_MAP_PREFILTER = 24 # Shader location: samplerCube texture: prefilter
231
257
  SHADER_LOC_MAP_BRDF = 25 # Shader location: sampler2d texture: brdf
258
+
259
+ # enum ShaderUniformDataType
260
+ # Shader uniform data type
232
261
  SHADER_UNIFORM_FLOAT = 0 # Shader uniform type: float
233
262
  SHADER_UNIFORM_VEC2 = 1 # Shader uniform type: vec2 (2 float)
234
263
  SHADER_UNIFORM_VEC3 = 2 # Shader uniform type: vec3 (3 float)
@@ -238,10 +267,16 @@ module Raylib
238
267
  SHADER_UNIFORM_IVEC3 = 6 # Shader uniform type: ivec3 (3 int)
239
268
  SHADER_UNIFORM_IVEC4 = 7 # Shader uniform type: ivec4 (4 int)
240
269
  SHADER_UNIFORM_SAMPLER2D = 8 # Shader uniform type: sampler2d
270
+
271
+ # enum ShaderAttributeDataType
272
+ # Shader attribute data types
241
273
  SHADER_ATTRIB_FLOAT = 0 # Shader attribute type: float
242
274
  SHADER_ATTRIB_VEC2 = 1 # Shader attribute type: vec2 (2 float)
243
275
  SHADER_ATTRIB_VEC3 = 2 # Shader attribute type: vec3 (3 float)
244
276
  SHADER_ATTRIB_VEC4 = 3 # Shader attribute type: vec4 (4 float)
277
+
278
+ # enum PixelFormat
279
+ # Pixel formats
245
280
  PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1 # 8 bit per pixel (no alpha)
246
281
  PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2 # 8*2 bpp (2 channels)
247
282
  PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3 # 16 bpp
@@ -263,25 +298,40 @@ module Raylib
263
298
  PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 # 4 bpp
264
299
  PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 # 8 bpp
265
300
  PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 # 2 bpp
301
+
302
+ # enum TextureFilter
303
+ # Texture parameters: filter mode
266
304
  TEXTURE_FILTER_POINT = 0 # No filter, just pixel approximation
267
305
  TEXTURE_FILTER_BILINEAR = 1 # Linear filtering
268
306
  TEXTURE_FILTER_TRILINEAR = 2 # Trilinear filtering (linear with mipmaps)
269
307
  TEXTURE_FILTER_ANISOTROPIC_4X = 3 # Anisotropic filtering 4x
270
308
  TEXTURE_FILTER_ANISOTROPIC_8X = 4 # Anisotropic filtering 8x
271
309
  TEXTURE_FILTER_ANISOTROPIC_16X = 5 # Anisotropic filtering 16x
310
+
311
+ # enum TextureWrap
312
+ # Texture parameters: wrap mode
272
313
  TEXTURE_WRAP_REPEAT = 0 # Repeats texture in tiled mode
273
314
  TEXTURE_WRAP_CLAMP = 1 # Clamps texture to edge pixel in tiled mode
274
315
  TEXTURE_WRAP_MIRROR_REPEAT = 2 # Mirrors and repeats the texture in tiled mode
275
316
  TEXTURE_WRAP_MIRROR_CLAMP = 3 # Mirrors and clamps to border the texture in tiled mode
317
+
318
+ # enum CubemapLayout
319
+ # Cubemap layouts
276
320
  CUBEMAP_LAYOUT_AUTO_DETECT = 0 # Automatically detect layout type
277
321
  CUBEMAP_LAYOUT_LINE_VERTICAL = 1 # Layout is defined by a vertical line with faces
278
322
  CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2 # Layout is defined by an horizontal line with faces
279
323
  CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3 # Layout is defined by a 3x4 cross with cubemap faces
280
324
  CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4 # Layout is defined by a 4x3 cross with cubemap faces
281
325
  CUBEMAP_LAYOUT_PANORAMA = 5 # Layout is defined by a panorama image (equirectangular map)
326
+
327
+ # enum FontType
328
+ # Font type, defines generation method
282
329
  FONT_DEFAULT = 0 # Default font generation, anti-aliased
283
330
  FONT_BITMAP = 1 # Bitmap font generation, no anti-aliasing
284
331
  FONT_SDF = 2 # SDF font generation, requires external shader
332
+
333
+ # enum BlendMode
334
+ # Color blending modes (pre-defined)
285
335
  BLEND_ALPHA = 0 # Blend textures considering alpha (default)
286
336
  BLEND_ADDITIVE = 1 # Blend textures adding colors
287
337
  BLEND_MULTIPLIED = 2 # Blend textures multiplying colors
@@ -290,6 +340,9 @@ module Raylib
290
340
  BLEND_ALPHA_PREMULTIPLY = 5 # Blend premultiplied textures considering alpha
291
341
  BLEND_CUSTOM = 6 # Blend textures using custom src/dst factors (use rlSetBlendFactors())
292
342
  BLEND_CUSTOM_SEPARATE = 7 # Blend textures using custom rgb/alpha separate src/dst factors (use rlSetBlendFactorsSeparate())
343
+
344
+ # enum Gesture
345
+ # Gesture
293
346
  GESTURE_NONE = 0 # No gesture
294
347
  GESTURE_TAP = 1 # Tap gesture
295
348
  GESTURE_DOUBLETAP = 2 # Double tap gesture
@@ -301,17 +354,27 @@ module Raylib
301
354
  GESTURE_SWIPE_DOWN = 128 # Swipe down gesture
302
355
  GESTURE_PINCH_IN = 256 # Pinch in gesture
303
356
  GESTURE_PINCH_OUT = 512 # Pinch out gesture
357
+
358
+ # enum CameraMode
359
+ # Camera system modes
304
360
  CAMERA_CUSTOM = 0 # Custom camera
305
361
  CAMERA_FREE = 1 # Free camera
306
362
  CAMERA_ORBITAL = 2 # Orbital camera
307
363
  CAMERA_FIRST_PERSON = 3 # First person camera
308
364
  CAMERA_THIRD_PERSON = 4 # Third person camera
365
+
366
+ # enum CameraProjection
367
+ # Camera projection
309
368
  CAMERA_PERSPECTIVE = 0 # Perspective projection
310
369
  CAMERA_ORTHOGRAPHIC = 1 # Orthographic projection
370
+
371
+ # enum NPatchLayout
372
+ # N-patch layout
311
373
  NPATCH_NINE_PATCH = 0 # Npatch layout: 3x3 tiles
312
374
  NPATCH_THREE_PATCH_VERTICAL = 1 # Npatch layout: 1x3 tiles
313
375
  NPATCH_THREE_PATCH_HORIZONTAL = 2 # Npatch layout: 3x1 tiles
314
376
 
377
+
315
378
  # Typedef
316
379
 
317
380
  typedef :int, :ConfigFlags
@@ -707,19 +770,7 @@ module Raylib
707
770
 
708
771
  # Function
709
772
 
710
- def DrawModelEx(model, position, rotationAxis, rotationAngle, scale, tint)
711
- # [TODO] Fix matrix copy
712
- # - In C, DrawModelEx uses the whole copy of `model` on stack, which will never affect the content of original `model`.
713
- # But Ruby FFI seems to pass the reference of `model` to DrawModelEx, which results in transform accumulation (e.g.:`model` get rotated by `rotationAngle` around `rotationAxis` every frame).
714
- # So here I copy the transform into `mtx_clone` and copy back this to the original after finished calling DrawModelEx.
715
- # - Other DrawXXX members (DrawModel, DrawModelWires, DrawModelWiresEx) are free from this problem.
716
- # - They call DrawModelEx in C layer, which will use the copy of `model` on stack.
717
- mtx_clone = model[:transform].clone
718
- internalDrawModelEx(model, position, rotationAxis, rotationAngle, scale, tint)
719
- model[:transform] = mtx_clone
720
- end
721
-
722
- def self.setup_raylib_symbols(output_error = false)
773
+ def self.setup_raylib_symbols
723
774
  entries = [
724
775
 
725
776
  # InitWindow : Initialize window and OpenGL context
@@ -3225,7 +3276,7 @@ module Raylib
3225
3276
  # @return [void]
3226
3277
  [:DrawModel, :DrawModel, [Model.by_value, Vector3.by_value, :float, Color.by_value], :void],
3227
3278
 
3228
- # DrawModelEx : Draw a model with extended parameters
3279
+ # internalDrawModelEx : Draw a model with extended parameters
3229
3280
  # @param model [Model]
3230
3281
  # @param position [Vector3]
3231
3282
  # @param rotationAxis [Vector3]
@@ -3862,13 +3913,9 @@ module Raylib
3862
3913
  [:DetachAudioStreamProcessor, :DetachAudioStreamProcessor, [AudioStream.by_value, :AudioCallback], :void],
3863
3914
  ]
3864
3915
  entries.each do |entry|
3865
- begin
3866
- attach_function entry[0], entry[1], entry[2], entry[3]
3867
- rescue FFI::NotFoundError => error
3868
- $stderr.puts("[Warning] Failed to import #{entry[0]} (#{error}).") if output_error
3869
- end
3916
+ attach_function entry[0], entry[1], entry[2], entry[3]
3917
+ rescue FFI::NotFoundError => e
3918
+ warn "[Warning] Failed to import #{entry[0]} (#{e})."
3870
3919
  end
3871
3920
  end
3872
-
3873
3921
  end
3874
-