from os import path

from PodSix.Resource import *
from PodSix.Game import Game

class SplashScreen(Game, EventMonitor):
	def __init__(self):
		gfx.Caption("PodSix Video Games")
		gfx.SetSize([640, 480])
		splashfile = ["PodSix", "resources", "splash.png"]
		if not path.isfile(path.join(*splashfile)):
			splashfile.pop(0)
		self.splash = pygame.image.load(path.join(*splashfile))
		sfx.LoadSound('splash')
		sfx.PlaySound('splash')
		Game.__init__(self)
		EventMonitor.__init__(self)
		self.elapsed = 0
	
	def Pump(self):
		Game.Pump(self)
		EventMonitor.Pump(self)
	
	def Run(self):
		gfx.screen.blit(self.splash, [0, 0])
		Game.Run(self)
		gfx.Flip()
		self.elapsed += self.Elapsed()
		if self.elapsed > 0.2:
			self.Quit()
	
	def KeyDown_escape(self, e):
		self.Quit()

