The program initiates a graphic card of 256 colors in pascal

Delphi & Pascal (česká wiki)
Přejít na: navigace, hledání
Category: Source in Pascal

Program: Vga256.pas
File exe: Vga256.exe
need: Paradise.bgi

The program initiates a graphic card of 256 colors in pascal.
{ VGA256.PAS                                                        }
{ Program inicializuje graficku kartu s 256 farbami.                }
{                                                                   }
{ Datum:12.05.1997                             http://www.trsek.com }
 
program VGA_256color;
uses  graph,crt;
const kart='PARADISE';
 
var i:integer;
    gd,gm:integer;
 
 
{$F+}
function DetectVGA256 : integer;
var
  DetectedDriver: integer;
  SuggestedMode : integer;
begin
  DetectGraph(DetectedDriver, SuggestedMode);
  if (DetectedDriver=VGA) or (DetectedDriver=MCGA) then
     DetectVGA256:=0        { Default video mode = 0 }
  else
     DetectVGA256:=grError; { Couldn't detect hardware }
end;
{$F-}
 
 
{ inicializacia grafiky s 256 farbami }
procedure InitVGA256(cesta:string);
var
  DirectVideo:boolean;
  AutoDetectPointer : pointer;
begin
  DirectVideo:=false;
 
  { Point to detection routine }
  AutoDetectPointer:=@DetectVGA256;
  gd:=InstallUserDriver(cesta+kart, AutoDetectPointer);
  gd:=Detect;
 
  InitGraph(gd,gm, '');
end;
 
 
begin
  InitVGA256('');
 
  for i:=1 to Getmaxcolor do begin
    setfillstyle(1,i);
    bar(i*6,10,(i+1)*6,100);
  end;
 
  { pocka na stlacenie klavesu a zatvorime graficku kartu }
  readkey;
  CloseGraph;
end.