GHandle gwinGraphCreate(GGraphObject *gg, const GWindowInit *pInit) { if (!(gg = (GGraphObject *)_gwindowCreate(&gg->g, pInit, &graphVMT, 0))) return 0; gg->xorigin = gg->yorigin = 0; gg->lastx = gg->lasty = 0; gwinGraphSetStyle((GHandle)gg, &GGraphDefaultStyle); gwinSetVisible((GHandle)gg, pInit->show); return (GHandle)gg; }
GHandle gwinGGraphCreate(GDisplay *g, GGraphObject *gg, const GWindowInit *pInit) { if (!(gg = (GGraphObject *)_gwindowCreate(g, &gg->g, pInit, &graphVMT, 0))) return 0; gg->xorigin = gg->yorigin = 0; gg->lastx = gg->lasty = 0; gwinGraphSetStyle((GHandle)gg, &GGraphDefaultStyle); gwinSetVisible((GHandle)gg, pInit->show); _gwinFlushRedraws(REDRAW_WAIT); return (GHandle)gg; }
int main(void) { GHandle gh; uint16_t i; gfxInit(); { GWindowInit wi; gwinClearInit(&wi); wi.show = TRUE; wi.x = wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight(); gh = gwinGraphCreate(&g, &wi); } gwinGraphSetOrigin(gh, gwinGetWidth(gh)/2, gwinGetHeight(gh)/2); gwinGraphSetStyle(gh, &GraphStyle1); gwinGraphDrawAxis(gh); for(i = 0; i < gwinGetWidth(gh); i++) gwinGraphDrawPoint(gh, i-gwinGetWidth(gh)/2, 80*fsin(2*i/5)); //sin(2*0.2*M_PI*i/180)); gwinGraphStartSet(gh); GraphStyle1.point.color = uGreen; gwinGraphSetStyle(gh, &GraphStyle1); for(i = 0; i < gwinGetWidth(gh)*5; i++) gwinGraphDrawPoint(gh, i/5-gwinGetWidth(gh)/2, 95*fsin(2*i/5)); //sin(2*0.2*M_PI*i/180)); gwinGraphStartSet(gh); gwinGraphSetStyle(gh, &GraphStyle2); gwinGraphDrawPoints(gh, data, sizeof(data)/sizeof(data[0])); while(TRUE) { gfxSleepMilliseconds(100); } }