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

Method Setup

demos/textbox/textbox.go:32–61  ·  view source on GitHub ↗

Setup is called before the main loop is started

(u engo.Updater)

Source from the content-addressed store, hash-verified

30
31// Setup is called before the main loop is started
32func (*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
63func (*DefaultScene) Type() string { return "Game" }
64

Callers

nothing calls this directly

Calls 3

CreatePreloadedMethod · 0.95
SetBackgroundFunction · 0.92
AddMethod · 0.45

Tested by

no test coverage detected