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

Method update

gui/image_button.go:218–243  ·  view source on GitHub ↗

update updates the button visual state

()

Source from the content-addressed store, hash-verified

216
217// update updates the button visual state
218func (b *ImageButton) update() {
219
220 if !b.Enabled() {
221 if b.stateImages[ButtonDisabled] != nil {
222 b.image.SetTexture(b.stateImages[ButtonDisabled])
223 }
224 b.applyStyle(&b.styles.Disabled)
225 return
226 }
227 if b.pressed {
228 if b.stateImages[ButtonPressed] != nil {
229 b.image.SetTexture(b.stateImages[ButtonPressed])
230 }
231 b.applyStyle(&b.styles.Pressed)
232 return
233 }
234 if b.mouseOver {
235 if b.stateImages[ButtonOver] != nil {
236 b.image.SetTexture(b.stateImages[ButtonOver])
237 }
238 b.applyStyle(&b.styles.Over)
239 return
240 }
241 b.image.SetTexture(b.stateImages[ButtonNormal])
242 b.applyStyle(&b.styles.Normal)
243}
244
245// applyStyle applies the specified button style
246func (b *ImageButton) applyStyle(bs *ImageButtonStyle) {

Callers 6

SetImageMethod · 0.95
SetStylesMethod · 0.95
onCursorMethod · 0.95
onMouseMethod · 0.95
onKeyMethod · 0.95
NewImageButtonFunction · 0.45

Calls 3

applyStyleMethod · 0.95
SetTextureMethod · 0.80
EnabledMethod · 0.65

Tested by

no test coverage detected