ebiten/graphics/texture/render_target.go

24 lines
564 B
Go
Raw Normal View History

package texture
2013-11-26 15:05:54 +01:00
2013-10-25 21:15:27 +02:00
type RenderTarget struct {
2013-11-28 18:38:18 +01:00
framebuffer interface{}
offscreenWidth int
offscreenHeight int
2013-10-25 21:15:27 +02:00
}
2013-11-28 18:38:18 +01:00
func NewRenderTarget(framebuffer interface{}, width, height int) *RenderTarget {
2013-10-25 21:15:27 +02:00
return &RenderTarget{
2013-11-28 18:38:18 +01:00
framebuffer: framebuffer,
offscreenWidth: AdjustSize(width),
offscreenHeight: AdjustSize(height),
2013-10-25 21:15:27 +02:00
}
}
type OffscreenSetter interface {
Set(framebuffer interface{}, x, y, width, height int)
}
2013-11-28 18:38:18 +01:00
func (r *RenderTarget) SetAsOffscreen(setter OffscreenSetter) {
setter.Set(r.framebuffer, 0, 0, r.offscreenWidth, r.offscreenHeight)
2013-10-27 13:27:16 +01:00
}