// Setup is called before the main loop is started func (game *Game) Setup(w *ecs.World) { engi.SetBg(0x222222) w.AddSystem(&engi.RenderSystem{}) w.AddSystem(engi.NewMouseZoomer(zoomSpeed)) // Create the background; this way we'll see when we actually zoom w.AddEntity(generateBackground()) }
func (game *GameWorld) Setup(w *ecs.World) { engi.SetBg(0xFFFFFF) w.AddSystem(&engi.MouseSystem{}) w.AddSystem(&engi.RenderSystem{}) w.AddSystem(&ControlSystem{}) w.AddSystem(engi.NewMouseZoomer(-0.125)) w.AddEntity(game.CreateEntity()) }
// Setup is called before the main loop is started func (game *Game) Setup(w *engi.World) { engi.SetBg(0x222222) w.AddSystem(&engi.RenderSystem{}) w.AddSystem(engi.NewMouseZoomer(zoomSpeed)) // Explicitly set WorldBounds for better default CameraSystem values engi.WorldBounds.Max = engi.Point{worldWidth, worldHeight} // Create the background; this way we'll see when we actually zoom w.AddEntity(generateBackground()) }
func (game *GameWorld) Setup(w *ecs.World) { engi.SetBg(0xFFFFFF) w.AddSystem(&engi.RenderSystem{}) w.AddSystem(&engi.AnimationSystem{}) w.AddSystem(&ControlSystem{}) w.AddSystem(engi.NewMouseZoomer(zoomSpeed)) spriteSheet := engi.NewSpritesheetFromFile("hero.png", 150, 150) w.AddEntity(game.CreateEntity(&engi.Point{0, 0}, spriteSheet, StopAction)) }
// 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) }