|

楼主 |
发表于 2016-3-17 12:34:33
|
显示全部楼层
回 eric2013 的帖子
#include "GUI.h"
#include "math.h"
#include "stdio.h"
#define countof(Array) (sizeof(Array)/sizeof(Array[0]))
static GUI_POINT _aPointer[] = {
{ 0, 3},
{85, 1},
{90, 0},
{85, -1},
{ 0, -3}
};
typedef struct {
GUI_AUTODEV_INFO AutoInfo;
GUI_POINT aPoints[countof(_aPointer)];
}PARAM;
static void _Draw(void * p) {
PARAM * pParam = (PARAM *)p;
if (pParam->AutoInfo.DrawFixed) {
//GUI_ClearRect(60, 60, 259, 159);
GUI_SetColor(GUI_BLACK);
GUI_FillCircle(165,155,92);
}
GUI_SetColor(GUI_WHITE);
GUI_AA_FillPolygon(pParam->aPoints, countof(_aPointer), 165, 155);
}
static void _ShowHiresAntialiasing(){
GUI_AUTODEV aAuto;
PARAM Param;
int i = 0;
int x0 = 165;
int y0 = 155;
char ac[4];
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
GUI_SetColor(GUI_WHITE);
GUI_SetPenSize(4);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_SetFont(&GUI_FontComic18B_ASCII);
GUI_DrawArc( x0,y0,135, 135, 0, 180);
GUI_Delay(10);
for(i = 0;i<19;i++){
float a = i*10*3.1415926/180;
int x = -125*cos(a) + x0;
int y = -125*sin(a) + y0;
if(i%2 == 0)
GUI_SetPenSize(5);
else
GUI_SetPenSize(4);
GUI_DrawPoint(x,y);
if(i%2 == 0){
x = -100*cos(a) + x0;
y = -110*sin(a) + y0;
sprintf(ac, "%d", i*10);
GUI_SetTextAlign(GUI_TA_VCENTER);
GUI_DispStringHCenterAt(ac, x, y);
}
}
GUI_MEMDEV_CreateAuto(&aAuto);
while(1) {
for (i = 0; i < 180; i++) {
float Angle = i;
Angle *= 3.1415926f / 180;
GUI_RotatePolygon(Param.aPoints, _aPointer, countof(_aPointer), Angle);
GUI_MEMDEV_DrawAuto(&aAuto, & aram.AutoInfo, _Draw, & aram);
GUI_Delay(50);
}
}
}
void MainTask(void) {
GUI_Init();
_ShowHiresAntialiasing();
while(1) {
GUI_Delay(100);
}
} |
|