#include <cmath>
enum Align { TLeft = 0, TCent, TRight };
void MyDrawText(HDC hDC, char *Text, int x, int y, int w, int h, int align)
{
	RECT rct = { 0, 0, 0, 0 };
	SetRect(&rct, x, y, int(x + w) + 4, int(y + h));
	switch(align)
	{
	case TLeft:	DrawText(hDC, Text, -1, &rct, DT_SINGLELINE | DT_VCENTER | DT_LEFT);	break;
	case TCent:	DrawText(hDC, Text, -1, &rct, DT_SINGLELINE | DT_VCENTER | DT_CENTER);	break;
	default:	DrawText(hDC, Text, -1, &rct, DT_SINGLELINE | DT_VCENTER | DT_RIGHT);	break;
	}
}
void MyDrawText(HDC hDC, string Text, int x, int y, int w, int h, int align)
{
	char *tmp;
	tmp = new char[int(Text.length()) + 1];
	sprintf(tmp, "%s", Text.c_str());
	tmp[int(Text.length())] = '\0';
	RECT rct = { 0, 0, 0, 0 };
	SetRect(&rct, x, y, int(x + w) + 4, int(y + h));
	switch(align)
	{
	case TLeft:	DrawText(hDC, tmp, -1, &rct, DT_SINGLELINE | DT_VCENTER | DT_LEFT);	break;
	case TCent:	DrawText(hDC, tmp, -1, &rct, DT_SINGLELINE | DT_VCENTER | DT_CENTER);	break;
	default:	DrawText(hDC, tmp, -1, &rct, DT_SINGLELINE | DT_VCENTER | DT_RIGHT);	break;
	}
	delete [] tmp;
}
void MyDrawMultiLineText(HDC hDC, string Text, int x, int y, int w, int h)
{
	RECT rct = { 0, 0, 0, 0 };
	//Modifying dimensions to give some padding by default - M. White 28 July, 2019
	SetRect(&rct, x + 4, y + 4, int(x + w) - 4, int(y + h) - 4);
	DrawText(hDC, Text.c_str(), -1, &rct,  DT_WORDBREAK | DT_LEFT);
}
void plySnd(char *FileName)
{
	string Temp = ""; /*Temp = "SoundRPC\\";*/ Temp += FileName;
	PlaySound(Temp.c_str(), NULL, SND_ASYNC | SND_FILENAME);
}
void plySndSync(char *FileName)
{
	string Temp = ""; /*Temp = "SoundRPC\\";*/ Temp += FileName;
	PlaySound(Temp.c_str(), NULL, SND_SYNC | SND_FILENAME);
}
float getRange(int x1, int y1, int x2, int y2) 
{ 
    // Calculating distance 
    return float(sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2) * 1.0)); 
}
//	int VRD(int StartingY, int MouseY, int Divisor)
//	{
//		/*
//		This function replaces all of the times that an index has to be generated according to
//		where the User is pointing the mouse to select an item out of a list. This function 
//		takes the Rectangle in question, gets the difference between the MouseY location and 
//		the top of the rect, and returns an integer based upon the divisor. 
//		
//		Any modifications by offset should be done calculated before being passed in - M. White 24 May, 2019
//		*/
//		int returnValue;
//		if(Divisor != 0)	returnValue = int((MouseY - StartingY) / double(Divisor));
//		else				returnValue = 0;
//		return returnValue;
//	}