Class: UI::BlurScreenshot

Inherits:
ShaderedSprite show all
Defined in:
scripts/01450 Systems/00000 General/00100 UI Generics/02800 BlurScreenshot.rb

Overview

Class responsive of showing a blur screenshot in the current scene

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

#disposed?

Constructor Details

#initialize(viewport = nil, last_scene) ⇒ BlurScreenshot

Create a new blur Screenshot

Parameters:

  • viewport (Viewport, nil) (defaults to: nil)
  • last_scene (GamePlay::Base)

    base scene that should respond to #viewport



7
8
9
10
11
12
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/02800 BlurScreenshot.rb', line 7

def initialize(viewport = nil, last_scene)
  @last_scene = last_scene
  super(viewport || guess_viewport)
  self.shader = Shader.create(:blur)
  update_snapshot
end

Instance Method Details

#dispose

Dispose the sprite



15
16
17
18
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/02800 BlurScreenshot.rb', line 15

def dispose
  bitmap.dispose
  super
end

#update_snapshot

Update the snapshot



21
22
23
24
# File 'scripts/01450 Systems/00000 General/00100 UI Generics/02800 BlurScreenshot.rb', line 21

def update_snapshot
  self.bitmap = create_snapshot
  shader.set_float_uniform('resolution', [width, height])
end