MCPcopy Index your code
hub / github.com/EngoEngine/engo / Update

Method Update

demos/textbox/textbox.go:110–133  ·  view source on GitHub ↗
(dt float32)

Source from the content-addressed store, hash-verified

108func (*TypingSystem) Remove(ecs.BasicEntity) {}
109
110func (t *TypingSystem) Update(dt float32) {
111 t.timeSinceDeletion += dt
112 str := ""
113 txt := t.label.Drawable.(common.Text)
114 if engo.Input.Button("backspace").Down() && len(txt.Text) > 0 {
115 if t.timeSinceDeletion > 0.2 {
116 t.timeSinceDeletion = 0
117 txt.Text = txt.Text[:len(txt.Text)-1]
118 t.label.Drawable = txt
119 }
120 return
121 }
122 t.runeLock.Lock()
123 if len(t.runesToAdd) != 0 {
124 str = string(t.runesToAdd)
125 }
126 t.runesToAdd = make([]rune, 0)
127 t.runeLock.Unlock()
128 txt.Text += str
129 if engo.Input.Button("enter").JustPressed() {
130 txt.Text += "\n"
131 }
132 t.label.Drawable = txt
133}
134
135func main() {
136 opts := engo.RunOptions{

Callers

nothing calls this directly

Calls 3

ButtonMethod · 0.80
DownMethod · 0.45
JustPressedMethod · 0.45

Tested by

no test coverage detected