
void draw(struct shape temp, int i, int a, int b, int c, int p)
{	
	int n, m;
	switch(p)
	{
	case 1:
		m=2+a+(screen_width/2)-((width)-2);
		n=b+(screen_height/2)-((height)/2);
		break;
	case 2:
		m=3+a+1+(screen_width/2)+((2*width)+2);
		n=b+(screen_height/2)-((height)/2);
		break;
	case 3:
		m=9+a+(screen_width/2)-((width)/2);
		n=b+(screen_height/2)-((height)/2);
		break;
	default:
		m=12+a+(screen_width/2)-((width)/2);
		n=b+(screen_height/2)-((height)/2);
		break;
	}

	
	if(i>3)
	{
		for(int y=0;y<4;y++)
		{
			for(int x=0;x<4;x++)
			{
				if(temp.rotation[i-4][y][x]==1)
				{
					put(play_char, x+m-1,y+n-1,play_colour);
				}
			}
		}
	}
	else
	{
		for(int y=0;y<4;y++)
		{
			for(int x=0;x<4;x++)
			{
				if(temp.rotation[i][y][x]==1)
				{
					put(block_char, x+m-1,y+n-1,c);
				}
			}
		}
	}
}
void draw_play(int p)
{
	int temp1[100][100];
	int m, n, a, b;


	switch(p)
	{
	case 1:
		a = 2+(screen_width/2)-(width-2);
		b = (screen_height/2)-(height/2)+1;
		for(m=0;m<100;m++)
		{
			for(n=0;n<100;n++)
			{
				temp1[n][m] = 0;
				temp1[n][m] = player1.play[n][m];
			}
		}
		break;
	case 2:
		a = 3+1+(screen_width/2)+((2*width)+2);
		b = (screen_height/2)-(height/2)+1;
		for(m=0;m<100;m++)
		{
			for(n=0;n<100;n++)
			{
				temp1[n][m] = player2.play[n][m];
			}
		}
		break;
	case 3:
		a = 16+(screen_width/2)-(width-2);
		b = (screen_height/2)-(height/2)+1;
		for(m=0;m<100;m++)
		{
			for(n=0;n<100;n++)
			{
				temp1[n][m] = 0;
				temp1[n][m] = player1.play[n][m];
			}
		}

		break;
	default:
		a = 12+(screen_width/2)-(width/2);
		b = (screen_height/2)-(height/2)+1;
		for(m=0;m<100;m++)
		{
			for(n=0;n<100;n++)
			{
				temp1[n][m] = player1.play[n][m];
			}
		}
		break;
	}
//a=5; b=5;
	for(int y=0;y<height;y++)
	{
		for(int x=0;x<width+3;x++)
		{

			if(temp1[x][y]>0)
			{				
				put(block_char, x+a-1, y+b, temp1[x][y]);
			}
			else
			{
				put(play_char, x+a-1, y+b, play_colour);

			}
		}
	}
}
void draw_screen(int n)
{
//	menu();
	int col=playbox_fore;
	int col2=playbox_back;
	if(n==0)
	{
	
	int a = 12+(screen_width/2)-((width+2)/2)-1;
	int b = (screen_height/2)-((height+2)/2);
	int c = 12+(screen_width/2)+((width+2)/2)+2;
	int d = (screen_height/2)+((height+2)/2);

	box(a,b,c,d,col, play_char, playbox_type);
	box(a-9, b, a-2, b+8, col, play_char, playbox_type);
	}
	else
	{
	if(n==3)
	{
	int a = 16+(screen_width/2)-((width));
	int b = (screen_height/2)-((height+2)/2);
	int c = a+width+4;
	int d = (screen_height/2)+((height+2)/2);
	box(a,b,c,d,col, play_char, playbox_type);
	box(a-9, b, a-2, b+8, col, play_char, playbox_type);
	box(c+2,b,c+9,b+8,col, play_char, playbox_type);
	}
	else
	{
	int a = 2+(screen_width/2)-((width));
	int b = (screen_height/2)-((height+2)/2);
	int c = a+width+4;
	int d = (screen_height/2)+((height+2)/2);
	int e = 3+(screen_width/2)+((2*width));
	int f = (screen_height/2)-((height+2)/2);
	int g = e+width+4;
	int h = (screen_height/2)+((height+2)/2);

	box(a,b,c,d,col, play_char, playbox_type);
	box(a-9, b, a-2, b+8, col, play_char, playbox_type);
	box(e+1,f,g+1,h,col, play_char, playbox_type);
	box(e-8, f, e-1, f+8, col, play_char, playbox_type);

	}
	}
}
void draw_tab(int selek, int c)
{
	put(char(218),1, 6+(9*selek), c); 
	put(char(192),1, 15+(9*selek), c); 
	hline(2, 6+(9*selek), 20, c);
	hline(2, 15+(9*selek), 20, c);
	vline(1, 7+(9*selek), 8, c);
	vline(22, 7+(9*selek), 9, 0);
	if(c>0)
	{
	if(selek<3)
	{
		put(char(191), 22, 15+(9*selek), c);
		put(char(192), 22, 42, c);
	}
	else
		put(char(196), 22, 15+(9*selek), c);
	if(selek>0)
	{
		put(char(217), 22, 6+(9*selek), c);
		put(char(218), 22, 6, c);
	}

	else
		put(char(196), 22, 6+(9*selek), c);
	}
	else
	{
	if(selek==0)
	{
		put(background_char, 22, 15+(9*selek), c);
		put(background_char, 22, 42, c);
	}
	else
		put(background_char, 22, 15+(9*selek), c);
	if(selek>0)
	{
		put(background_char, 22, 6+(9*selek), c);
		put(background_char, 22, 6, c);
	}

	else
		put(background_char, 22, 6+(9*selek), c);
	}

}

