#include <graphics.h> |
#include <stdlib.h> |
#include <stdio.h> |
#include <conio.h> |
int main( void ) |
{ |
/* request auto detection */ |
int gdriver = DETECT, gmode, errorcode; |
int xasp, yasp, midx, midy; |
/* initialize graphics and local variables */ |
initgraph(&gdriver, &gmode, "" ); |
/* read result of initialization */ |
errorcode = graphresult(); |
/* an error occurred */ |
if (errorcode != grOk) |
{ |
printf ( "Graphics error: %s\n" , |
grapherrormsg(errorcode)); |
printf ( "Press any key to halt:" ); |
getch(); |
/* terminate with an error code */ |
exit (1); |
} |
midx = getmaxx() / 2; |
midy = getmaxy() / 2; |
setcolor(getmaxcolor()); |
/* get current aspect ratio settings */ |
getaspectratio(&xasp, &yasp); |
/* draw normal circle */ |
circle(midx, midy, 100); |
getch(); |
/* draw wide circle */ |
cleardevice(); |
setaspectratio(xasp/2, yasp); |
circle(midx, midy, 100); |
getch(); |
/* draw narrow circle */ |
cleardevice(); |
setaspectratio(xasp, yasp/2); |
circle(midx, midy, 100); |
/* clean up */ |
getch(); |
closegraph(); |
return 0; |
} |