(dt float32)
| 108 | func (*TypingSystem) Remove(ecs.BasicEntity) {} |
| 109 | |
| 110 | func (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 | |
| 135 | func main() { |
| 136 | opts := engo.RunOptions{ |
nothing calls this directly
no test coverage detected