Language:
Русский
English
{Getdfplt.PAS}
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
{Sample code for the GetDefaultPalette function.}
uses Crt, Graph;
var
Driver, Mode, I: Integer;
MyPal, OldPal: PaletteType;
begin
DirectVideo := False;
Randomize;
Driver := Detect; { Put in graphics mode }
InitGraph(Driver, Mode, '');
if GraphResult < 0 then
Halt(1);
GetDefaultPalette(OldPal); { Preserve old one }
MyPal := OldPal; { Duplicate and modify }
{ Display something }
for I := 0 to MyPal.Size - 1 do
begin
SetColor(I);
OutTextXY(10, I * 10, '...Press any key...');
end;
repeat { Change palette until a key is pressed }
with MyPal do
Colors[Random(Size)] := Random(Size + 1);
SetAllPalette(MyPal);
until KeyPressed;
SetAllPalette(OldPal); { Restore original palette }
ClearDevice;
OutTextXY(10, 10, 'Press <Return>...');
Readln;
CloseGraph;
end.