gameLibTests/engo/TrafficManager/traffic.go

47 lines
966 B
Go
Raw Permalink Normal View History

2017-12-28 12:25:14 +01:00
package main
import (
"engo.io/engo"
"engo.io/engo/common"
"engo.io/ecs"
"image/color"
"./systems"
)
type myScene struct {}
type City struct {
ecs.BasicEntity
common.RenderComponent
common.SpaceComponent
}
// Type uniquely defines your game type
func (*myScene) Type() string { return "myGame" }
// Preload is called before loading any assets from the disk,
// to allow you to register / queue them
func (*myScene) Preload() {
engo.Files.Load("city.png")
}
// Setup is called before the main loop starts. It allows you
// to add entities and systems to your Scene.
func (*myScene) Setup(world *ecs.World) {
engo.Input.RegisterButton("AddCity", engo.F1)
common.SetBackground(color.White)
world.AddSystem(&common.RenderSystem{})
world.AddSystem(&common.MouseSystem{})
world.AddSystem(&systems.CityBuildingSystem{})
}
func main() {
opts := engo.RunOptions{
Title: "Hello World",
Width: 400,
Height: 400,
}
engo.Run(opts, &myScene{})
}