raylib 4.5.0.alpha1
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.
- checksums.yaml +7 -0
- data/LICENSE.txt +16 -0
- data/README.md +97 -0
- data/lib/raylib/core/callbacks.rb +19 -0
- data/lib/raylib/core/colors.rb +32 -0
- data/lib/raylib/core/enums.rb +694 -0
- data/lib/raylib/core/functions.rb +1552 -0
- data/lib/raylib/core/structs/audio_stream.rb +71 -0
- data/lib/raylib/core/structs/bone_info.rb +38 -0
- data/lib/raylib/core/structs/bounding_box.rb +38 -0
- data/lib/raylib/core/structs/camera2_d.rb +60 -0
- data/lib/raylib/core/structs/camera3_d.rb +74 -0
- data/lib/raylib/core/structs/color.rb +60 -0
- data/lib/raylib/core/structs/file_path_list.rb +51 -0
- data/lib/raylib/core/structs/font.rb +82 -0
- data/lib/raylib/core/structs/glyph_info.rb +71 -0
- data/lib/raylib/core/structs/image.rb +71 -0
- data/lib/raylib/core/structs/material.rb +49 -0
- data/lib/raylib/core/structs/material_map.rb +49 -0
- data/lib/raylib/core/structs/matrix.rb +192 -0
- data/lib/raylib/core/structs/mesh.rb +181 -0
- data/lib/raylib/core/structs/model.rb +115 -0
- data/lib/raylib/core/structs/model_animation.rb +60 -0
- data/lib/raylib/core/structs/music.rb +71 -0
- data/lib/raylib/core/structs/n_patch_info.rb +82 -0
- data/lib/raylib/core/structs/ray.rb +38 -0
- data/lib/raylib/core/structs/ray_collision.rb +60 -0
- data/lib/raylib/core/structs/rectangle.rb +60 -0
- data/lib/raylib/core/structs/render_texture.rb +52 -0
- data/lib/raylib/core/structs/shader.rb +38 -0
- data/lib/raylib/core/structs/sound.rb +38 -0
- data/lib/raylib/core/structs/texture.rb +77 -0
- data/lib/raylib/core/structs/transform.rb +49 -0
- data/lib/raylib/core/structs/vector2.rb +38 -0
- data/lib/raylib/core/structs/vector3.rb +49 -0
- data/lib/raylib/core/structs/vector4.rb +63 -0
- data/lib/raylib/core/structs/vr_device_info.rb +126 -0
- data/lib/raylib/core/structs/vr_stereo_config.rb +104 -0
- data/lib/raylib/core/structs/wave.rb +71 -0
- data/lib/raylib/core/structs.rb +32 -0
- data/lib/raylib/core.rb +5 -0
- data/lib/raylib/dsl.rb +2 -0
- data/lib/raylib/raymath/functions.rb +337 -0
- data/lib/raylib/raymath/structs/float16.rb +27 -0
- data/lib/raylib/raymath/structs/float3.rb +27 -0
- data/lib/raylib/raymath/structs.rb +2 -0
- data/lib/raylib/raymath.rb +2 -0
- data/lib/raylib/rlgl/callbacks.rb +4 -0
- data/lib/raylib/rlgl/enums.rb +270 -0
- data/lib/raylib/rlgl/functions.rb +448 -0
- data/lib/raylib/rlgl/structs/rl_draw_call.rb +60 -0
- data/lib/raylib/rlgl/structs/rl_render_batch.rb +82 -0
- data/lib/raylib/rlgl/structs/rl_vertex_buffer.rb +93 -0
- data/lib/raylib/rlgl/structs.rb +3 -0
- data/lib/raylib/rlgl.rb +4 -0
- data/lib/raylib/version.rb +5 -0
- data/lib/raylib.rb +12 -0
- metadata +162 -0
@@ -0,0 +1,82 @@
|
|
1
|
+
module Raylib
|
2
|
+
# NPatchInfo, n-patch layout info
|
3
|
+
class NPatchInfo < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:source, Rectangle, # Texture source rectangle,
|
6
|
+
:left, :int, # Left border offset,
|
7
|
+
:top, :int, # Top border offset,
|
8
|
+
:right, :int, # Right border offset,
|
9
|
+
:bottom, :int, # Bottom border offset,
|
10
|
+
:layout, :int, # Layout of the n-patch: 3x3, 1x3 or 3x1
|
11
|
+
)
|
12
|
+
|
13
|
+
def self.create(source, left, top, right, bottom, layout)
|
14
|
+
new.tap do |instance|
|
15
|
+
instance[:source] = source
|
16
|
+
instance[:left] = left
|
17
|
+
instance[:top] = top
|
18
|
+
instance[:right] = right
|
19
|
+
instance[:bottom] = bottom
|
20
|
+
instance[:layout] = layout
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
"Raylib::NPatchInfo##{object_id} source=#{source} left=#{left} top=#{top} right=#{right} bottom=#{bottom} layout=#{layout}"
|
26
|
+
end
|
27
|
+
|
28
|
+
# Texture source rectangle
|
29
|
+
# @return [Rectangle] source
|
30
|
+
def source = self[:source]
|
31
|
+
|
32
|
+
# Sets Texture source rectangle
|
33
|
+
def source=(new_source)
|
34
|
+
self[:source] = new_source
|
35
|
+
end
|
36
|
+
|
37
|
+
# Left border offset
|
38
|
+
# @return [Integer] left
|
39
|
+
def left = self[:left]
|
40
|
+
|
41
|
+
# Sets Left border offset
|
42
|
+
def left=(new_left)
|
43
|
+
self[:left] = new_left
|
44
|
+
end
|
45
|
+
|
46
|
+
# Top border offset
|
47
|
+
# @return [Integer] top
|
48
|
+
def top = self[:top]
|
49
|
+
|
50
|
+
# Sets Top border offset
|
51
|
+
def top=(new_top)
|
52
|
+
self[:top] = new_top
|
53
|
+
end
|
54
|
+
|
55
|
+
# Right border offset
|
56
|
+
# @return [Integer] right
|
57
|
+
def right = self[:right]
|
58
|
+
|
59
|
+
# Sets Right border offset
|
60
|
+
def right=(new_right)
|
61
|
+
self[:right] = new_right
|
62
|
+
end
|
63
|
+
|
64
|
+
# Bottom border offset
|
65
|
+
# @return [Integer] bottom
|
66
|
+
def bottom = self[:bottom]
|
67
|
+
|
68
|
+
# Sets Bottom border offset
|
69
|
+
def bottom=(new_bottom)
|
70
|
+
self[:bottom] = new_bottom
|
71
|
+
end
|
72
|
+
|
73
|
+
# Layout of the n-patch: 3x3, 1x3 or 3x1
|
74
|
+
# @return [Integer] layout
|
75
|
+
def layout = self[:layout]
|
76
|
+
|
77
|
+
# Sets Layout of the n-patch: 3x3, 1x3 or 3x1
|
78
|
+
def layout=(new_layout)
|
79
|
+
self[:layout] = new_layout
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Ray, ray for raycasting
|
3
|
+
class Ray < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:position, Vector3, # Ray position (origin),
|
6
|
+
:direction, Vector3, # Ray direction
|
7
|
+
)
|
8
|
+
|
9
|
+
def self.create(position, direction)
|
10
|
+
new.tap do |instance|
|
11
|
+
instance[:position] = position
|
12
|
+
instance[:direction] = direction
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
"Raylib::Ray##{object_id} position=#{position} direction=#{direction}"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Ray position (origin)
|
21
|
+
# @return [Vector3] position
|
22
|
+
def position = self[:position]
|
23
|
+
|
24
|
+
# Sets Ray position (origin)
|
25
|
+
def position=(new_position)
|
26
|
+
self[:position] = new_position
|
27
|
+
end
|
28
|
+
|
29
|
+
# Ray direction
|
30
|
+
# @return [Vector3] direction
|
31
|
+
def direction = self[:direction]
|
32
|
+
|
33
|
+
# Sets Ray direction
|
34
|
+
def direction=(new_direction)
|
35
|
+
self[:direction] = new_direction
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Raylib
|
2
|
+
# RayCollision, ray hit information
|
3
|
+
class RayCollision < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:hit, :bool, # Did the ray hit something?,
|
6
|
+
:distance, :float, # Distance to the nearest hit,
|
7
|
+
:point, Vector3, # Point of the nearest hit,
|
8
|
+
:normal, Vector3, # Surface normal of hit
|
9
|
+
)
|
10
|
+
|
11
|
+
def self.create(hit, distance, point, normal)
|
12
|
+
new.tap do |instance|
|
13
|
+
instance[:hit] = hit
|
14
|
+
instance[:distance] = distance
|
15
|
+
instance[:point] = point
|
16
|
+
instance[:normal] = normal
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
"Raylib::RayCollision##{object_id} hit=#{hit} distance=#{distance} point=#{point} normal=#{normal}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Did the ray hit something?
|
25
|
+
# @return [bool] hit
|
26
|
+
def hit = self[:hit]
|
27
|
+
|
28
|
+
# Sets Did the ray hit something?
|
29
|
+
def hit=(new_hit)
|
30
|
+
self[:hit] = new_hit
|
31
|
+
end
|
32
|
+
|
33
|
+
# Distance to the nearest hit
|
34
|
+
# @return [Float] distance
|
35
|
+
def distance = self[:distance]
|
36
|
+
|
37
|
+
# Sets Distance to the nearest hit
|
38
|
+
def distance=(new_distance)
|
39
|
+
self[:distance] = new_distance
|
40
|
+
end
|
41
|
+
|
42
|
+
# Point of the nearest hit
|
43
|
+
# @return [Vector3] point
|
44
|
+
def point = self[:point]
|
45
|
+
|
46
|
+
# Sets Point of the nearest hit
|
47
|
+
def point=(new_point)
|
48
|
+
self[:point] = new_point
|
49
|
+
end
|
50
|
+
|
51
|
+
# Surface normal of hit
|
52
|
+
# @return [Vector3] normal
|
53
|
+
def normal = self[:normal]
|
54
|
+
|
55
|
+
# Sets Surface normal of hit
|
56
|
+
def normal=(new_normal)
|
57
|
+
self[:normal] = new_normal
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Rectangle, 4 components
|
3
|
+
class Rectangle < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:x, :float, # Rectangle top-left corner position x,
|
6
|
+
:y, :float, # Rectangle top-left corner position y,
|
7
|
+
:width, :float, # Rectangle width,
|
8
|
+
:height, :float, # Rectangle height
|
9
|
+
)
|
10
|
+
|
11
|
+
def self.create(x, y, width, height)
|
12
|
+
new.tap do |instance|
|
13
|
+
instance[:x] = x
|
14
|
+
instance[:y] = y
|
15
|
+
instance[:width] = width
|
16
|
+
instance[:height] = height
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
"Raylib::Rectangle##{object_id} x=#{x} y=#{y} width=#{width} height=#{height}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Rectangle top-left corner position x
|
25
|
+
# @return [Float] x
|
26
|
+
def x = self[:x]
|
27
|
+
|
28
|
+
# Sets Rectangle top-left corner position x
|
29
|
+
def x=(new_x)
|
30
|
+
self[:x] = new_x
|
31
|
+
end
|
32
|
+
|
33
|
+
# Rectangle top-left corner position y
|
34
|
+
# @return [Float] y
|
35
|
+
def y = self[:y]
|
36
|
+
|
37
|
+
# Sets Rectangle top-left corner position y
|
38
|
+
def y=(new_y)
|
39
|
+
self[:y] = new_y
|
40
|
+
end
|
41
|
+
|
42
|
+
# Rectangle width
|
43
|
+
# @return [Float] width
|
44
|
+
def width = self[:width]
|
45
|
+
|
46
|
+
# Sets Rectangle width
|
47
|
+
def width=(new_width)
|
48
|
+
self[:width] = new_width
|
49
|
+
end
|
50
|
+
|
51
|
+
# Rectangle height
|
52
|
+
# @return [Float] height
|
53
|
+
def height = self[:height]
|
54
|
+
|
55
|
+
# Sets Rectangle height
|
56
|
+
def height=(new_height)
|
57
|
+
self[:height] = new_height
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Raylib
|
2
|
+
# RenderTexture, fbo for texture rendering
|
3
|
+
class RenderTexture < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:id, :uint, # OpenGL framebuffer object id,
|
6
|
+
:texture, Texture, # Color buffer attachment texture,
|
7
|
+
:depth, Texture, # Depth buffer attachment texture
|
8
|
+
)
|
9
|
+
|
10
|
+
def self.create(id, texture, depth)
|
11
|
+
new.tap do |instance|
|
12
|
+
instance[:id] = id
|
13
|
+
instance[:texture] = texture
|
14
|
+
instance[:depth] = depth
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
"Raylib::RenderTexture##{object_id} id=#{id} texture=#{texture} depth=#{depth}"
|
20
|
+
end
|
21
|
+
|
22
|
+
# OpenGL framebuffer object id
|
23
|
+
# @return [Integer] id
|
24
|
+
def id = self[:id]
|
25
|
+
|
26
|
+
# Sets OpenGL framebuffer object id
|
27
|
+
def id=(new_id)
|
28
|
+
self[:id] = new_id
|
29
|
+
end
|
30
|
+
|
31
|
+
# Color buffer attachment texture
|
32
|
+
# @return [Texture] texture
|
33
|
+
def texture = self[:texture]
|
34
|
+
|
35
|
+
# Sets Color buffer attachment texture
|
36
|
+
def texture=(new_texture)
|
37
|
+
self[:texture] = new_texture
|
38
|
+
end
|
39
|
+
|
40
|
+
# Depth buffer attachment texture
|
41
|
+
# @return [Texture] depth
|
42
|
+
def depth = self[:depth]
|
43
|
+
|
44
|
+
# Sets Depth buffer attachment texture
|
45
|
+
def depth=(new_depth)
|
46
|
+
self[:depth] = new_depth
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# RenderTexture2D, same as RenderTexture
|
51
|
+
RenderTexture2D = RenderTexture
|
52
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Shader
|
3
|
+
class Shader < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:id, :uint, # Shader program id,
|
6
|
+
:locs, :pointer, # Shader locations array (RL_MAX_SHADER_LOCATIONS)
|
7
|
+
)
|
8
|
+
|
9
|
+
def self.create(id, locs)
|
10
|
+
new.tap do |instance|
|
11
|
+
instance[:id] = id
|
12
|
+
instance[:locs] = locs
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
"Raylib::Shader##{object_id} id=#{id} locs=#{locs}"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Shader program id
|
21
|
+
# @return [Integer] id
|
22
|
+
def id = self[:id]
|
23
|
+
|
24
|
+
# Sets Shader program id
|
25
|
+
def id=(new_id)
|
26
|
+
self[:id] = new_id
|
27
|
+
end
|
28
|
+
|
29
|
+
# Shader locations array (RL_MAX_SHADER_LOCATIONS)
|
30
|
+
# @return [int *] locs
|
31
|
+
def locs = self[:locs]
|
32
|
+
|
33
|
+
# Sets Shader locations array (RL_MAX_SHADER_LOCATIONS)
|
34
|
+
def locs=(new_locs)
|
35
|
+
self[:locs] = new_locs
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Sound
|
3
|
+
class Sound < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:stream, AudioStream, # Audio stream,
|
6
|
+
:frameCount, :uint, # Total number of frames (considering channels)
|
7
|
+
)
|
8
|
+
|
9
|
+
def self.create(stream, frame_count)
|
10
|
+
new.tap do |instance|
|
11
|
+
instance[:stream] = stream
|
12
|
+
instance[:frameCount] = frame_count
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
"Raylib::Sound##{object_id} stream=#{stream} frame_count=#{frame_count}"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Audio stream
|
21
|
+
# @return [AudioStream] stream
|
22
|
+
def stream = self[:stream]
|
23
|
+
|
24
|
+
# Sets Audio stream
|
25
|
+
def stream=(new_stream)
|
26
|
+
self[:stream] = new_stream
|
27
|
+
end
|
28
|
+
|
29
|
+
# Total number of frames (considering channels)
|
30
|
+
# @return [Integer] frameCount
|
31
|
+
def frame_count = self[:frameCount]
|
32
|
+
|
33
|
+
# Sets Total number of frames (considering channels)
|
34
|
+
def frame_count=(new_frame_count)
|
35
|
+
self[:frameCount] = new_frame_count
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Texture, tex data stored in GPU memory (VRAM)
|
3
|
+
class Texture < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:id, :uint, # OpenGL texture id,
|
6
|
+
:width, :int, # Texture base width,
|
7
|
+
:height, :int, # Texture base height,
|
8
|
+
:mipmaps, :int, # Mipmap levels, 1 by default,
|
9
|
+
:format, :int, # Data format (PixelFormat type)
|
10
|
+
)
|
11
|
+
|
12
|
+
def self.create(id, width, height, mipmaps, format)
|
13
|
+
new.tap do |instance|
|
14
|
+
instance[:id] = id
|
15
|
+
instance[:width] = width
|
16
|
+
instance[:height] = height
|
17
|
+
instance[:mipmaps] = mipmaps
|
18
|
+
instance[:format] = format
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
"Raylib::Texture##{object_id} id=#{id} width=#{width} height=#{height} mipmaps=#{mipmaps} format=#{format}"
|
24
|
+
end
|
25
|
+
|
26
|
+
# OpenGL texture id
|
27
|
+
# @return [Integer] id
|
28
|
+
def id = self[:id]
|
29
|
+
|
30
|
+
# Sets OpenGL texture id
|
31
|
+
def id=(new_id)
|
32
|
+
self[:id] = new_id
|
33
|
+
end
|
34
|
+
|
35
|
+
# Texture base width
|
36
|
+
# @return [Integer] width
|
37
|
+
def width = self[:width]
|
38
|
+
|
39
|
+
# Sets Texture base width
|
40
|
+
def width=(new_width)
|
41
|
+
self[:width] = new_width
|
42
|
+
end
|
43
|
+
|
44
|
+
# Texture base height
|
45
|
+
# @return [Integer] height
|
46
|
+
def height = self[:height]
|
47
|
+
|
48
|
+
# Sets Texture base height
|
49
|
+
def height=(new_height)
|
50
|
+
self[:height] = new_height
|
51
|
+
end
|
52
|
+
|
53
|
+
# Mipmap levels, 1 by default
|
54
|
+
# @return [Integer] mipmaps
|
55
|
+
def mipmaps = self[:mipmaps]
|
56
|
+
|
57
|
+
# Sets Mipmap levels, 1 by default
|
58
|
+
def mipmaps=(new_mipmaps)
|
59
|
+
self[:mipmaps] = new_mipmaps
|
60
|
+
end
|
61
|
+
|
62
|
+
# Data format (PixelFormat type)
|
63
|
+
# @return [Integer] format
|
64
|
+
def format = self[:format]
|
65
|
+
|
66
|
+
# Sets Data format (PixelFormat type)
|
67
|
+
def format=(new_format)
|
68
|
+
self[:format] = new_format
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Texture2D, same as Texture
|
73
|
+
Texture2D = Texture
|
74
|
+
|
75
|
+
# TextureCubemap, same as Texture
|
76
|
+
TextureCubemap = Texture
|
77
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Transform, vertex transformation data
|
3
|
+
class Transform < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:translation, Vector3, # Translation,
|
6
|
+
:rotation, Quaternion, # Rotation,
|
7
|
+
:scale, Vector3, # Scale
|
8
|
+
)
|
9
|
+
|
10
|
+
def self.create(translation, rotation, scale)
|
11
|
+
new.tap do |instance|
|
12
|
+
instance[:translation] = translation
|
13
|
+
instance[:rotation] = rotation
|
14
|
+
instance[:scale] = scale
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
"Raylib::Transform##{object_id} translation=#{translation} rotation=#{rotation} scale=#{scale}"
|
20
|
+
end
|
21
|
+
|
22
|
+
# Translation
|
23
|
+
# @return [Vector3] translation
|
24
|
+
def translation = self[:translation]
|
25
|
+
|
26
|
+
# Sets Translation
|
27
|
+
def translation=(new_translation)
|
28
|
+
self[:translation] = new_translation
|
29
|
+
end
|
30
|
+
|
31
|
+
# Rotation
|
32
|
+
# @return [Quaternion] rotation
|
33
|
+
def rotation = self[:rotation]
|
34
|
+
|
35
|
+
# Sets Rotation
|
36
|
+
def rotation=(new_rotation)
|
37
|
+
self[:rotation] = new_rotation
|
38
|
+
end
|
39
|
+
|
40
|
+
# Scale
|
41
|
+
# @return [Vector3] scale
|
42
|
+
def scale = self[:scale]
|
43
|
+
|
44
|
+
# Sets Scale
|
45
|
+
def scale=(new_scale)
|
46
|
+
self[:scale] = new_scale
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Vector2, 2 components
|
3
|
+
class Vector2 < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:x, :float, # Vector x component,
|
6
|
+
:y, :float, # Vector y component
|
7
|
+
)
|
8
|
+
|
9
|
+
def self.create(x, y)
|
10
|
+
new.tap do |instance|
|
11
|
+
instance[:x] = x
|
12
|
+
instance[:y] = y
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
"Raylib::Vector2##{object_id} x=#{x} y=#{y}"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Vector x component
|
21
|
+
# @return [Float] x
|
22
|
+
def x = self[:x]
|
23
|
+
|
24
|
+
# Sets Vector x component
|
25
|
+
def x=(new_x)
|
26
|
+
self[:x] = new_x
|
27
|
+
end
|
28
|
+
|
29
|
+
# Vector y component
|
30
|
+
# @return [Float] y
|
31
|
+
def y = self[:y]
|
32
|
+
|
33
|
+
# Sets Vector y component
|
34
|
+
def y=(new_y)
|
35
|
+
self[:y] = new_y
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Vector3, 3 components
|
3
|
+
class Vector3 < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:x, :float, # Vector x component,
|
6
|
+
:y, :float, # Vector y component,
|
7
|
+
:z, :float, # Vector z component
|
8
|
+
)
|
9
|
+
|
10
|
+
def self.create(x, y, z)
|
11
|
+
new.tap do |instance|
|
12
|
+
instance[:x] = x
|
13
|
+
instance[:y] = y
|
14
|
+
instance[:z] = z
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
"Raylib::Vector3##{object_id} x=#{x} y=#{y} z=#{z}"
|
20
|
+
end
|
21
|
+
|
22
|
+
# Vector x component
|
23
|
+
# @return [Float] x
|
24
|
+
def x = self[:x]
|
25
|
+
|
26
|
+
# Sets Vector x component
|
27
|
+
def x=(new_x)
|
28
|
+
self[:x] = new_x
|
29
|
+
end
|
30
|
+
|
31
|
+
# Vector y component
|
32
|
+
# @return [Float] y
|
33
|
+
def y = self[:y]
|
34
|
+
|
35
|
+
# Sets Vector y component
|
36
|
+
def y=(new_y)
|
37
|
+
self[:y] = new_y
|
38
|
+
end
|
39
|
+
|
40
|
+
# Vector z component
|
41
|
+
# @return [Float] z
|
42
|
+
def z = self[:z]
|
43
|
+
|
44
|
+
# Sets Vector z component
|
45
|
+
def z=(new_z)
|
46
|
+
self[:z] = new_z
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Vector4, 4 components
|
3
|
+
class Vector4 < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:x, :float, # Vector x component,
|
6
|
+
:y, :float, # Vector y component,
|
7
|
+
:z, :float, # Vector z component,
|
8
|
+
:w, :float, # Vector w component
|
9
|
+
)
|
10
|
+
|
11
|
+
def self.create(x, y, z, w)
|
12
|
+
new.tap do |instance|
|
13
|
+
instance[:x] = x
|
14
|
+
instance[:y] = y
|
15
|
+
instance[:z] = z
|
16
|
+
instance[:w] = w
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
"Raylib::Vector4##{object_id} x=#{x} y=#{y} z=#{z} w=#{w}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Vector x component
|
25
|
+
# @return [Float] x
|
26
|
+
def x = self[:x]
|
27
|
+
|
28
|
+
# Sets Vector x component
|
29
|
+
def x=(new_x)
|
30
|
+
self[:x] = new_x
|
31
|
+
end
|
32
|
+
|
33
|
+
# Vector y component
|
34
|
+
# @return [Float] y
|
35
|
+
def y = self[:y]
|
36
|
+
|
37
|
+
# Sets Vector y component
|
38
|
+
def y=(new_y)
|
39
|
+
self[:y] = new_y
|
40
|
+
end
|
41
|
+
|
42
|
+
# Vector z component
|
43
|
+
# @return [Float] z
|
44
|
+
def z = self[:z]
|
45
|
+
|
46
|
+
# Sets Vector z component
|
47
|
+
def z=(new_z)
|
48
|
+
self[:z] = new_z
|
49
|
+
end
|
50
|
+
|
51
|
+
# Vector w component
|
52
|
+
# @return [Float] w
|
53
|
+
def w = self[:w]
|
54
|
+
|
55
|
+
# Sets Vector w component
|
56
|
+
def w=(new_w)
|
57
|
+
self[:w] = new_w
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Quaternion, 4 components (Vector4 alias)
|
62
|
+
Quaternion = Vector4
|
63
|
+
end
|