Class: Viewport

Inherits:
Object
  • Object
show all
Defined in:
lib/viewport.rb

Overview

The viewport class. Used when displaying sprites in one portion of the screen, with no overflow into other regions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeViewport

new(x, y, width, height) new(rect)


37
38
39
# File 'lib/viewport.rb', line 37

def initialize
  raise "not implemented"
end

Instance Attribute Details

#colorObject

The Color to be blended with the viewport. Alpha values are used in the blending ratio.

Handled separately from the color blended into a flash effect.


29
30
31
# File 'lib/viewport.rb', line 29

def color
  @color
end

#oxObject

The X-coordinate of the viewport's starting point. Change this value to shake the screen, etc.


19
20
21
# File 'lib/viewport.rb', line 19

def ox
  @ox
end

#oyObject

The Y-coordinate of the viewport's starting point. Change this value to shake the screen, etc.


23
24
25
# File 'lib/viewport.rb', line 23

def oy
  @oy
end

#rectObject

The Rect defining the viewport.


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

def rect
  @rect
end

#toneObject

The viewport's color Tone.


33
34
35
# File 'lib/viewport.rb', line 33

def tone
  @tone
end

#visibleObject

The viewport's visibility. If TRUE, the viewport is visible.


9
10
11
# File 'lib/viewport.rb', line 9

def visible
  @visible
end

#zObject

The viewport's Z-coordinate. The larger this value, the closer to the player the viewport will be displayed. If multiple objects share the same Z-coordinate, the more recently created object will be displayed closest to the player.


15
16
17
# File 'lib/viewport.rb', line 15

def z
  @z
end

Instance Method Details

#disposeObject

Frees the viewport. If the viewport has already been freed, does nothing.


42
43
44
# File 'lib/viewport.rb', line 42

def dispose
  @disposed = true
end

#disposed?Boolean

Returns TRUE if the viewport has been freed.


47
48
49
# File 'lib/viewport.rb', line 47

def disposed?
  @disposed
end

#flash(color, duration) ⇒ Object

Begins flashing the viewport. duration specifies the number of frames the flash will last.

If color is set to nil, the viewport will disappear while flashing.


54
55
56
# File 'lib/viewport.rb', line 54

def flash(color, duration)
  raise "not implemented"
end

#updateObject

Refreshes the viewport flash. As a rule, this method is called once per frame.

It is not necessary to call this method if no flash effect is needed.


61
62
63
# File 'lib/viewport.rb', line 61

def update
  raise "not implemented"
end