static const GUI_POINT _aNeedle_0[] = {
{ MAG * ( 0), MAG * ( 0 )},
{ MAG * (-3), MAG * (10 )},
{ MAG * (-3), MAG * (60)},
{ MAG * ( 3), MAG * (60 )},
{ MAG * ( 3), MAG * (10 )},
};
typedef struct {
GUI_AUTODEV_INFO AutoDevInfo;
GUI_POINT aPoints[7];
float Angle;
} PARAM;
void _Draw_0(void * p) {
PARAM * pParam = (PARAM *)p;
GUI_SetColor(GUI_RED);
GUI_AA_FillPolygon(pParam->aPoints, countof(_aNeedle_0), MAG * 150, MAG * 180);
}
void GUIDEMO_A(void) {
int t0=27000 ;
PARAM Param;
GUI_AUTODEV AutoDev;
GUI_MEMDEV_Handle hMem;
GUI_AA_EnableHiRes();
GUI_AA_SetFactor(MAG);
GUI_MEMDEV_CreateAuto(&AutoDev);
while (1)
{
t0-= 100;
if(t0 < 17000)
{
t0 = 27000;
}
Param.Angle= t0;
Param.Angle *= 3.1415926f / 18000;
GUI_RotatePolygon(Param.aPoints, _aNeedle_0, countof(_aNeedle_0), Param.Angle);
GUI_MEMDEV_DrawAuto(&AutoDev, &
aram.AutoDevInfo, _Draw_0, &
aram);
}
}
static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
{ WINDOW_CreateIndirect, "Window", ID_WINDOW_0, 0, 0, 800, 480, 0, 0x64, 0 },
};
static void _cbDialog(WM_MESSAGE * pMsg) {
switch (pMsg->MsgId) {
case WM_PAINT:
break;
case WM_NOTIFY_PARENT:
GUIDEMO_A();
break;
default:
WM_DefaultProc(pMsg);
}
}
void MainTask(void)
{
/* 初始化并创建对话框 */
GUI_Init();
WM_SetCreateFlags(WM_CF_MEMDEV);
hWinMain= GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
while(1)
{
GUI_Delay(20);
}
}