#include "controls.h"

Mouse::Mouse(void)
{
	for (int i=0; i<3; ++i)
	{
		this->pressedButtons[i]=false;
	}

	this->prevPos[0]=0;
	this->prevPos[1]=0;

	this->pos[0]=0;
	this->pos[1]=0;

	this->wheel=0;
}
void Mouse::setPosX( int posX )
{
	this->prevPos[0] = this->pos[0];
	this->pos[0] = posX;
}
void Mouse::setPosY( int posY )
{
	this->prevPos[1] = this->pos[1];
	this->pos[1] = posY;
}
void Mouse::setPos( int posX, int posY )
{
	this->setPosX( posX );
	this->setPosY( posY );
}
int Mouse::getPosX(void)
{
	return this->pos[0];
}
int Mouse::getPosY(void)
{
	return this->pos[1];
}
int Mouse::getPrevPosX(void)
{
	return this->prevPos[0];
}
int Mouse::getPrevPosY(void)
{
	return this->prevPos[1];
}
int Mouse::getDiffX(void)
{
	return this->pos[0] - this->prevPos[0];
}
int Mouse::getDiffY(void)
{
	return this->pos[1] - this->prevPos[1];
}

void Mouse::clearDiffX(void)
{
	this->prevPos[0] = this->pos[0];
}
void Mouse::clearDiffY(void)
{
	this->prevPos[1] = this->pos[1];
}
void Mouse::clearDiff(void)
{
	this->clearDiffX();
	this->clearDiffY();
}

Keyboard::Keyboard(void)
{
}
void Keyboard::clear(void)
{
	this->pressedKeys.clear();
}
void Keyboard::pressKey(unsigned int key)
{
	this->pressedKeys.push_back( key );
}
void Keyboard::releaseKey( unsigned int key)
{
	this->pressedKeys.remove( key );
}
unsigned int Keyboard::isPressed(unsigned int key)
{
	return count( this->pressedKeys.begin(), this->pressedKeys.end(), key );
}


