[mw_shl_code=c,true]#include "rtc.h"
GUI_POINT RTC_Destop_point[4]={//时钟的点
{2,113},
{2,123},
{-2,123},
{-2,113},
};
GUI_POINT RTC_Sec_point[4]={
{0,0},
{-5,-65},
{0,-80},
{5,-65},
};
WM_HWIN windows1,windows2;
//画时钟的界面
void Draw_Destop(void * pdata)
{
RTC_POINT_MODE*p=(RTC_POINT_MODE*)pdata;
GUI_SetColor(GUI_RED);
GUI_DrawCircle(130,160,125);
GUI_FillPolygon(p->
oint,countof(RTC_Destop_point),130,160);
}
//利用分片处理函数处理画图
void Contrl_Destop(void)
{
int i;
RTC_POINT_MODE s;
for(i=0;i<60;i++)
{
float angle=2*3.14-i*(3.14/30);
GUI_RECT rect={0,0,260,320};
GUI_RotatePolygon(s.Point,RTC_Destop_point,countof(RTC_Destop_point),angle);
GUI_MEMDEV_Draw(&rect,&Draw_Destop,&s,0,0);
}
}
//画图秒针
void Draw_Sec(void * pdata)
{
RTC_POINT_MODE*p=(RTC_POINT_MODE*)pdata;
GUI_Clear();
GUI_SetColor(GUI_BLUE);
GUI_FillPolygon(p->
oint,countof(RTC_Sec_point),80,80);
GUI_Exec();
}
//利用分片处理函数处理画图
void Contrl_Sec(void)
{
int i;
RTC_POINT_MODE s;
for(i=0;i<60;i++)
{
float angle=i*(3.14/30);
GUI_RECT rect={0,0,640,480};//区域
GUI_RotatePolygon(s.Point,RTC_Sec_point,countof(RTC_Sec_point),angle);
GUI_MEMDEV_Draw(&rect,&Draw_Sec,&s,0,0);
GUI_Delay(1000);
}
}
void MainTask(void)
{
windows1=WM_CreateWindow(0,0,260,320,WM_CF_SHOW,NULL,0);//刻度盘
WM_SelectWindow(windows1);
Contrl_Destop();
GUI_Exec();
windows2=WM_CreateWindow(48,78,165,165,WM_CF_SHOW,NULL,0);//秒
WM_SelectWindow(windows2);
while(1)
{Contrl_Sec();}
}[/mw_shl_code]