Class: ImColor

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/imgui.rb

Class Method Summary collapse

Class Method Details

.col32(r = 0, g = 0, b = 0, a = 255) ⇒ Object



1706
1707
1708
# File 'lib/imgui.rb', line 1706

def ImColor.col32(r = 0, g = 0, b = 0, a = 255)
  return ((a.to_i << 24) | (b.to_i << 0) | (g.to_i << 8) | (r.to_i << 16))
end

.create(r = 0, g = 0, b = 0, a = 255) ⇒ Object



1696
1697
1698
1699
1700
1701
1702
1703
1704
# File 'lib/imgui.rb', line 1696

def ImColor.create(r = 0, g = 0, b = 0, a = 255)
  sc = 1.0 / 255.0
  instance = ImColor.new
  instance[:Value][:x] = r.to_f * sc
  instance[:Value][:y] = g.to_f * sc
  instance[:Value][:z] = b.to_f * sc
  instance[:Value][:w] = a.to_f * sc
  return instance
end