Class: Gosu::Color

Inherits:
Object
  • Object
show all
Defined in:
lib/ashton/gosu_ext/color.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_opengl(rgba_array) ⇒ Gosu::Color

Convert into an array of floats in range 0.0 to 1.0.

Parameters:

  • rgba_array (Array<Float>)

Returns:



# File 'lib/ashton/gosu_ext/color.rb', line 3

Instance Method Details

#to_iInteger

Convert to Gosu-compatible ARGB value (0xAARRGGBB)

Returns:

  • (Integer)


# File 'lib/ashton/gosu_ext/color.rb', line 21

#to_openglArray<Float>

Convert into a length 4 array of floats in range 0.0 to 1.0, which can then be passed into OpenGL ruby methods.

Examples:

color = Gosu::Color.rgba 128, 0, 0, 255 # => [0.502, 0.0, 0.0, 1.0]
glColor4f *color.to_opengl

Returns:

  • (Array<Float>)


# File 'lib/ashton/gosu_ext/color.rb', line 10