local Scene = require "core.modules.scenes"
local menu = require "scenes.debug.viewers.battleBack.menu"

local BackgroundViewer = Scene:extend()
local Background = require "game.modules.drawing.parallaxBackground"
local backgroundList = require "datas.gamedata.maps.shoot.zones"


function BackgroundViewer:new()
  BackgroundViewer.super.new(self)
  self.assets:batchImport("scenes.debug.commons.assets")
  menu.commons.DebugMenu(self, "MainMenu")

  self:setBackground("city")

  for backId, backgroundData in pairs(backgroundList) do
    menu.ShowBackgroundWidget(self, "MainMenu", backgroundData.name, backId)
  end
  menu.commons.SceneWidget(self, "MainMenu", scenes.debug.menu, "Back")

  self.menusystem:activate()
  self.menusystem:switchMenu("MainMenu")
end


function BackgroundViewer:update(dt)
  if (love.keyboard.isDown("z") and (not self.menusystem.isActive)) then
    self.menusystem:activate()
  end
end

function BackgroundViewer:setBackground(newBackground)
  self.background = Background(self, 5, 1, newBackground)
end

function BackgroundViewer:draw()
  self.background:draw()
end

return BackgroundViewer
