[ucgui] 仪表盘函数
1 /* 2 仪表盘 3 */ 4 void DrawArcScale(void) 5 { 6 int x0 = 160; 7 int y0 = 180; 8 int i; 9 char ac[4]; 10 GUI_SetBkColor(GUI_WHITE); 11 GUI_Clear(); 12 GUI_SetPenSize( 5 ); 13 GUI_SetTextMode(GUI_TM_TRANS); 14 GUI_SetFont(&GUI_FontComic18B_ASCII); 15 GUI_SetColor( GUI_BLACK ); 16 GUI_DrawArc( x0,y0,150, 150,-30, 210 ); 17 //GUI_Delay(1000); 18 for (i=0; i<= 23; i++) 19 { 20 float a = (-30+i*10)*3.1415926/180; 21 int x = -141*cos(a)+x0; 22 int y = -141*sin(a)+y0; 23 if (i%2 == 0) 24 GUI_SetPenSize( 5 ); 25 else 26 GUI_SetPenSize( 4 ); 27 GUI_DrawPoint(x,y); 28 if (i%2 == 0) 29 { 30 x = -123*cos(a)+x0; 31 y = -130*sin(a)+y0; 32 sprintf(ac, "%d", 10*i); 33 GUI_SetTextAlign(GUI_TA_VCENTER); 34 GUI_DispStringHCenterAt(ac,x,y); 35 } 36 } 37 }