ebiten/graphics/rendertarget/render_target.go
2013-10-27 21:27:16 +09:00

31 lines
720 B
Go

package rendertarget
import (
"github.com/hajimehoshi/go-ebiten/graphics/texture"
)
type RenderTarget struct {
texture *texture.Texture
framebuffer interface{}
}
func NewWithFramebuffer(texture *texture.Texture, framebuffer interface{}) *RenderTarget {
return &RenderTarget{
texture: texture,
framebuffer: framebuffer,
}
}
// TODO: Remove this
func (renderTarget *RenderTarget) Texture() *texture.Texture {
return renderTarget.texture
}
func (renderTarget *RenderTarget) SetAsViewport(setter func(x, y, width, height int)) {
renderTarget.texture.SetAsViewport(setter)
}
func (renderTarget *RenderTarget) SetAsOffscreen(setter func(framebuffer interface{})) {
setter(renderTarget.framebuffer)
}