// Draw draws this to the target region. func (i *Image) Draw(r Region, delta float64) { if i.isNew || i.isDirty() || forceDirty { i.isNew = false e := render.NewUIElement(i.texture, r.X, r.Y, r.W, r.H, i.tx, i.ty, i.tw, i.th) e.R = byte(i.r) e.G = byte(i.g) e.B = byte(i.b) e.A = byte(i.a) e.Layer = i.Layer() i.data = e.Bytes() } render.UIAddBytes(i.data) }
func (b *Button) newUIElement(tex render.TextureInfo, x, y, width, height float64, tx, ty, tw, th float64) *render.UIElement { u := render.NewUIElement(tex, x, y, width, height, tx, ty, tw, th) u.Layer = b.Layer() return u }