---------------------------------------------------------------
-- Creates the splash-screen displayed at the start of the game
---------------------------------------------------------------
function newSplashScreen()
   local o = {}
   
   
   -----------------------------------
   -- Constructor of the splash-screen
   -----------------------------------
   function o:construct()
      self.splashSprite = newSprite("images/splashScreen.png")
      self.fadeSprite = newSprite("images/fade.png")
      self.currentTime = 0.0
      self.fade = 0.0
      
      return self
   end
   
   
   ----------------------------
   -- Updates the splash-screen
   ----------------------------
   function o:update(dt)
      self.currentTime = self.currentTime + dt
      
      -- Make the splash-screen fade-in
      if (self.currentTime < 1.0) then
         self.fade = 1.0 - (self.currentTime / 1.0)
      
      -- Make the splash-screen fade-out
      elseif (self.currentTime > boombastic.splashDuration - 1.0) then
         self.fade = (self.currentTime - boombastic.splashDuration + 1.0) / 1.0
      
      else
         self.fade = 0.0
      end
      
      return (self.currentTime >= boombastic.splashDuration)
   end
   
   
   --------------------------
   -- Draws the splash-screen
   --------------------------
   function o:draw()
      self.splashSprite:draw(0, 0)
      self.fadeSprite:draw(0, 0, 0, 480 / 32, 272 / 32, self.fade * 255)
   end
   
   
   return o:construct()
end
