- 注册时间
- 2004-12-31
- 最后登录
- 1970-1-1
|
以下内容为程序代码:
struct TIME
{
int year;
char month;
char day;
char hour;
char minute;
char second;
char week;
};
int size = 30;
struct TIME theTime;
char dateBuf[20];
char week[][3]={"日","一","二","三","四","五","六"};
// 画表盘
void DrawFace(int x, int y)
{
int i;
Circle(x, y, size, 0, 0x41);
for(i=0; i<12; i++)
{
Line(x+Cos(30*i)*(size*7/8)/1024,
y+Sin(30*i)*(size*7/8)/1024,
x+Cos(30*i)*(size)/1024,
y+Sin(30*i)*(size)/1024,
0x41);
}
Refresh();
}
// 画指针
void DrawFinger(int x, int y)
{
GetTime(theTime);
Circle(x, y, size*3/4, 1, 0x40);
// 秒针
Line(x,
y,
x+Sin(6*theTime.second)*(size*3/4)/1024,
y-Cos(6*theTime.second)*(size*3/4)/1024,
0x41);
// 分针
Line(x,
y,
x+Sin(6*theTime.minute)*(size*2/3)/1024,
y-Cos(6*theTime.minute)*(size*2/3)/1024,
0x41);
// 时针
Line(x,
y,
x+Sin(30*theTime.hour+theTime.minute/2)*(size*2/5)/1024,
y-Cos(30*theTime.hour+theTime.minute/2)*(size*2/5)/1024,
0x41);
Refresh();
}
// 显示日期
void DrawDate(int x, int y)
{
Block(x, y, x+strlen(dateBuf)*6, y+12, 0);
sprintf(dateBuf, "%d年%d月%d日 星期%s",
theTime.year,
theTime.month,
theTime.day,
week[theTime.week]);
TextOut(x, y, dateBuf, 1);
Refresh();
}
void main()
{
do{
DrawFace(80, 32);
DrawFinger(80, 32);
DrawDate(30, 66);
}while(!CheckKey(27));
},就是这段代码,模拟器上运行正常,而在800上则不正常,什么原因,高手可否回答一下??? |
|