/////////////////////////////////////////////////////////////////// // // graphics2.cpp // // Started in Pascal by Jeff Ondich on 1/25/95 // Last modified 5/20/98 // // Try it. Then try replacing drawpoly() with drawpolyfilled(). // /////////////////////////////////////////////////////////////////// #include #include // Constants const int windowWidth = 600; const int windowHeight = 600; const int windowBottom = 100; const int windowLeft = 100; // Prototypes void StartGraphics( void ); int main( void ) { graphpoint polygon[6]; StartGraphics(); polygon[0].x = 200; polygon[0].y = 100; polygon[1].x = 400; polygon[1].y = 100; polygon[2].x = 500; polygon[2].y = 200; polygon[3].x = 400; polygon[3].y = 300; polygon[4].x = 200; polygon[4].y = 200; setrgbcolor( 0, 1, 0 ); drawpoly( 5, polygon ); flushgraphics(); cin.ignore(); return( 0 ); } /////////////////////////////////////////////////////////////////// // StartGraphics initializes the graphics package // and opens a black window for drawing. /////////////////////////////////////////////////////////////////// void StartGraphics( void ) { // Call initializegraphics only once during the program, // before you do any other graphics initializegraphics(); // Open a window and flood it with a black background. createwindow( windowLeft, windowBottom, windowLeft + windowWidth, windowBottom + windowHeight ); setrgbcolor( 0.0, 0.0, 0.0 ); flood(); flushgraphics(); }