Module: Ruby2D::Renderable

Included in:
Circle, Image, Line, Quad, Sprite, Text, Triangle
Defined in:
lib/ruby2d/renderable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#zObject

Returns the value of attribute z.



6
7
8
# File 'lib/ruby2d/renderable.rb', line 6

def z
  @z
end

Instance Method Details

#aObject



33
# File 'lib/ruby2d/renderable.rb', line 33

def a; self.color.a end

#a=(c) ⇒ Object



37
# File 'lib/ruby2d/renderable.rb', line 37

def a=(c); self.color.a = c end

#addObject

Add the object to the window



16
17
18
19
20
# File 'lib/ruby2d/renderable.rb', line 16

def add
  if Module.const_defined? :DSL
    Window.add(self)
  end
end

#bObject



32
# File 'lib/ruby2d/renderable.rb', line 32

def b; self.color.b end

#b=(c) ⇒ Object



36
# File 'lib/ruby2d/renderable.rb', line 36

def b=(c); self.color.b = c end

#colourObject

Allow British English spelling of color



42
# File 'lib/ruby2d/renderable.rb', line 42

def colour; self.color end

#colour=(c) ⇒ Object



43
# File 'lib/ruby2d/renderable.rb', line 43

def colour=(c); self.color = c end

#contains?(x, y) ⇒ Boolean

Add a contains method stub

Returns:

  • (Boolean)

Raises:



46
47
48
# File 'lib/ruby2d/renderable.rb', line 46

def contains?(x, y)
  raise Error, "\`#contains?\` not implemented for this class yet"
end

#gObject



31
# File 'lib/ruby2d/renderable.rb', line 31

def g; self.color.g end

#g=(c) ⇒ Object



35
# File 'lib/ruby2d/renderable.rb', line 35

def g=(c); self.color.g = c end

#opacityObject



38
# File 'lib/ruby2d/renderable.rb', line 38

def opacity; self.color.opacity end

#opacity=(val) ⇒ Object



39
# File 'lib/ruby2d/renderable.rb', line 39

def opacity=(val); self.color.opacity = val end

#rObject

Allow shortcuts for setting color values



30
# File 'lib/ruby2d/renderable.rb', line 30

def r; self.color.r end

#r=(c) ⇒ Object



34
# File 'lib/ruby2d/renderable.rb', line 34

def r=(c); self.color.r = c end

#removeObject

Remove the object from the window



23
24
25
26
27
# File 'lib/ruby2d/renderable.rb', line 23

def remove
  if Module.const_defined? :DSL
    Window.remove(self)
  end
end