Class: Raylib::Color
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- Raylib::Color
- Defined in:
- lib/raylib_main.rb,
lib/raylib_helper.rb
Overview
Color helper
Class Method Summary collapse
Instance Method Summary collapse
- #a ⇒ Object
- #a=(v) ⇒ Object
- #b ⇒ Object
- #b=(v) ⇒ Object
- #copy(other) ⇒ Object
- #g ⇒ Object
- #g=(v) ⇒ Object
- #r ⇒ Object
- #r=(v) ⇒ Object
- #set(r, g, b, a) ⇒ Object
Class Method Details
.from_u32(rgba = 255) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/raylib_helper.rb', line 15 def self.from_u32(rgba = 255) r = (rgba >> 24) & 0xFF g = (rgba >> 16) & 0xFF b = (rgba >> 8) & 0xFF a = (rgba >> 0) & 0xFF Color.new.set(r, g, b, a) end |
.from_u8(r = 0, g = 0, b = 0, a = 255) ⇒ Object
11 12 13 |
# File 'lib/raylib_helper.rb', line 11 def self.from_u8(r = 0, g = 0, b = 0, a = 255) Color.new.set(r, g, b, a) end |
.set(rgba) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/raylib_helper.rb', line 31 def self.set(rgba) self[:r] = (rgba >> 24) & 0xFF self[:g] = (rgba >> 16) & 0xFF self[:b] = (rgba >> 8) & 0xFF self[:a] = (rgba >> 0) & 0xFF self end |
Instance Method Details
#a ⇒ Object
537 |
# File 'lib/raylib_main.rb', line 537 def a = self[:a] |
#a=(v) ⇒ Object
538 |
# File 'lib/raylib_main.rb', line 538 def a=(v) self[:a] = v end |
#b ⇒ Object
535 |
# File 'lib/raylib_main.rb', line 535 def b = self[:b] |
#b=(v) ⇒ Object
536 |
# File 'lib/raylib_main.rb', line 536 def b=(v) self[:b] = v end |
#copy(other) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/raylib_helper.rb', line 39 def copy(other) self[:r] = other.r self[:g] = other.g self[:b] = other.b self[:a] = other.a self end |
#g ⇒ Object
533 |
# File 'lib/raylib_main.rb', line 533 def g = self[:g] |
#g=(v) ⇒ Object
534 |
# File 'lib/raylib_main.rb', line 534 def g=(v) self[:g] = v end |
#r ⇒ Object
531 |
# File 'lib/raylib_main.rb', line 531 def r = self[:r] |
#r=(v) ⇒ Object
532 |
# File 'lib/raylib_main.rb', line 532 def r=(v) self[:r] = v end |
#set(r, g, b, a) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/raylib_helper.rb', line 23 def set(r, g, b, a) self[:r] = r self[:g] = g self[:b] = b self[:a] = a self end |