Class: SDL2::Color

Inherits:
Struct
  • Object
show all
Defined in:
lib/sdl2/color.rb

Overview

SDL_pixels.h:252~258

Instance Method Summary collapse

Methods inherited from Struct

#==, #initialize, #inspect, release

Constructor Details

This class inherits a constructor from SDL2::Struct

Instance Method Details

#copy_from(color) ⇒ Object



28
29
30
31
32
# File 'lib/sdl2/color.rb', line 28

def copy_from(color)
  [:r, :g, :b, :a].each do |c|
    self.send("#{c}=", color.send(c))
  end
end

#set(r, g, b, a = nil) ⇒ Object



21
22
23
24
25
26
# File 'lib/sdl2/color.rb', line 21

def set(r,g,b,a=nil)
  self.r = r
  self.g = g
  self.b = b
  self.a = a unless a.nil?
end