Object.alpha = 0xffrequire 'forwardable'
module Colored
extend Forwardable
attr_accessor :color
def_delegators :@color, :red, :blue, :green, :alpha, :red=, :blue=, :green=, :alpha=
end
self.color = Color.rgba(123, 123, 13, 0) or something in the constructor and you'd be able to access #color and directly affect #alpha, etc.red = remainder.div(0x10000)divmod = remainder.divmod(0x10000)
red = divmod[0]
attr_reader :color # Getter
def color=(color) # Setter
@color = color.is_a?(Gosu::Color) ? color.dup : Gosu::Color.argb(color)
end
Powered by mwForum 2.29.0 © 1999-2013 Markus Wichitill