//	Wall.cpp - The wall class.
//  ----------------------------------------------------------------------------
//	This file is part of 'NiallsAVLib', base code for any kind of audiovisual
//	apps.
//	Copyright (C) 2012  Niall Moody
//	
//	This program is free software: you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program.  If not, see <http://www.gnu.org/licenses/>.
//	----------------------------------------------------------------------------

#include "drawing/Drawer.h"
#include "MiscHelper.h"
#include "Wall.h"

//------------------------------------------------------------------------------
Wall::Wall(const TwoFloats& pos):
Collidable(L"Wall"),
position(pos),
colour(0.1875f)
{
	
}

//------------------------------------------------------------------------------
Wall::~Wall()
{

}

//------------------------------------------------------------------------------
void Wall::update(const TwoFloats& arenaTopLeft,
			    const TwoFloats& arenaBottomRight)
{
	
}

//------------------------------------------------------------------------------
void Wall::drawBack(shared_ptr<Drawer>& d,
					float timestepInterp,
					const ThreeFloats& leftCol,
					const ThreeFloats& rightCol)
{
	const float interp(position.x/d->getDrawingAreaSize().x);
	ThreeFloats col(rightCol * interp);

	col += leftCol * (1.0f-interp);

	d->drawImage(L"WallBack", position-21.0f, 1.0f, col);
}

//------------------------------------------------------------------------------
void Wall::drawTop(shared_ptr<Drawer>& d,
				   float timestepInterp,
				   const ThreeFloats& borderCol)
{
	d->drawImage(L"WallTop", position-18.0f, 1.0f, borderCol);
}

//------------------------------------------------------------------------------
void Wall::setPosition(const TwoFloats& pos)
{
	position = pos;
}

//------------------------------------------------------------------------------
bool Wall::interestedInCollisionsWith(const std::wstring& entity) const
{
	return (entity != L"Wall");
}

//------------------------------------------------------------------------------
bool Wall::collide(const shared_ptr<Collidable>& other,
				   GamePlayState& state)
{
	return false;
}
