package ui import ( rl "github.com/gen2brain/raylib-go/raylib" ) const ImageTypeName string = "image" type Image struct { Texture *rl.Texture2D Weight float32 Style Style `json:"-"` parentMenu *Menu `json:"-"` textureRect *rl.Rectangle } func (base *Image) Init(parent *Menu) { base.parentMenu = parent base.textureRect = &rl.Rectangle{ X: 0, Y: 0, Width: float32(base.Texture.Width), Height: float32(base.Texture.Height), } if base.Weight == 0 { base.Weight = 1 } } func (base *Image) Destroy() { } // Gets the scale width of the element. Works similar to CSS's 'flex-grow' func (base *Image) GetOccupationWeight() float32 { return base.Weight } // Draw the element with the given size func (base *Image) Draw(trg *rl.Rectangle) { rl.DrawTexturePro(*base.Texture, *base.textureRect, *trg, rl.Vector2Zero(), 0, rl.White) }