Setup is called before the main loop is started
(u engo.Updater)
| 30 | |
| 31 | // Setup is called before the main loop is started |
| 32 | func (*DefaultScene) Setup(u engo.Updater) { |
| 33 | w, _ := u.(*ecs.World) |
| 34 | |
| 35 | common.SetBackground(color.White) |
| 36 | w.AddSystem(&common.RenderSystem{}) |
| 37 | w.AddSystem(&TypingSystem{}) |
| 38 | |
| 39 | fnt := &common.Font{ |
| 40 | URL: "Roboto-Regular.ttf", |
| 41 | FG: color.Black, |
| 42 | Size: 64, |
| 43 | } |
| 44 | err := fnt.CreatePreloaded() |
| 45 | if err != nil { |
| 46 | panic(err) |
| 47 | } |
| 48 | |
| 49 | label1 := MyLabel{BasicEntity: ecs.NewBasic()} |
| 50 | label1.RenderComponent.Drawable = common.Text{ |
| 51 | Font: fnt, |
| 52 | Text: "Start Typing to add text!", |
| 53 | } |
| 54 | |
| 55 | for _, system := range w.Systems() { |
| 56 | switch sys := system.(type) { |
| 57 | case *common.RenderSystem: |
| 58 | sys.Add(&label1.BasicEntity, &label1.RenderComponent, &label1.SpaceComponent) |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | func (*DefaultScene) Type() string { return "Game" } |
| 64 |
nothing calls this directly
no test coverage detected