Class: Sprite::WithColor

Inherits:
Sprite show all
Defined in:
scripts/00000 Dependencies/00001 LiteRGSS2/00003 Drawable.rb

Overview

Define a sprite that mix with a color

Instance Attribute Summary

Attributes inherited from LiteRGSS::ShaderedSprite

#blendmode, #shader

Attributes inherited from LiteRGSS::Sprite

#__index__, #angle, #bitmap, #height, #mirror, #opacity, #ox, #oy, #src_rect, #viewport, #visible, #width, #x, #y, #z, #zoom, #zoom_x, #zoom_y

Instance Method Summary collapse

Methods inherited from Sprite

#load, #mouse_in?, #set_origin_div, #set_rect, #set_rect_div, #set_z, #simple_mouse_in?, #translate_mouse_coords, #update

Methods inherited from LiteRGSS::Sprite

new, #set_origin, #set_position

Methods inherited from LiteRGSS::Disposable

#dispose, #disposed?

Constructor Details

#initialize(viewport = nil) ⇒ WithColor

Create a new Sprite::WithColor

Parameters:



76
77
78
79
# File 'scripts/00000 Dependencies/00001 LiteRGSS2/00003 Drawable.rb', line 76

def initialize(viewport = nil)
  super(viewport)
  self.shader = Shader.create(:color_shader)
end

Instance Method Details

#color=(array) ⇒ self Also known as: set_color

Set the Sprite color

Parameters:

  • array (Array(Numeric, Numeric, Numeric, Numeric), LiteRGSS::Color)

    the color (values : 0~1.0)

Returns:

  • (self)


84
85
86
87
# File 'scripts/00000 Dependencies/00001 LiteRGSS2/00003 Drawable.rb', line 84

def color=(array)
  shader.set_float_uniform('color', array)
  return self
end