raylib 4.5.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- 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,71 @@
|
|
1
|
+
module Raylib
|
2
|
+
# AudioStream, custom audio stream
|
3
|
+
class AudioStream < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:buffer, :pointer, # Pointer to internal data used by the audio system,
|
6
|
+
:processor, :pointer, # Pointer to internal data processor, useful for audio effects,
|
7
|
+
:sampleRate, :uint, # Frequency (samples per second),
|
8
|
+
:sampleSize, :uint, # Bit depth (bits per sample): 8, 16, 32 (24 not supported),
|
9
|
+
:channels, :uint, # Number of channels (1-mono, 2-stereo, ...)
|
10
|
+
)
|
11
|
+
|
12
|
+
def self.create(buffer, processor, sample_rate, sample_size, channels)
|
13
|
+
new.tap do |instance|
|
14
|
+
instance[:buffer] = buffer
|
15
|
+
instance[:processor] = processor
|
16
|
+
instance[:sampleRate] = sample_rate
|
17
|
+
instance[:sampleSize] = sample_size
|
18
|
+
instance[:channels] = channels
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
"Raylib::AudioStream##{object_id} buffer=#{buffer} processor=#{processor} sample_rate=#{sample_rate} sample_size=#{sample_size} channels=#{channels}"
|
24
|
+
end
|
25
|
+
|
26
|
+
# Pointer to internal data used by the audio system
|
27
|
+
# @return [rAudioBuffer *] buffer
|
28
|
+
def buffer = self[:buffer]
|
29
|
+
|
30
|
+
# Sets Pointer to internal data used by the audio system
|
31
|
+
def buffer=(new_buffer)
|
32
|
+
self[:buffer] = new_buffer
|
33
|
+
end
|
34
|
+
|
35
|
+
# Pointer to internal data processor, useful for audio effects
|
36
|
+
# @return [rAudioProcessor *] processor
|
37
|
+
def processor = self[:processor]
|
38
|
+
|
39
|
+
# Sets Pointer to internal data processor, useful for audio effects
|
40
|
+
def processor=(new_processor)
|
41
|
+
self[:processor] = new_processor
|
42
|
+
end
|
43
|
+
|
44
|
+
# Frequency (samples per second)
|
45
|
+
# @return [Integer] sampleRate
|
46
|
+
def sample_rate = self[:sampleRate]
|
47
|
+
|
48
|
+
# Sets Frequency (samples per second)
|
49
|
+
def sample_rate=(new_sample_rate)
|
50
|
+
self[:sampleRate] = new_sample_rate
|
51
|
+
end
|
52
|
+
|
53
|
+
# Bit depth (bits per sample): 8, 16, 32 (24 not supported)
|
54
|
+
# @return [Integer] sampleSize
|
55
|
+
def sample_size = self[:sampleSize]
|
56
|
+
|
57
|
+
# Sets Bit depth (bits per sample): 8, 16, 32 (24 not supported)
|
58
|
+
def sample_size=(new_sample_size)
|
59
|
+
self[:sampleSize] = new_sample_size
|
60
|
+
end
|
61
|
+
|
62
|
+
# Number of channels (1-mono, 2-stereo, ...)
|
63
|
+
# @return [Integer] channels
|
64
|
+
def channels = self[:channels]
|
65
|
+
|
66
|
+
# Sets Number of channels (1-mono, 2-stereo, ...)
|
67
|
+
def channels=(new_channels)
|
68
|
+
self[:channels] = new_channels
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Bone, skeletal animation bone
|
3
|
+
class BoneInfo < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:name, [:char, 32], # Bone name,
|
6
|
+
:parent, :int, # Bone parent
|
7
|
+
)
|
8
|
+
|
9
|
+
def self.create(name, parent)
|
10
|
+
new.tap do |instance|
|
11
|
+
instance[:name] = name
|
12
|
+
instance[:parent] = parent
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
"Raylib::BoneInfo##{object_id} name=#{name} parent=#{parent}"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Bone name
|
21
|
+
# @return [char[32]] name
|
22
|
+
def name = self[:name]
|
23
|
+
|
24
|
+
# Sets Bone name
|
25
|
+
def name=(new_name)
|
26
|
+
self[:name] = new_name
|
27
|
+
end
|
28
|
+
|
29
|
+
# Bone parent
|
30
|
+
# @return [Integer] parent
|
31
|
+
def parent = self[:parent]
|
32
|
+
|
33
|
+
# Sets Bone parent
|
34
|
+
def parent=(new_parent)
|
35
|
+
self[:parent] = new_parent
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Raylib
|
2
|
+
# BoundingBox
|
3
|
+
class BoundingBox < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:min, Vector3, # Minimum vertex box-corner,
|
6
|
+
:max, Vector3, # Maximum vertex box-corner
|
7
|
+
)
|
8
|
+
|
9
|
+
def self.create(min, max)
|
10
|
+
new.tap do |instance|
|
11
|
+
instance[:min] = min
|
12
|
+
instance[:max] = max
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
"Raylib::BoundingBox##{object_id} min=#{min} max=#{max}"
|
18
|
+
end
|
19
|
+
|
20
|
+
# Minimum vertex box-corner
|
21
|
+
# @return [Vector3] min
|
22
|
+
def min = self[:min]
|
23
|
+
|
24
|
+
# Sets Minimum vertex box-corner
|
25
|
+
def min=(new_min)
|
26
|
+
self[:min] = new_min
|
27
|
+
end
|
28
|
+
|
29
|
+
# Maximum vertex box-corner
|
30
|
+
# @return [Vector3] max
|
31
|
+
def max = self[:max]
|
32
|
+
|
33
|
+
# Sets Maximum vertex box-corner
|
34
|
+
def max=(new_max)
|
35
|
+
self[:max] = new_max
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Camera2D, defines position/orientation in 2d space
|
3
|
+
class Camera2D < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:offset, Vector2, # Camera offset (displacement from target),
|
6
|
+
:target, Vector2, # Camera target (rotation and zoom origin),
|
7
|
+
:rotation, :float, # Camera rotation in degrees,
|
8
|
+
:zoom, :float, # Camera zoom (scaling), should be 1.0f by default
|
9
|
+
)
|
10
|
+
|
11
|
+
def self.create(offset, target, rotation, zoom)
|
12
|
+
new.tap do |instance|
|
13
|
+
instance[:offset] = offset
|
14
|
+
instance[:target] = target
|
15
|
+
instance[:rotation] = rotation
|
16
|
+
instance[:zoom] = zoom
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
"Raylib::Camera2D##{object_id} offset=#{offset} target=#{target} rotation=#{rotation} zoom=#{zoom}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Camera offset (displacement from target)
|
25
|
+
# @return [Vector2] offset
|
26
|
+
def offset = self[:offset]
|
27
|
+
|
28
|
+
# Sets Camera offset (displacement from target)
|
29
|
+
def offset=(new_offset)
|
30
|
+
self[:offset] = new_offset
|
31
|
+
end
|
32
|
+
|
33
|
+
# Camera target (rotation and zoom origin)
|
34
|
+
# @return [Vector2] target
|
35
|
+
def target = self[:target]
|
36
|
+
|
37
|
+
# Sets Camera target (rotation and zoom origin)
|
38
|
+
def target=(new_target)
|
39
|
+
self[:target] = new_target
|
40
|
+
end
|
41
|
+
|
42
|
+
# Camera rotation in degrees
|
43
|
+
# @return [Float] rotation
|
44
|
+
def rotation = self[:rotation]
|
45
|
+
|
46
|
+
# Sets Camera rotation in degrees
|
47
|
+
def rotation=(new_rotation)
|
48
|
+
self[:rotation] = new_rotation
|
49
|
+
end
|
50
|
+
|
51
|
+
# Camera zoom (scaling), should be 1.0f by default
|
52
|
+
# @return [Float] zoom
|
53
|
+
def zoom = self[:zoom]
|
54
|
+
|
55
|
+
# Sets Camera zoom (scaling), should be 1.0f by default
|
56
|
+
def zoom=(new_zoom)
|
57
|
+
self[:zoom] = new_zoom
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Camera, defines position/orientation in 3d space
|
3
|
+
class Camera3D < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:position, Vector3, # Camera position,
|
6
|
+
:target, Vector3, # Camera target it looks-at,
|
7
|
+
:up, Vector3, # Camera up vector (rotation over its axis),
|
8
|
+
:fovy, :float, # Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic,
|
9
|
+
:projection, :int, # Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
|
10
|
+
)
|
11
|
+
|
12
|
+
def self.create(position, target, up, fovy, projection)
|
13
|
+
new.tap do |instance|
|
14
|
+
instance[:position] = position
|
15
|
+
instance[:target] = target
|
16
|
+
instance[:up] = up
|
17
|
+
instance[:fovy] = fovy
|
18
|
+
instance[:projection] = projection
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
"Raylib::Camera3D##{object_id} position=#{position} target=#{target} up=#{up} fovy=#{fovy} projection=#{projection}"
|
24
|
+
end
|
25
|
+
|
26
|
+
# Camera position
|
27
|
+
# @return [Vector3] position
|
28
|
+
def position = self[:position]
|
29
|
+
|
30
|
+
# Sets Camera position
|
31
|
+
def position=(new_position)
|
32
|
+
self[:position] = new_position
|
33
|
+
end
|
34
|
+
|
35
|
+
# Camera target it looks-at
|
36
|
+
# @return [Vector3] target
|
37
|
+
def target = self[:target]
|
38
|
+
|
39
|
+
# Sets Camera target it looks-at
|
40
|
+
def target=(new_target)
|
41
|
+
self[:target] = new_target
|
42
|
+
end
|
43
|
+
|
44
|
+
# Camera up vector (rotation over its axis)
|
45
|
+
# @return [Vector3] up
|
46
|
+
def up = self[:up]
|
47
|
+
|
48
|
+
# Sets Camera up vector (rotation over its axis)
|
49
|
+
def up=(new_up)
|
50
|
+
self[:up] = new_up
|
51
|
+
end
|
52
|
+
|
53
|
+
# Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic
|
54
|
+
# @return [Float] fovy
|
55
|
+
def fovy = self[:fovy]
|
56
|
+
|
57
|
+
# Sets Camera field-of-view aperture in Y (degrees) in perspective, used as near plane width in orthographic
|
58
|
+
def fovy=(new_fovy)
|
59
|
+
self[:fovy] = new_fovy
|
60
|
+
end
|
61
|
+
|
62
|
+
# Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
|
63
|
+
# @return [Integer] projection
|
64
|
+
def projection = self[:projection]
|
65
|
+
|
66
|
+
# Sets Camera projection: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
|
67
|
+
def projection=(new_projection)
|
68
|
+
self[:projection] = new_projection
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# Camera type fallback, defaults to Camera3D
|
73
|
+
Camera = Camera3D
|
74
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Color, 4 components, R8G8B8A8 (32bit)
|
3
|
+
class Color < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:r, :uchar, # Color red value,
|
6
|
+
:g, :uchar, # Color green value,
|
7
|
+
:b, :uchar, # Color blue value,
|
8
|
+
:a, :uchar, # Color alpha value
|
9
|
+
)
|
10
|
+
|
11
|
+
def self.create(r, g, b, a)
|
12
|
+
new.tap do |instance|
|
13
|
+
instance[:r] = r
|
14
|
+
instance[:g] = g
|
15
|
+
instance[:b] = b
|
16
|
+
instance[:a] = a
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
"Raylib::Color##{object_id} r=#{r} g=#{g} b=#{b} a=#{a}"
|
22
|
+
end
|
23
|
+
|
24
|
+
# Color red value
|
25
|
+
# @return [unsigned char] r
|
26
|
+
def r = self[:r]
|
27
|
+
|
28
|
+
# Sets Color red value
|
29
|
+
def r=(new_r)
|
30
|
+
self[:r] = new_r
|
31
|
+
end
|
32
|
+
|
33
|
+
# Color green value
|
34
|
+
# @return [unsigned char] g
|
35
|
+
def g = self[:g]
|
36
|
+
|
37
|
+
# Sets Color green value
|
38
|
+
def g=(new_g)
|
39
|
+
self[:g] = new_g
|
40
|
+
end
|
41
|
+
|
42
|
+
# Color blue value
|
43
|
+
# @return [unsigned char] b
|
44
|
+
def b = self[:b]
|
45
|
+
|
46
|
+
# Sets Color blue value
|
47
|
+
def b=(new_b)
|
48
|
+
self[:b] = new_b
|
49
|
+
end
|
50
|
+
|
51
|
+
# Color alpha value
|
52
|
+
# @return [unsigned char] a
|
53
|
+
def a = self[:a]
|
54
|
+
|
55
|
+
# Sets Color alpha value
|
56
|
+
def a=(new_a)
|
57
|
+
self[:a] = new_a
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Raylib
|
2
|
+
# File path list
|
3
|
+
class FilePathList < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:capacity, :uint, # Filepaths max entries,
|
6
|
+
:count, :uint, # Filepaths entries count,
|
7
|
+
:paths, :pointer, # Filepaths entries
|
8
|
+
)
|
9
|
+
|
10
|
+
def self.create(capacity, count, paths)
|
11
|
+
new.tap do |instance|
|
12
|
+
instance[:capacity] = capacity
|
13
|
+
instance[:count] = count
|
14
|
+
instance[:paths] = paths
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
"Raylib::FilePathList##{object_id} capacity=#{capacity} count=#{count} paths=#{paths}"
|
20
|
+
end
|
21
|
+
|
22
|
+
# Filepaths max entries
|
23
|
+
# @return [Integer] capacity
|
24
|
+
def capacity = self[:capacity]
|
25
|
+
|
26
|
+
# Sets Filepaths max entries
|
27
|
+
def capacity=(new_capacity)
|
28
|
+
self[:capacity] = new_capacity
|
29
|
+
end
|
30
|
+
|
31
|
+
# Filepaths entries count
|
32
|
+
# @return [Integer] count
|
33
|
+
def count = self[:count]
|
34
|
+
|
35
|
+
# Sets Filepaths entries count
|
36
|
+
def count=(new_count)
|
37
|
+
self[:count] = new_count
|
38
|
+
end
|
39
|
+
|
40
|
+
# Filepaths entries
|
41
|
+
# @return [Array<String>] paths
|
42
|
+
def paths
|
43
|
+
self[:paths].get_array_of_string(0, count)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Sets Filepaths entries
|
47
|
+
def paths=(new_paths)
|
48
|
+
self[:paths] = new_paths
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Font, font texture and GlyphInfo array data
|
3
|
+
class Font < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:baseSize, :int, # Base size (default chars height),
|
6
|
+
:glyphCount, :int, # Number of glyph characters,
|
7
|
+
:glyphPadding, :int, # Padding around the glyph characters,
|
8
|
+
:texture, Texture2D, # Texture atlas containing the glyphs,
|
9
|
+
:recs, :pointer, # Rectangles in texture for the glyphs,
|
10
|
+
:glyphs, :pointer, # Glyphs info data
|
11
|
+
)
|
12
|
+
|
13
|
+
def self.create(base_size, glyph_count, glyph_padding, texture, recs, glyphs)
|
14
|
+
new.tap do |instance|
|
15
|
+
instance[:baseSize] = base_size
|
16
|
+
instance[:glyphCount] = glyph_count
|
17
|
+
instance[:glyphPadding] = glyph_padding
|
18
|
+
instance[:texture] = texture
|
19
|
+
instance[:recs] = recs
|
20
|
+
instance[:glyphs] = glyphs
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
"Raylib::Font##{object_id} base_size=#{base_size} glyph_count=#{glyph_count} glyph_padding=#{glyph_padding} texture=#{texture} recs=#{recs} glyphs=#{glyphs}"
|
26
|
+
end
|
27
|
+
|
28
|
+
# Base size (default chars height)
|
29
|
+
# @return [Integer] baseSize
|
30
|
+
def base_size = self[:baseSize]
|
31
|
+
|
32
|
+
# Sets Base size (default chars height)
|
33
|
+
def base_size=(new_base_size)
|
34
|
+
self[:baseSize] = new_base_size
|
35
|
+
end
|
36
|
+
|
37
|
+
# Number of glyph characters
|
38
|
+
# @return [Integer] glyphCount
|
39
|
+
def glyph_count = self[:glyphCount]
|
40
|
+
|
41
|
+
# Sets Number of glyph characters
|
42
|
+
def glyph_count=(new_glyph_count)
|
43
|
+
self[:glyphCount] = new_glyph_count
|
44
|
+
end
|
45
|
+
|
46
|
+
# Padding around the glyph characters
|
47
|
+
# @return [Integer] glyphPadding
|
48
|
+
def glyph_padding = self[:glyphPadding]
|
49
|
+
|
50
|
+
# Sets Padding around the glyph characters
|
51
|
+
def glyph_padding=(new_glyph_padding)
|
52
|
+
self[:glyphPadding] = new_glyph_padding
|
53
|
+
end
|
54
|
+
|
55
|
+
# Texture atlas containing the glyphs
|
56
|
+
# @return [Texture2D] texture
|
57
|
+
def texture = self[:texture]
|
58
|
+
|
59
|
+
# Sets Texture atlas containing the glyphs
|
60
|
+
def texture=(new_texture)
|
61
|
+
self[:texture] = new_texture
|
62
|
+
end
|
63
|
+
|
64
|
+
# Rectangles in texture for the glyphs
|
65
|
+
# @return [Rectangle *] recs
|
66
|
+
def recs = self[:recs]
|
67
|
+
|
68
|
+
# Sets Rectangles in texture for the glyphs
|
69
|
+
def recs=(new_recs)
|
70
|
+
self[:recs] = new_recs
|
71
|
+
end
|
72
|
+
|
73
|
+
# Glyphs info data
|
74
|
+
# @return [GlyphInfo *] glyphs
|
75
|
+
def glyphs = self[:glyphs]
|
76
|
+
|
77
|
+
# Sets Glyphs info data
|
78
|
+
def glyphs=(new_glyphs)
|
79
|
+
self[:glyphs] = new_glyphs
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Raylib
|
2
|
+
# GlyphInfo, font characters glyphs info
|
3
|
+
class GlyphInfo < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:value, :int, # Character value (Unicode),
|
6
|
+
:offsetX, :int, # Character offset X when drawing,
|
7
|
+
:offsetY, :int, # Character offset Y when drawing,
|
8
|
+
:advanceX, :int, # Character advance position X,
|
9
|
+
:image, Image, # Character image data
|
10
|
+
)
|
11
|
+
|
12
|
+
def self.create(value, offset_x, offset_y, advance_x, image)
|
13
|
+
new.tap do |instance|
|
14
|
+
instance[:value] = value
|
15
|
+
instance[:offsetX] = offset_x
|
16
|
+
instance[:offsetY] = offset_y
|
17
|
+
instance[:advanceX] = advance_x
|
18
|
+
instance[:image] = image
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
"Raylib::GlyphInfo##{object_id} value=#{value} offset_x=#{offset_x} offset_y=#{offset_y} advance_x=#{advance_x} image=#{image}"
|
24
|
+
end
|
25
|
+
|
26
|
+
# Character value (Unicode)
|
27
|
+
# @return [Integer] value
|
28
|
+
def value = self[:value]
|
29
|
+
|
30
|
+
# Sets Character value (Unicode)
|
31
|
+
def value=(new_value)
|
32
|
+
self[:value] = new_value
|
33
|
+
end
|
34
|
+
|
35
|
+
# Character offset X when drawing
|
36
|
+
# @return [Integer] offsetX
|
37
|
+
def offset_x = self[:offsetX]
|
38
|
+
|
39
|
+
# Sets Character offset X when drawing
|
40
|
+
def offset_x=(new_offset_x)
|
41
|
+
self[:offsetX] = new_offset_x
|
42
|
+
end
|
43
|
+
|
44
|
+
# Character offset Y when drawing
|
45
|
+
# @return [Integer] offsetY
|
46
|
+
def offset_y = self[:offsetY]
|
47
|
+
|
48
|
+
# Sets Character offset Y when drawing
|
49
|
+
def offset_y=(new_offset_y)
|
50
|
+
self[:offsetY] = new_offset_y
|
51
|
+
end
|
52
|
+
|
53
|
+
# Character advance position X
|
54
|
+
# @return [Integer] advanceX
|
55
|
+
def advance_x = self[:advanceX]
|
56
|
+
|
57
|
+
# Sets Character advance position X
|
58
|
+
def advance_x=(new_advance_x)
|
59
|
+
self[:advanceX] = new_advance_x
|
60
|
+
end
|
61
|
+
|
62
|
+
# Character image data
|
63
|
+
# @return [Image] image
|
64
|
+
def image = self[:image]
|
65
|
+
|
66
|
+
# Sets Character image data
|
67
|
+
def image=(new_image)
|
68
|
+
self[:image] = new_image
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Image, pixel data stored in CPU memory (RAM)
|
3
|
+
class Image < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:data, :pointer, # Image raw data,
|
6
|
+
:width, :int, # Image base width,
|
7
|
+
:height, :int, # Image base height,
|
8
|
+
:mipmaps, :int, # Mipmap levels, 1 by default,
|
9
|
+
:format, :int, # Data format (PixelFormat type)
|
10
|
+
)
|
11
|
+
|
12
|
+
def self.create(data, width, height, mipmaps, format)
|
13
|
+
new.tap do |instance|
|
14
|
+
instance[:data] = data
|
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::Image##{object_id} data=#{data} width=#{width} height=#{height} mipmaps=#{mipmaps} format=#{format}"
|
24
|
+
end
|
25
|
+
|
26
|
+
# Image raw data
|
27
|
+
# @return [void *] data
|
28
|
+
def data = self[:data]
|
29
|
+
|
30
|
+
# Sets Image raw data
|
31
|
+
def data=(new_data)
|
32
|
+
self[:data] = new_data
|
33
|
+
end
|
34
|
+
|
35
|
+
# Image base width
|
36
|
+
# @return [Integer] width
|
37
|
+
def width = self[:width]
|
38
|
+
|
39
|
+
# Sets Image base width
|
40
|
+
def width=(new_width)
|
41
|
+
self[:width] = new_width
|
42
|
+
end
|
43
|
+
|
44
|
+
# Image base height
|
45
|
+
# @return [Integer] height
|
46
|
+
def height = self[:height]
|
47
|
+
|
48
|
+
# Sets Image 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
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Raylib
|
2
|
+
# Material, includes shader and maps
|
3
|
+
class Material < FFI::Struct
|
4
|
+
layout(
|
5
|
+
:shader, Shader, # Material shader,
|
6
|
+
:maps, :pointer, # Material maps array (MAX_MATERIAL_MAPS),
|
7
|
+
:params, [:float, 4], # Material generic parameters (if required)
|
8
|
+
)
|
9
|
+
|
10
|
+
def self.create(shader, maps, params)
|
11
|
+
new.tap do |instance|
|
12
|
+
instance[:shader] = shader
|
13
|
+
instance[:maps] = maps
|
14
|
+
instance[:params] = params
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_s
|
19
|
+
"Raylib::Material##{object_id} shader=#{shader} maps=#{maps} params=#{params}"
|
20
|
+
end
|
21
|
+
|
22
|
+
# Material shader
|
23
|
+
# @return [Shader] shader
|
24
|
+
def shader = self[:shader]
|
25
|
+
|
26
|
+
# Sets Material shader
|
27
|
+
def shader=(new_shader)
|
28
|
+
self[:shader] = new_shader
|
29
|
+
end
|
30
|
+
|
31
|
+
# Material maps array (MAX_MATERIAL_MAPS)
|
32
|
+
# @return [MaterialMap *] maps
|
33
|
+
def maps = self[:maps]
|
34
|
+
|
35
|
+
# Sets Material maps array (MAX_MATERIAL_MAPS)
|
36
|
+
def maps=(new_maps)
|
37
|
+
self[:maps] = new_maps
|
38
|
+
end
|
39
|
+
|
40
|
+
# Material generic parameters (if required)
|
41
|
+
# @return [float[4]] params
|
42
|
+
def params = self[:params]
|
43
|
+
|
44
|
+
# Sets Material generic parameters (if required)
|
45
|
+
def params=(new_params)
|
46
|
+
self[:params] = new_params
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|