Allegro CreateTexture{Go,Path} didn't respect source flag.

This commit is contained in:
Sander Schobers 2020-05-20 19:45:45 +02:00
parent 39766e9f01
commit a2cb2d03ca

View File

@ -200,7 +200,7 @@ func (r *Renderer) CreateTexture(source ui.ImageSource) (ui.Texture, error) {
} }
func (r *Renderer) CreateTextureGo(im image.Image, source bool) (ui.Texture, error) { func (r *Renderer) CreateTextureGo(im image.Image, source bool) (ui.Texture, error) {
return r.createTexture(ui.ImageSourceGo{im}, true) return r.createTexture(ui.ImageSourceGo{Image: im}, source)
} }
func (r *Renderer) CreateTexturePath(path string, source bool) (ui.Texture, error) { func (r *Renderer) CreateTexturePath(path string, source bool) (ui.Texture, error) {
@ -212,6 +212,9 @@ func (r *Renderer) CreateTexturePath(path string, source bool) (ui.Texture, erro
if err != nil { if err != nil {
return nil, err return nil, err
} }
if source {
return &texture{bmp, ui.ImageSourceResource{Resources: r.res, Name: path}}, nil
}
return &texture{bmp, nil}, nil return &texture{bmp, nil}, nil
} }