Ale do rzeczy : poniżej są listingi mojej biblioteki i programu .
Program :
Kod: Zaznacz cały
program LegoPT;
uses crt,lego;
begin
ramka;
menuproc;
end.
Kod: Zaznacz cały
{program LegoPT; }
unit lego;
INTERFACE
uses crt;
Procedure textcol(c1,c2:byte);
procedure ramka;
Procedure stan;
Procedure menuproc;
IMPLEMENTATION
var
exit,nrfunkcji:byte;
Procedure textcol (c1,c2:byte);
begin
textcolor(c1);
textbackground(c2);
end;
procedure ramka;
var
li:byte;
begin
textcol (10,2);
ClrScr ;
gotoxy (13,1);
write ('LegoPT 1.0v');
GotoXY (31,3);
write ('Stan');
GotoXY (10,3);
write ('Użądzenie');
textcol(0,2);
li:=0;
repeat
GotoXY (8+li,2);
write (chr(196));
GotoXY (8+li,12);
write (chr(196));
li:=li+1;
until li=28;
li:=0;
repeat
gotoxy (8,2+li);
write (chr(179));
gotoxy (30,2+li);
write (chr(179));
gotoxy (36,2+li);
write (chr(179));
li:=li+1;
until li=11;
GotoXY (8,2);
write (chr(218));
GotoXY (36,2);
write (chr(191));
GotoXY (8,12);
write (chr(192));
GotoXY (36,12);
write (chr(217));
GotoXY (30,2);
write (chr(194));
GotoXY (30,12);
write (chr(193));
end;
Procedure stan;
var
stany:array [1..6]of byte;
li:byte;
ch,c:char;
begin
textcol (10,2);
li:=0;
ch:=readkey;
if (ch='q') and (stany[nrfunkcji]=0) then stany[nrfunkcji]:=1;
if (ch='q') and (stany[nrfunkcji]=1) then stany[nrfunkcji]:=0;
if ch=chr(0) then menuproc;
repeat
li:=li+1;
GotoXY (32,4+li);
if stany[*]=0 then TextColor(12);
if stany[*]=1 then TextColor(10);
write(chr(15));
until li=6;
menuproc;
end;
Procedure menuproc;
Var
c1,c2:char;
y,menu:byte;
tablica:array[1..8]of string;
stany:array [1..6]of byte;
li:byte;
ch,c:char;
Begin
menu:=1;
repeat
menu:=nrfunkcji;
y:=0;
tablica[1]:='1.ulica';
tablica[2]:='2.warsztat światło';
tablica[3]:='3.warsztat podnośnik';
tablica[4]:='4.winda dom';
tablica[5]:='5.dom światło';
tablica[6]:='6.kiosk światło';
tablica[7]:='7.pomoc';
tablica[8]:='8.wyjśćie';
GotoXY (10,3+menu);
textcol(0,7);
write (tablica[menu]);
nrfunkcji:=menu;
repeat
textcol(10,2);
y:=y+1;
gotoxy (10,3+y);
write (tablica[y]);
until y=8;
GotoXY (10,3+menu);
textcol(0,7);
write (tablica[menu]);
nrfunkcji:=menu;
c1:=ReadKey;
c2:=' ';
if c1=chr(0) then c2:=ReadKey;
if c2='H' then
begin
if menu=1 then menu:=9;
if menu<>1 then dec(menu) ;
end;
if c2='P' then
begin
if menu=8 then menu:=0;
if menu<>8 then menu:=menu+1;
end;
GotoXY (10,3+menu);
textcol(0,7);
write (tablica[menu]);
nrfunkcji:=menu;
stan;
until 2=1;
End;
Begin
end.
jak czegoś nie rozumiecie pisać postaram się wytłumaczyć
Ruri - popraw orty i literówki, jak tak samo piszesz kod, to nie dziwne, że nie działa.
masz troche racji !