该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
//struct
typedef struct
{
int x0;
int y0;
int x1;
int y1;
int x00;
int y00;
int x11;
int y11;
double cnt;
double step;
int r;
}NeedlePOS;
typedef struct
{
float H;
float S;
float L;
float changestep;
}HSLVAR;
NeedlePOS Needlesec, NeedleMinu, NeedleHour;
HSLVAR Chgcolor;
//variable
char secflag = 0;
char startflag = 0xff;
//画出钟的框架
void DrawTimeFrame(void)
{
int x0, y0, x1, y1, x2, y2;
double i, step = PI / 30.;
int cnt = 0, dispcnt = 0;
char s[3];
setlinestyle(PS_SOLID, 2);
circle(240, 240, 200);
for (i = PI / 2.; i < 2 * PI + PI / 2.; i += step)
{
cnt++;
x0 = (int)(240 - 200 * cos(i));
x1 = (int)(240 - 190 * cos(i));
y0 = (int)(240 - 200 * sin(i));
y1 = (int)(240 - 190 * sin(i));
x2 = (int)(240 - 220 * cos(i));
y2 = (int)(240 - 220 * sin(i));
if (fabs(i - PI / 2.) < EPSILON)
{
x1 = (int)(240 - 170 * cos(i));
y1 = (int)(240 - 170 * sin(i));
line(x0, y0, x1, y1);
circle(x0, y0, 3);
sprintf(s, "%d", 12);
outtextxy(x2 - 6, y2, s);
cnt = 1;
dispcnt++;
}
else if (fabs(i - PI) < EPSILON)
{
x1 = (int)(240 - 170 * cos(i));
y1 = (int)(240 - 170 * sin(i));
line(x0, y0, x1, y1);
circle(x0, y0, 3);
sprintf(s, "%d", 3);
outtextxy(x2 - 3, y2 - 8, s);
cnt = 1;
dispcnt++;
}
else if (fabs(i - 1.5*PI) < EPSILON)
{
x1 = (int)(240 - 170 * cos(i));
y1 = (int)(240 - 170 * sin(i));
line(x0, y0, x1, y1);
circle(x0, y0, 3);
sprintf(s, "%d", 6);
outtextxy(x2 - 3, y2 - 8, s);
cnt = 1;
dispcnt++;
}
else if (fabs(i - 2 * PI) < EPSILON)
{
x1 = (int)(240 - 170 * cos(i));
y1 = (int)(240 - 170 * sin(i));
line(x0, y0, x1, y1);
circle(x0, y0, 3);
sprintf(s, "%d", 9);
outtextxy(x2, y2 - 8, s);
cnt = 1;
dispcnt++;
}
else
{
if (cnt % 6 == 0)
{
x1 = (int)(240 - 170 * cos(i));
y1 = (int)(240 - 170 * sin(i));
line(x0, y0, x1, y1);
circle(x0, y0, 3);
sprintf(s, "%d", dispcnt++);
outtextxy(x2, y2 - 8, s);
cnt = 1;
}
else
{
line(x0, y0, x1, y1);
circle(x0, y0, 3);
}
}
}
}