mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 11:48:55 +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
|
||||
size := size
|
||||
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)
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -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{}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user