#!/usr/bin/env python

import sys, pygame, random, os
from helpers import *
from ActivityGenerator import *
pygame.init()

# Set up the window
windowsize = windowwidth, windowheight = 1000,700
screen = pygame.display.set_mode(windowsize)
area = screen.get_rect()
background,background_rect = load_image("lorasbackground copy.png")

# Set up the activity generator
activity = ActivityGenerator(background)

# Start screen
start_game = False
while not start_game:
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			sys.exit() # if the user closed the window, quit the game
		elif event.type == pygame.KEYDOWN: # if the user pressed a key
			start_game = True # start the game
		
	#Draw everything to the screen
	screen.blit(background, (0,0))
	
	#Draw Instructions
	font = pygame.font.Font(None, 25)
	text = font.render("Press Any Key to Start.",1,(225,225,225))
	textrect = text.get_rect()
	textrect.centerx,textrect.centery = windowwidth/2,windowheight/2+300
	screen.blit(text,textrect)
	
	font = pygame.font.Font(None, 45)
	text = font.render("...try and guess the image's name before all tiles disappear.",1,(225,225,225))
	textrect = text.get_rect()
	textrect.centerx,textrect.centery = windowwidth/2,windowheight/2+50
	screen.blit(text,textrect)
	
	font = pygame.font.Font(None, 45)
	text = font.render("As Facts pop up the tiles will disappear...",1,(225,225,225))
	textrect = text.get_rect()
	textrect.centerx,textrect.centery = windowwidth/2,windowheight/2
	screen.blit(text,textrect)
	
	pygame.display.flip()

# Main game play
while True:
	# Check to see if the user has clicked the mouse or pressed a key
	for event in pygame.event.get():
		if event.type == pygame.QUIT:
			sys.exit()

	question = "What is the image's name?"
	answer_choices = ["Australia","Africa","North Pole","Texas","Antartica"]
	correct_answer = "a"
	activity.play(question,answer_choices,correct_answer)

	# Draw everything to the screen
	screen.blit(background,(0,0))
	pygame.display.flip()
