//
//  IntroMenu.cpp
//  GlobalGameJam15
//
//  Created by Cesar Parent on 25/01/2015.
//  Copyright (c) 2015 Cesar Parent. All rights reserved.
//

#include "IntroMenu.h"
#include "Defines.h"
#include "DungeonGame.h"


IntroMenu::IntroMenu(Game& game) : Layer(game, kGameWidth/2, kGameHeight/2)
{
	setAnchorPoint(0, 0);
	setPosition(0, 0);
	
	_background = new SpriteNode("assets/uis/intro.png");
	_background->setAnchorPoint(0, 0);
	_background->setPosition(0, 0);
	addChild(_background);
}

IntroMenu::~IntroMenu()
{
	delete _background;
}

void IntroMenu::didBecomeChild()
{
	Controls::setDelegate(this);
}

void IntroMenu::didExitParent()
{
	delete this;
}

void IntroMenu::controllerButtonPressBegan(int controller, SDL_GameControllerButton button)
{
	((DungeonGame*)_parent)->finishedIntro();
	removeFromParent();
}

void IntroMenu::keyboardPressBegan(SDL_Scancode key)
{
	((DungeonGame*)_parent)->finishedIntro();
	removeFromParent();
}