home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TP_ADV.ZIP / LIST1002.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1989-07-31  |  2.0 KB  |  44 lines

  1. Program BgiSampleOne;
  2. {----------------------------------------------------------------------}
  3. { This is the first sample program using the BGI of Turbo Pascal.  It  }
  4. { is intended as a general introduction to the BGI's capabilities.     }
  5. {----------------------------------------------------------------------}
  6.  
  7. Uses Crt, Graph;                     { Link in the Crt and Graph units }
  8.  
  9. Const
  10.   PathToDrivers = '';     { Used to tell InitGraph where to find its   }
  11.                           { necessary support files                    }
  12.   GraphModeMsg = 'System is now in GRAPHICS MODE!';
  13.                           { Message to be outputted when in graph mode }
  14.   ExitProgramMsg = 'Press any key to exit program........';
  15.  
  16. Var
  17.   GraphDriver,
  18.   GraphMode : Integer;    { Variables to pass to InitGraph             }
  19.   GrErr : Integer;        { State of Graphics System.                  }
  20.   Ch : Char;              { Temporary variable for Readkey             }
  21.  
  22. Begin
  23.   GraphDriver := Detect;  { Request Auto Detection of Graphics Mode    }
  24.   InitGraph( GraphDriver, GraphMode, PathToDrivers );
  25.                           { Initialize the Graphics Mode               }
  26.   GrErr := GraphResult;   { See if an error occurred, and act on it    }
  27.   If( GrErr <> grOk ) Then
  28.   Begin
  29.     Writeln( 'An error has occurred - ', GraphErrorMsg( GrErr ) );
  30.     Writeln( ExitProgramMsg );
  31.     Ch := Readkey;
  32.     Halt( 1 );
  33.   End;
  34.   Rectangle( 0,0,GetMaxX,GetMaxY );
  35.                           { Places a border around the screen          }
  36.   MoveTo( 5,5 );          { Update Current Pointer to reflect border   }
  37.   OutText( GraphModeMsg );{ Output the graphics message                }
  38.   MoveTo( 5, 5 + TextHeight( GraphModeMsg) );
  39.                           { Update Current Pointer for mext message    }
  40.   OutText( ExitProgramMsg );{ Output exitting message                  }
  41.   Ch := Readkey;          { Pause until a key is pressed               }
  42.   CloseGraph;             { Shut down BGI and graphics mode            }
  43. End.
  44.