MCPcopy
hub / github.com/g3n/engine / SetTexture

Method SetTexture

gui/image.go:52–60  ·  view source on GitHub ↗

SetTexture changes the image texture to the specified texture2D. It returns a pointer to the previous texture.

(tex *texture.Texture2D)

Source from the content-addressed store, hash-verified

50// SetTexture changes the image texture to the specified texture2D.
51// It returns a pointer to the previous texture.
52func (i *Image) SetTexture(tex *texture.Texture2D) *texture.Texture2D {
53
54 prevtex := i.tex
55 i.Material().RemoveTexture(prevtex)
56 i.tex = tex
57 i.Panel.SetContentSize(float32(i.tex.Width()), float32(i.tex.Height()))
58 i.Material().AddTexture(i.tex)
59 return prevtex
60}
61
62// SetImage sets the image from the specified image file
63func (i *Image) SetImage(imgfile string) error {

Callers 2

SetImageMethod · 0.95
updateMethod · 0.80

Calls 6

RemoveTextureMethod · 0.80
SetContentSizeMethod · 0.80
AddTextureMethod · 0.80
WidthMethod · 0.65
HeightMethod · 0.65
MaterialMethod · 0.45

Tested by

no test coverage detected