mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-14 13:02:08 +01:00
Add filter to CreateRenderTarget
This commit is contained in:
parent
ca4275d347
commit
ffc08a75d3
@ -69,7 +69,7 @@ func (game *Game) startLoadingTextures(textureFactory graphics.TextureFactory) {
|
|||||||
tag := tag
|
tag := tag
|
||||||
size := size
|
size := size
|
||||||
go func() {
|
go func() {
|
||||||
textureFactory.CreateRenderTarget(tag, size.Width, size.Height)
|
textureFactory.CreateRenderTarget(tag, size.Width, size.Height, graphics.FilterNearest)
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ func (s *SharedContext) CreateContext(screenWidth, screenHeight, screenScale int
|
|||||||
return newContext(s.ids, screenWidth, screenHeight, screenScale)
|
return newContext(s.ids, screenWidth, screenHeight, screenScale)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SharedContext) CreateRenderTarget(width, height int) (graphics.RenderTargetId, error) {
|
func (s *SharedContext) CreateRenderTarget(width, height int, filter graphics.Filter) (graphics.RenderTargetId, error) {
|
||||||
return s.ids.CreateRenderTarget(width, height, graphics.FilterLinear)
|
return s.ids.CreateRenderTarget(width, height, filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SharedContext) CreateTexture(img image.Image, filter graphics.Filter) (graphics.TextureId, error) {
|
func (s *SharedContext) CreateTexture(img image.Image, filter graphics.Filter) (graphics.TextureId, error) {
|
||||||
|
@ -17,7 +17,7 @@ type RenderTargetCreatedEvent struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TextureFactory interface {
|
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)
|
CreateTexture(tag interface{}, img image.Image, filter Filter)
|
||||||
Events() <-chan interface{}
|
Events() <-chan interface{}
|
||||||
}
|
}
|
||||||
|
@ -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() {
|
go func() {
|
||||||
<-t.inited
|
<-t.inited
|
||||||
var id graphics.RenderTargetId
|
var id graphics.RenderTargetId
|
||||||
var err error
|
var err error
|
||||||
t.useGLContext(func() {
|
t.useGLContext(func() {
|
||||||
id, err = t.sharedContext.CreateRenderTarget(width, height)
|
id, err = t.sharedContext.CreateRenderTarget(width, height, filter)
|
||||||
})
|
})
|
||||||
if t.events == nil {
|
if t.events == nil {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user