
#include "Common.h"

//------------------------------------------------------------
// LATTICE PARAMETERS
//------------------------------------------------------------
float       g_spacing = 5.0f;
D3DXVECTOR2 g_origin = D3DXVECTOR2(0.0f,0.0f);
D3DXVECTOR2 g_dir[6] = {g_spacing * D3DXVECTOR2(1,0),
						g_spacing * D3DXVECTOR2(cos(1*D3DX_PI/3),sin(1*D3DX_PI/3)),
						g_spacing * D3DXVECTOR2(cos(2*D3DX_PI/3),sin(2*D3DX_PI/3)),
						g_spacing * D3DXVECTOR2(-1,0),
						g_spacing * D3DXVECTOR2(cos(4*D3DX_PI/3),sin(4*D3DX_PI/3)),
						g_spacing * D3DXVECTOR2(cos(5*D3DX_PI/3),sin(5*D3DX_PI/3))};

BYTE g_PosFlags[6] = {POS_ZERO, POS_ONE, POS_TWO, POS_THREE, POS_FOUR, POS_FIVE};
BYTE g_FilledFlags[6] = { 0x01,
						  0x03,
						  0x07,
						  0x0f,
						  0x1f,
						  0x3f };


//------------------------------------------------------------
// Clock
//------------------------------------------------------------
Clock::Clock(int T)
{
	count  = 0;
	period = T;
}

int Clock::getTime()
{
	static int old;
	old = count;
	if(++count > period)
		count = 0;
	return old;
}

float Clock::getFraction()
{
	return (float)count/(float)period;
}

int Clock::getPeriod()
{
	return period;
}

void Clock::SlowDown()
{
	period++;
}

void Clock::SpeedUp()
{
	period--;
}