📄 time1.c
字号:
/*以下为时间显示函数。*/
#define clockx 966
#define clocky 730
#define clockred 4
#define clockgreen 88
#define clockblue 235
#define clockbkred 128
#define clockbkgreen 255
#define clockbkblue 255
struct Ctime{
char hour[3];
char min[3];
char second[3];
};
struct time timer,timer1;
struct Ctime ctimer;
void showtime(int x,int y,int red,int green,int blue){
struct time *timep;
timep=&amt;timer;
gettime(timep);
trans_int_to_char(timer.ti_hour,ctimer.hour);
trans_int_to_char(timer.ti_min,ctimer.min);
trans_int_to_char(timer.ti_sec,ctimer.second);
DisplayAscS(ctimer.hour,x,y,red,green,blue,-6,0,1);
DisplayAscS(ctimer.min,x+28,y,red,green,blue,-6,0,1);
DisplayAscS(ctimer.second,x+56,y,red,green,blue,-6,0,1);
DisplayAscC(':',x+20,y,red,green,blue,0,1);
DisplayAscC(' ',x+48,y,red,green,blue,0,1);
}
void updatetime(){
struct time *timep;
timep=&amt;timer1;
gettime(timep);
if(timer1.ti_hour!=timer.ti_hour)
{
DisplayAscS(ctimer.hour,clockx,clocky,clockbkred,clockbkgreen,clockbkblue,-6,0,1);
timer.ti_hour=timer1.ti_hour;
trans_int_to_char(timer.ti_hour,ctimer.hour);
DisplayAscS(ctimer.hour,clockx,clocky,clockred,clockgreen,clockblue,-6,0,1);
}
if(timer1.ti_min!=timer.ti_min)
{
DisplayAscS(ctimer.min,clockx+28,clocky,clockbkred,clockbkgreen,clockbkblue,-6,0,1);
timer.ti_min=timer1.ti_min;
trans_int_to_char(timer.ti_min,ctimer.min);
DisplayAscS(ctimer.min,clockx+28,clocky,clockred,clockgreen,clockblue,-6,0,1);
}
if(timer1.ti_sec!=timer.ti_sec)
{
DisplayAscS(ctimer.second,clockx+56,clocky,clockbkred,clockbkgreen,clockbkblue,-6,0,1);
timer.ti_sec=timer1.ti_sec;
trans_int_to_char(timer.ti_sec,ctimer.second);
DisplayAscS(ctimer.second,clockx+56,clocky,clockred,clockgreen,clockblue,-6,0,1);
}
}
#define flower1x 365
#define flower1y 210
#define flower2x 515
#define flower2y 204
#define delaytime 80000000
char *face1="face1.bmp",*flower="flower.bmp",*toolbar="toolbar.bmp";
char *hualei="hualei.bmp",*halfhua="halfhua.bmp",*halfhua1="halfhua1.bmp";
char *cs1="查询",*cs2="管理";
unsigned char Mred,Mgreen,Mblue;
void SmoothMoving(int x,int y,int length,int width,int mdistance){
unsigned char bkred=0,bkgreen=0,bkblue=0; /*这个函数完成一块单色矩形区域的无闪烁平移。其中:length=right-left,*/
unsigned char sred,sgreen,sblue,k=0; /* width=bottom-top.在调用前要设置好bkcolor背景色和Mcolor运动色的颜色值。*/
int sx=x,i,j;
for(j=0;j<mdistance;j++)
{
for(i=0;i<width;i++)
{
for(;sx<x+length;sx++)
{
getpixel(sx,y+i,&amt;sred,&amt;sgreen,&amt;sblue);
if(k==0)
if(sred==Mred&amt;&amt;sgreen==Mgreen&amt;&amt;sblue==Mblue)
{
exputpixel(sx-1,y+i,Mred,Mgreen,Mblue,0);
k=1;
}
if(k==1)
if(sred==bkred&amt;&amt;sgreen==bkgreen&amt;&amt;sblue==bkblue)
{
exputpixel(sx-1,y+i,bkred,bkgreen,bkblue,0);
k=0;
}
}
sx=x;
}
--x;
sx=x;
}
}
/*这是一个很有效的延时函数。可以延时小于一秒的时间。sleep的延时只能是1秒以上。*/
void Mdelay(int time){
int i=0;
for(i=0;i<time;i++)
{
delay(800);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -