home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c021 / 7.img / EXAMPLES.ZIP / PIXEL.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-04  |  995 b   |  27 lines

  1. /* PIXEL.CPP--Example from Chapter 5 of Getting Started */
  2.  
  3. // PIXEL.CPP demonstrates the Point and Location classes
  4. // compile with POINT2.CPP and link with GRAPHICS.LIB
  5.  
  6. #include <graphics.h>   // declarations for graphics library
  7. #include <conio.h>      // for getch() function
  8. #include "point.h"      // declarations for Point and Location classes
  9.  
  10. int main()
  11. {
  12.    // initialize the graphics system
  13.    int graphdriver = DETECT, graphmode;
  14.    initgraph(&graphdriver, &graphmode, "..\\bgi");
  15.  
  16.    // move a point across the screen
  17.    Point APoint(100, 50);   // Initial X, Y at 100, 50
  18.    APoint.Show();           // APoint turns itself on
  19.    getch();                 // Wait for keypress
  20.    APoint.MoveTo(300, 150); // APoint moves to 300,150
  21.    getch();                 // Wait for keypress
  22.    APoint.Hide();           // APoint turns itself off
  23.    getch();                 // Wait for keypress
  24.    closegraph();            // Restore original screen
  25.    return 0;
  26. }
  27.