Add filter to CreateRenderTarget

This commit is contained in:
Hajime Hoshi 2014-01-11 18:07:12 +09:00
parent ca4275d347
commit ffc08a75d3
4 changed files with 6 additions and 6 deletions

View File

@ -69,7 +69,7 @@ func (game *Game) startLoadingTextures(textureFactory graphics.TextureFactory) {
tag := tag
size := size
go func() {
textureFactory.CreateRenderTarget(tag, size.Width, size.Height)
textureFactory.CreateRenderTarget(tag, size.Width, size.Height, graphics.FilterNearest)
}()
}
}

View File

@ -25,8 +25,8 @@ func (s *SharedContext) CreateContext(screenWidth, screenHeight, screenScale int
return newContext(s.ids, screenWidth, screenHeight, screenScale)
}
func (s *SharedContext) CreateRenderTarget(width, height int) (graphics.RenderTargetId, error) {
return s.ids.CreateRenderTarget(width, height, graphics.FilterLinear)
func (s *SharedContext) CreateRenderTarget(width, height int, filter graphics.Filter) (graphics.RenderTargetId, error) {
return s.ids.CreateRenderTarget(width, height, filter)
}
func (s *SharedContext) CreateTexture(img image.Image, filter graphics.Filter) (graphics.TextureId, error) {

View File

@ -17,7 +17,7 @@ type RenderTargetCreatedEvent struct {
}
type TextureFactory interface {
CreateRenderTarget(tag interface{}, width, height int) // TODO: Add filter
CreateRenderTarget(tag interface{}, width, height int, filter Filter)
CreateTexture(tag interface{}, img image.Image, filter Filter)
Events() <-chan interface{}
}

View File

@ -101,13 +101,13 @@ func (t *sharedContext) CreateTexture(tag interface{}, img image.Image, filter g
}()
}
func (t *sharedContext) CreateRenderTarget(tag interface{}, width, height int) {
func (t *sharedContext) CreateRenderTarget(tag interface{}, width, height int, filter graphics.Filter) {
go func() {
<-t.inited
var id graphics.RenderTargetId
var err error
t.useGLContext(func() {
id, err = t.sharedContext.CreateRenderTarget(width, height)
id, err = t.sharedContext.CreateRenderTarget(width, height, filter)
})
if t.events == nil {
return