Class: Sprite_Picture
- Inherits:
-
ShaderedSprite
- Object
- LiteRGSS::Disposable
- LiteRGSS::Drawable
- LiteRGSS::Sprite
- LiteRGSS::ShaderedSprite
- Sprite
- ShaderedSprite
- Sprite_Picture
- Defined in:
- scripts/01450 Systems/00003 Map Engine/00001 Graphics/03300 Sprite_Picture.rb
Overview
A sprite that show a Game_Picture on the screen
Constant Summary collapse
- SPRITE_SHADER =
<<-EOSHADER uniform vec4 tone; const vec3 lumaF = vec3(.299, .587, .114); uniform sampler2D texture; void main() { vec4 frag = texture2D(texture, gl_TexCoord[0].xy); float luma = dot(frag.rgb, lumaF); frag.rgb += tone.rgb; frag.rgb = mix(frag.rgb, vec3(luma), tone.w); frag.a *= gl_Color.a; // Result gl_FragColor = frag; } EOSHADER
Instance Attribute Summary
Attributes inherited from LiteRGSS::ShaderedSprite
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
-
#dispose
Dispose the picture.
-
#initialize(viewport, picture) ⇒ Sprite_Picture
constructor
Initialize a new Sprite_Picture.
-
#update
Update the picture sprite display with the information of the current Game_Picture.
Methods inherited from Sprite
#load, #mouse_in?, #set_origin_div, #set_rect, #set_rect_div, #set_z, #simple_mouse_in?, #translate_mouse_coords
Methods inherited from LiteRGSS::Sprite
new, #set_origin, #set_position
Methods inherited from LiteRGSS::Disposable
Constructor Details
#initialize(viewport, picture) ⇒ Sprite_Picture
Initialize a new Sprite_Picture
21 22 23 24 25 26 27 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/03300 Sprite_Picture.rb', line 21 def initialize(, picture) super() self.shader = Shader.create(:full_shader) @picture = picture @gif_handle = nil update end |
Instance Method Details
#dispose
Dispose the picture
30 31 32 33 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/03300 Sprite_Picture.rb', line 30 def dispose dispose_bitmap super end |
#update
Update the picture sprite display with the information of the current Game_Picture
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'scripts/01450 Systems/00003 Map Engine/00001 Graphics/03300 Sprite_Picture.rb', line 36 def update super # Try to load the new file if the name is different if @picture_name != @picture.name @picture_name = @picture.name load_bitmap end # Don't update if the name is empty if @picture_name.empty? self.visible = false return end self.visible = true update_properties update_gif if @gif_handle end |