[Overview][Constants][Types][Procedures and functions][Variables] Reference for unit 'Graph' (#rtl)

InitGraph

Initialize grpahical system

Declaration

Source position: graphh.inc line 725

procedure InitGraph(

  var GraphDriver: SmallInt;

  var GraphMode: SmallInt;

  const PathToDriver: String

);

Description

InitGraphinitializes the graphpackage. GraphDriverhas two valid values: GraphDriver=0which performs an auto detect and initializes the highest possible mode with the most colors. 1024x768x64K is the highest possible resolution supported by the driver, if you need a higher resolution, you must edit MODES.PPI. If you need another mode, then set GraphDriverto a value different from zero and graphmodeto the mode you wish (VESA modes where 640x480x256 is 101hetc.). PathToDriveris only needed, if you use the BGI fonts from Borland. Free Pascal does not offer BGI fonts like Borland, these must be obtained separately.

Example code:

var 
   gd,gm : integer; 
   PathToDriver : string; 
begin 
   gd:=detect; { highest possible resolution } 
   gm:=0; { not needed, auto detection } 
   PathToDriver:='C:\PP\BGI'; { path to BGI fonts, 
                                drivers aren't needed } 
   InitGraph(gd,gm,PathToDriver); 
   if GraphResult<>grok then 
     halt; ..... { whatever you need } 
   CloseGraph; { restores the old graphics mode } 
end.

Errors

None.

See also

Modes

  

A word about mode selection

DetectGraph

  

Detect correct graphical driver to use

CloseGraph

  

Close graphical system.

GraphResult

  

Result of last graphical operation