mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-26 02:42:02 +01:00
Add texture.NewEmpty
This commit is contained in:
parent
f290a137a9
commit
f6523b28f4
@ -52,8 +52,7 @@ func (context *Context) Init() {
|
||||
context.mainFramebufferTexture, err = rendertarget.NewWithFramebuffer(
|
||||
context.screenWidth*context.screenScale,
|
||||
context.screenHeight*context.screenScale,
|
||||
rendertarget.Framebuffer(mainFramebuffer),
|
||||
texture.FilterLinear)
|
||||
rendertarget.Framebuffer(mainFramebuffer))
|
||||
if err != nil {
|
||||
panic("creating main framebuffer failed: " + err.Error())
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ func New(width, height int, filter texture.Filter) (
|
||||
Framebuffer(framebuffer.(C.GLuint))), tex, nil
|
||||
}
|
||||
|
||||
func NewWithFramebuffer(width, height int, framebuffer Framebuffer,
|
||||
filter texture.Filter) (*rendertarget.RenderTarget, error) {
|
||||
tex, err := texture.New(width, height, filter)
|
||||
func NewWithFramebuffer(width, height int, framebuffer Framebuffer) (
|
||||
*rendertarget.RenderTarget, error) {
|
||||
tex, err := texture.NewEmpty(width, height)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -70,6 +70,13 @@ func New(width, height int, filter Filter) (*gtexture.Texture, error) {
|
||||
return gtexture.New(width, height, f)
|
||||
}
|
||||
|
||||
func NewEmpty(width, height int) (*gtexture.Texture, error) {
|
||||
f := func(textureWidth, textureHeight int) (interface{}, error) {
|
||||
return nil, nil
|
||||
}
|
||||
return gtexture.New(width, height, f)
|
||||
}
|
||||
|
||||
func NewFromImage(img image.Image) (*gtexture.Texture, error) {
|
||||
return gtexture.NewFromImage(img, createFromImage)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user