#include "stdafx.h"
#include "TouchButton.h"

#include "CellWarsGameManager.h"
#include "CellWarsMTManager.h"

TouchButton::TouchButton(CellWarsMTManager *useThisMultiTouchManager) : 
Actor(), Touchable(useThisMultiTouchManager)
{
	useThisMTManager = useThisMultiTouchManager;

	SetColor(1,1,1,1);
	ClearSpriteInfo();
	SetSize(1);
	SetName("TouchButton");
	theWorld.Add(this, LayerEnum::FormControls);

	setPriorityLevel(2);
	//fingerOnThisWholeTime = true;
}

TouchButton::~TouchButton()
{
}

void TouchButton::ReceiveMessage(Message *m)
{
	Actor::ReceiveMessage(m);
}

void TouchButton::Render()
{
	Actor::Render();
}

void TouchButton::Update(float dt)
{
	Actor::Update(dt);
}

void TouchButton::fingerDown(Vector2 posDownInAngelCoords)
{
	Touchable::fingerDown(posDownInAngelCoords);
	click();
	//fingerOnThisWholeTime = true;
}

void TouchButton::fingerMove(Vector2 moveToInAngelCoords)
{
	Touchable::fingerMove(moveToInAngelCoords);
	//Vector2 dist(moveToInAngelCoords - GetPosition());
	//if (dist.Length() > GetSize().X)
	//	fingerOnThisWholeTime = false;
}

void TouchButton::fingerUp(Vector2 lastPosInAngelCoords)
{
	Touchable::fingerUp(lastPosInAngelCoords);
	//if (fingerOnThisWholeTime)
	//	click();
}