예제 #1
0
// Setup is called before the main loop is started
func (game *Game) Setup(w *ecs.World) {
	engi.SetBg(0x222222)
	w.AddSystem(&engi.RenderSystem{})

	// The most important line in this whole demo:
	w.AddSystem(engi.NewKeyboardScroller(scrollSpeed, engi.W, engi.D, engi.S, engi.A))

	// Create the background; this way we'll see when we actually scroll
	w.AddEntity(generateBackground())
}
예제 #2
0
파일: hud.go 프로젝트: EtienneBruines/engi
// Setup is called before the main loop is started
func (game *Game) Setup(w *ecs.World) {
	engi.SetBg(0x222222)
	w.AddSystem(&engi.RenderSystem{})

	// Adding KeyboardScroller so we can actually see the difference between background and HUD when scrolling
	w.AddSystem(engi.NewKeyboardScroller(scrollSpeed, engi.W, engi.D, engi.S, engi.A))
	w.AddSystem(engi.NewMouseZoomer(zoomSpeed))

	// Create background, so we can see difference between this and HUD
	w.AddEntity(generateBackground())

	// Creating the HUD
	hudWidth := float32(200)         // Can be anything you want
	hudHeight := engi.WindowHeight() // Can be anything you want

	// Generate something that uses the PriorityLevel HUDGround or up
	hudBg := generateHUDBackground(hudWidth, hudHeight)
	w.AddEntity(hudBg)
}