import os

# 3rd party python modules.
import pygame
pygame.init()

# Own modules.
from game.classes.Preferences import *
from game.components import helpers
from game.components import object_creation
from game.classes.BG_Image import BG_Image
from game.classes.ButtonMenu import ButtonMenu

def run( playground, clock, jukebox ):

	# Set up the labels.
	labels = object_creation.create_labels( INSTRUCTIONS_MENU["labels"] )
	# Set up a few buttons.
	buttons = object_creation.create_buttons( INSTRUCTIONS_MENU["buttons"] )
	button_menu1 = ButtonMenu( buttons )

	# Load the background image.
	bg_image = BG_Image( OPTION_SCREEN_IMAGE, ( SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2 ), 50 )

	running = True
	while running:
		events = pygame.event.get()
		if helpers.user_quit( events ):
			return False		
		playground.fill( WHITE )

		# Update buttons
		choice = button_menu1.update( events )
		if choice is not None:
			running = False

		# Blit the background image.
		playground.blit( bg_image.image, bg_image.rect )

		# Draw labels.
		labels.draw( playground )
		# Draw buttons.
		buttons.draw( playground )
		
		pygame.display.update()
		clock.tick( FPS )
		
		# Music still playing?
		jukebox.still_playing()		
