home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / TCPP30-3.ZIP / EXAMPLES.ZIP / FIGURES.H < prev    next >
C/C++ Source or Header  |  1992-02-18  |  1KB  |  56 lines

  1. // Borland C++ - (C) Copyright 1991 by Borland International
  2.  
  3. // figures.h contains three classes.
  4. //
  5. //  Class Location describes screen locations in X and Y
  6. //  coordinates.
  7. //
  8. //  Class Point describes whether a point is hidden or visible.
  9. //
  10. //  Class Circle describes the radius of a circle around a point.
  11. //
  12. // To use this module, put #include <figures.h> in your main
  13. // source file and compile the source file FIGURES.CPP together
  14. // with your main source file.
  15.  
  16. enum Boolean {false, true};
  17.  
  18. class Location {
  19. protected:
  20.    int X;
  21.    int Y;
  22. public:
  23.    Location(int InitX, int InitY) {X = InitX; Y = InitY;}
  24.    int GetX() {return X;}
  25.    int GetY() {return Y;}
  26. };
  27.  
  28. class Point : public Location {
  29. protected:
  30.    Boolean Visible;
  31. public:
  32.    Point(int InitX, int InitY);
  33.    virtual void Show();       // Show and Hide are virtual
  34.    virtual void Hide();
  35.    virtual void Drag(int DragBy); // new virtual drag function
  36.    Boolean IsVisible() {return Visible;}
  37.    void MoveTo(int NewX, int NewY);
  38. };
  39.  
  40. class Circle : public Point {  // Derived from class Point and
  41.                                // ultimately from class Location
  42. protected:
  43.    int Radius;
  44. public:
  45.    Circle(int InitX, int InitY, int InitRadius);
  46.    void Show();
  47.    void Hide();
  48.    void Expand(int ExpandBy);
  49.    void Contract(int ContractBy);
  50. };
  51.  
  52. // prototype of general-purpose, non-member function
  53. // defined in FIGURES.CPP
  54.  
  55. Boolean GetDelta(int& DeltaX, int& DeltaY);
  56.