Язык:
Русский
English
{ Пример программы для функции GetColor }
uses Graph;
var
Gd, Gm : Integer;
Color : Word;
Pal : PaletteType;
begin
Gd := Detect;
InitGraph(Gd, Gm, 'X:\BP');
if GraphResult <> grOk then
Halt(1);
Randomize;
GetPalette(Pal);
repeat
Color := Succ(GetColor);
if Color > Pal.Size - 1 then
Color := 0;
SetColor(Color);
LineTo(Random(GetMaxX), Random(GetMaxY));
until KeyPressed;
CloseGraph;
end.
var
Gd, Gm : Integer;
Color : Word;
Pal : PaletteType;
begin
Gd := Detect;
InitGraph(Gd, Gm, 'X:\BP');
if GraphResult <> grOk then
Halt(1);
Randomize;
GetPalette(Pal);
repeat
Color := Succ(GetColor);
if Color > Pal.Size - 1 then
Color := 0;
SetColor(Color);
LineTo(Random(GetMaxX), Random(GetMaxY));
until KeyPressed;
CloseGraph;
end.