Class: Raylib::Color

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/raylib/core/structs/color.rb

Overview

Color, 4 components, R8G8B8A8 (32bit)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(r, g, b, a) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/raylib/core/structs/color.rb', line 11

def self.create(r, g, b, a)
  new.tap do |instance|
    instance[:r] = r
    instance[:g] = g
    instance[:b] = b
    instance[:a] = a
  end
end

Instance Method Details

#aunsigned char

Color alpha value

Returns:

  • (unsigned char)

    a



53
# File 'lib/raylib/core/structs/color.rb', line 53

def a = self[:a]

#a=(new_a) ⇒ Object

Sets Color alpha value



56
57
58
# File 'lib/raylib/core/structs/color.rb', line 56

def a=(new_a)
  self[:a] = new_a
end

#bunsigned char

Color blue value

Returns:

  • (unsigned char)

    b



44
# File 'lib/raylib/core/structs/color.rb', line 44

def b = self[:b]

#b=(new_b) ⇒ Object

Sets Color blue value



47
48
49
# File 'lib/raylib/core/structs/color.rb', line 47

def b=(new_b)
  self[:b] = new_b
end

#gunsigned char

Color green value

Returns:

  • (unsigned char)

    g



35
# File 'lib/raylib/core/structs/color.rb', line 35

def g = self[:g]

#g=(new_g) ⇒ Object

Sets Color green value



38
39
40
# File 'lib/raylib/core/structs/color.rb', line 38

def g=(new_g)
  self[:g] = new_g
end

#runsigned char

Color red value

Returns:

  • (unsigned char)

    r



26
# File 'lib/raylib/core/structs/color.rb', line 26

def r = self[:r]

#r=(new_r) ⇒ Object

Sets Color red value



29
30
31
# File 'lib/raylib/core/structs/color.rb', line 29

def r=(new_r)
  self[:r] = new_r
end

#to_sObject



20
21
22
# File 'lib/raylib/core/structs/color.rb', line 20

def to_s
  "Raylib::Color##{object_id} r=#{r} g=#{g} b=#{b} a=#{a}"
end