(w *ecs.World)
| 70 | } |
| 71 | |
| 72 | func (t *TypingSystem) New(w *ecs.World) { |
| 73 | fnt := &common.Font{ |
| 74 | URL: "Roboto-Regular.ttf", |
| 75 | FG: color.Black, |
| 76 | Size: 64, |
| 77 | } |
| 78 | err := fnt.CreatePreloaded() |
| 79 | if err != nil { |
| 80 | panic(err) |
| 81 | } |
| 82 | |
| 83 | t.label = MyLabel{BasicEntity: ecs.NewBasic()} |
| 84 | t.label.SpaceComponent.Position.Set(0, 75) |
| 85 | t.label.RenderComponent.Drawable = common.Text{ |
| 86 | Font: fnt, |
| 87 | Text: "", |
| 88 | } |
| 89 | |
| 90 | for _, system := range w.Systems() { |
| 91 | switch sys := system.(type) { |
| 92 | case *common.RenderSystem: |
| 93 | sys.Add(&t.label.BasicEntity, &t.label.RenderComponent, &t.label.SpaceComponent) |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | engo.Mailbox.Listen("TextMessage", func(msg engo.Message) { |
| 98 | m, ok := msg.(engo.TextMessage) |
| 99 | if !ok { |
| 100 | return |
| 101 | } |
| 102 | t.runeLock.Lock() |
| 103 | t.runesToAdd = append(t.runesToAdd, m.Char) |
| 104 | t.runeLock.Unlock() |
| 105 | }) |
| 106 | } |
| 107 | |
| 108 | func (*TypingSystem) Remove(ecs.BasicEntity) {} |
| 109 |
nothing calls this directly
no test coverage detected