Method: RGSS::Texture#target

Defined in:
lib/rgss/texture.rb

#target(area = nil) ⇒ Object

Raises:

  • (LocalJumpError)


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/rgss/texture.rb', line 54

def target(area = nil)
  raise(LocalJumpError, "block required") unless block_given?

  area ||= Rect.new(0, 0, @width, @height)

  Graphics.project(area.x, area.y, area.width, area.height) do

    bind_framebuffer
    glViewport(area.x, area.y, area.width, area.height)
    glScissor(area.x, area.y, area.width, area.height)
    yield
  end

  Graphics.restore
  self
end