using GFX_PI instead of M_PI in graph demo

This commit is contained in:
Joel Bodenmann 2017-09-26 14:47:36 +02:00
parent 2513b54e71
commit 8219311877

View File

@ -77,25 +77,25 @@ int main(void) {
wi.height = gdispGetHeight(); wi.height = gdispGetHeight();
gh = gwinGraphCreate(0, &wi); gh = gwinGraphCreate(0, &wi);
} }
// Set the graph origin and style // Set the graph origin and style
gwinGraphSetOrigin(gh, gwinGetWidth(gh)/2, gwinGetHeight(gh)/2); gwinGraphSetOrigin(gh, gwinGetWidth(gh)/2, gwinGetHeight(gh)/2);
gwinGraphSetStyle(gh, &GraphStyle1); gwinGraphSetStyle(gh, &GraphStyle1);
gwinGraphDrawAxis(gh); gwinGraphDrawAxis(gh);
// Draw a sine wave // Draw a sine wave
for(i = 0; i < gwinGetWidth(gh); i++) { for(i = 0; i < gwinGetWidth(gh); i++) {
gwinGraphDrawPoint(gh, i-gwinGetWidth(gh)/2, 80*sin(2*0.2*M_PI*i/180)); gwinGraphDrawPoint(gh, i-gwinGetWidth(gh)/2, 80*sin(2*0.2*GFX_PI*i/180));
} }
// Modify the style // Modify the style
gwinGraphStartSet(gh); gwinGraphStartSet(gh);
GraphStyle1.point.color = Green; GraphStyle1.point.color = Green;
gwinGraphSetStyle(gh, &GraphStyle1); gwinGraphSetStyle(gh, &GraphStyle1);
// Draw a different sine wave // Draw a different sine wave
for(i = 0; i < gwinGetWidth(gh)*5; i++) { for(i = 0; i < gwinGetWidth(gh)*5; i++) {
gwinGraphDrawPoint(gh, i/5-gwinGetWidth(gh)/2, 95*sin(2*0.2*M_PI*i/180)); gwinGraphDrawPoint(gh, i/5-gwinGetWidth(gh)/2, 95*sin(2*0.2*GFX_PI*i/180));
} }
// Change to a completely different style // Change to a completely different style
@ -104,7 +104,7 @@ int main(void) {
// Draw a set of points // Draw a set of points
gwinGraphDrawPoints(gh, data, sizeof(data)/sizeof(data[0])); gwinGraphDrawPoints(gh, data, sizeof(data)/sizeof(data[0]));
while(TRUE) { while(TRUE) {
gfxSleepMilliseconds(100); gfxSleepMilliseconds(100);
} }