package tins2021 import ( "image" "opslag.de/schobers/zntg/ui" ) type NamedTexture struct { textures *ui.Textures name string } func NewNamedTexture(textures *ui.Textures, name string) NamedTexture { return NamedTexture{ textures: textures, name: name, } } func CreateNamedTextureImage(textures *ui.Textures, name string, im image.Image) (NamedTexture, error) { _, err := textures.CreateTextureGo(name, im, true) if err != nil { return NamedTexture{}, err } return NewNamedTexture(textures, name), nil } func MustCreateNamedTextureImage(textures *ui.Textures, name string, im image.Image) NamedTexture { texture, err := CreateNamedTextureImage(textures, name, im) if err != nil { panic(err) } return texture } func (t NamedTexture) Scaled(scale float32) ui.Texture { return t.textures.ScaledByName(t.name, scale) } func (t NamedTexture) Texture() ui.Texture { return t.textures.Texture(t.name) }