Class: Colour
- Inherits:
-
Object
- Object
- Colour
- Defined in:
- src/ruby/models/colour.rb,
mrb_doc/models/colour.rb
Overview
The Colour class is used for setting the colour of basic primatives (Circle, Rectangle, etc) but also for setting transparency on Texture2D objects.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#==(other) ⇒ Boolean
Compares the values of two Colours.
-
#initialize(red, green, blue, alpha) ⇒ Colour
constructor
Creates a new instance of Colour.
-
#to_h ⇒ Hash
Return the object represented by a Hash.
Constructor Details
Instance Attribute Details
#alpha ⇒ Integer
5 6 7 |
# File 'src/ruby/models/colour.rb', line 5 def alpha @alpha end |
#blue ⇒ Integer
5 6 7 |
# File 'src/ruby/models/colour.rb', line 5 def blue @blue end |
#green ⇒ Integer
5 6 7 |
# File 'src/ruby/models/colour.rb', line 5 def green @green end |
#red ⇒ Integer
5 6 7 |
# File 'src/ruby/models/colour.rb', line 5 def red @red end |
Instance Method Details
#==(other) ⇒ Boolean
Compares the values of two Colours
10 11 12 13 14 15 |
# File 'src/ruby/models/colour.rb', line 10 def ==(other) self.red == other.red && self.green == other.green && self.blue == other.blue && self.alpha == other.alpha end |
#to_h ⇒ Hash
Return the object represented by a Hash
20 21 22 23 24 25 26 27 |
# File 'src/ruby/models/colour.rb', line 20 def to_h { red: red, green: green, blue: blue, alpha: alpha, } end |