-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.go
33 lines (29 loc) · 793 Bytes
/
home.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package views
import (
"github.com/andygeiss/tinygo/internal/app"
"github.com/andygeiss/tinygo/internal/app/systems"
"github.com/andygeiss/tinygo/internal/pkg/ecs"
"github.com/andygeiss/tinygo/internal/pkg/ui/entities"
)
type homeView struct{}
// NewHomeView ...
func NewHomeView() app.View {
return &homeView{}
}
// Show ...
func (s *homeView) Show() {
// Add entities and systems.
entityManager := ecs.NewEntityManager()
entityManager.Add(
entities.NewElement("content", "", "Hello Gophers!", "white", "blue", "homeSayHello();"),
)
systemManager := ecs.NewSystemManager()
systemManager.Add(
systems.NewRendering(),
)
// Finally setup, run and teardown the engine.
engine := ecs.NewEngine(entityManager, systemManager)
engine.Setup()
engine.Run()
engine.Teardown()
}