www.pudn.com > xiangqibiyesheji.rar > MantisChessDraw.cpp


#include "Windows.h" 
#include "math.h" 
#include "MantisChessDef.h" 
#include "MantisChessDraw.h" 
 
const float PAI=(float)3.1415927; 
const int XC[2]={BWA/2,BWA/2-1};	//XC,YC-棋子宽的一半 
const int YC[2]={BWA/2,BWA/2-2};	//[0].[1]分别为阴影和明线的偏移量 
 
void DrawStar(HDC hdc,int x,int y,int i) 
{ 
	if(x!=0) 
	{ 
		MoveToEx(hdc,XC[i]+BWA*x-3,YC[i]+BWA*y-3,NULL); 
		LineTo(hdc,XC[i]+BWA*x-6,YC[i]+BWA*y-3); 
 
		MoveToEx(hdc,XC[i]+BWA*x-3,YC[i]+BWA*y-3,NULL); 
		LineTo(hdc,XC[i]+BWA*x-3,YC[i]+BWA*y-6); 
 
		MoveToEx(hdc,XC[i]+BWA*x-3,YC[i]+BWA*y+3,NULL); 
		LineTo(hdc,XC[i]+BWA*x-6,YC[i]+BWA*y+3); 
 
		MoveToEx(hdc,XC[i]+BWA*x-3,YC[i]+BWA*y+3,NULL); 
		LineTo(hdc,XC[i]+BWA*x-3,YC[i]+BWA*y+6); 
	} 
	if(x!=8) 
	{ 
		MoveToEx(hdc,XC[i]+BWA*x+3,YC[i]+BWA*y-3,NULL); 
		LineTo(hdc,XC[i]+BWA*x+6,YC[i]+BWA*y-3); 
 
		MoveToEx(hdc,XC[i]+BWA*x+3,YC[i]+BWA*y-3,NULL); 
		LineTo(hdc,XC[i]+BWA*x+3,YC[i]+BWA*y-6); 
 
		MoveToEx(hdc,XC[i]+BWA*x+3,YC[i]+BWA*y+3,NULL); 
		LineTo(hdc,XC[i]+BWA*x+6,YC[i]+BWA*y+3); 
 
		MoveToEx(hdc,XC[i]+BWA*x+3,YC[i]+BWA*y+3,NULL); 
		LineTo(hdc,XC[i]+BWA*x+3,YC[i]+BWA*y+6); 
	} 
 
} 
 
void MakeWood(HDC hdc, int cx, int cy, COLORREF color, int x0, int y0, int z0, float angle0,int dark) 
{ 
	int i,j; 
	FLOAT r,angle,u,v,w; 
 
	for( j=0;j