MCPcopy
hub / github.com/EngoEngine/engo / Update

Method Update

demos/audio/audio.go:103–139  ·  view source on GitHub ↗
(dt float32)

Source from the content-addressed store, hash-verified

101func (w *WhoopSystem) Remove(basic ecs.BasicEntity) {}
102
103func (w *WhoopSystem) Update(dt float32) {
104 if btn := engo.Input.Button("pause"); btn.JustPressed() {
105 if w.paused {
106 w.aSys.Restart()
107 w.paused = false
108 } else {
109 w.aSys.Pause()
110 w.paused = true
111 }
112 }
113 if w.paused {
114 return
115 }
116 if btn := engo.Input.Button("whoop"); btn.JustPressed() {
117 if !w.player.IsPlaying() {
118 w.player.Rewind()
119 w.player.Play()
120 }
121 }
122 d := float64(dt * 0.1)
123 volume := w.player.GetVolume()
124 if w.goingUp {
125 volume += d
126 } else {
127 volume -= d
128 }
129
130 if volume < 0 {
131 w.player.SetVolume(0.0)
132 w.goingUp = true
133 } else if volume > 1 {
134 w.player.SetVolume(1.0)
135 w.goingUp = false
136 } else {
137 w.player.SetVolume(volume)
138 }
139}
140
141func main() {
142 opts := engo.RunOptions{

Callers

nothing calls this directly

Calls 9

ButtonMethod · 0.80
RestartMethod · 0.80
IsPlayingMethod · 0.80
RewindMethod · 0.80
PlayMethod · 0.80
GetVolumeMethod · 0.80
SetVolumeMethod · 0.80
JustPressedMethod · 0.45
PauseMethod · 0.45

Tested by

no test coverage detected