3
This commit is contained in:
parent
777cd600e1
commit
732576e85d
149
PRAKTIKA.PAS
149
PRAKTIKA.PAS
@ -1,13 +1,16 @@
|
||||
program pr;
|
||||
uses crt, graph;
|
||||
var tmp_d, tmp_m : integer; {screen variables}
|
||||
p : char; {readkey}
|
||||
p,p1 : char; {readkey}
|
||||
y_wlcm : integer; {Vsplivayushii text}
|
||||
i : integer; {Vspomogatelnie peremennye}
|
||||
cur : integer; {Posicia kursora v menu}
|
||||
y, stry : integer; {Peremennye dlya vyvoda teksta}
|
||||
nolect : integer; {Nomer lekcii}
|
||||
javame, author,
|
||||
welcome,
|
||||
menustatus : string;
|
||||
welcome, dtpa,
|
||||
menustatus,
|
||||
lectstatus : string;
|
||||
mainmenu : array [1..22] of string; {menu}
|
||||
|
||||
{Procedura inicializacii grafiki}
|
||||
@ -17,19 +20,25 @@ program pr;
|
||||
initgraph(tmp_d, tmp_m, '');
|
||||
end;
|
||||
|
||||
procedure menu ; forward;
|
||||
procedure lections(var lect:integer); forward;
|
||||
|
||||
{Procedura inicializacii peremennyh}
|
||||
procedure init_variables;
|
||||
begin
|
||||
y_wlcm := -20;
|
||||
cur := 1;
|
||||
author := 'Author: Victor aNNiMON Melnik';
|
||||
dtpa := 'DTPA 2PO-07';
|
||||
welcome := 'Welcome';
|
||||
javame := 'JavaME';
|
||||
lectstatus := 'F1 - Help T - Test ESC - Menu';
|
||||
menustatus := 'ESC - Vyhod UP,DOWN,LEFT,RIGHT - Peredvijenie kursora ENTER - Perehod';
|
||||
{Menu Lekcii}
|
||||
for i:= 1 to 10 do
|
||||
begin
|
||||
mainmenu[i] := chr(47+i)+'. Lekcia #'+chr(47+i);
|
||||
mainmenu[i+10] := 'Test #'+chr(47+i)
|
||||
mainmenu[i*2-1] := {chr(47+i)+'. }'Lekcia #'+chr(47+i);
|
||||
mainmenu[i*2] := 'Test #'+chr(47+i)
|
||||
end;
|
||||
mainmenu[21] := 'Author';
|
||||
mainmenu[22] := 'Exit';
|
||||
@ -68,11 +77,118 @@ program pr;
|
||||
readkey;
|
||||
end;
|
||||
|
||||
{Vyvod info ob avtore}
|
||||
procedure author_screen;
|
||||
begin;
|
||||
init_screen;
|
||||
setcolor(7);
|
||||
bar(0,0,640,480);
|
||||
settextstyle(1, 0, 7);
|
||||
settextstyle(3, 0, 4);
|
||||
setcolor(red);
|
||||
outtextxy(100, 171, author);
|
||||
outtextxy(240, 231, dtpa);
|
||||
setcolor(lightred);
|
||||
outtextxy(99, 170,author);
|
||||
outtextxy(239, 230, dtpa);
|
||||
repeat until keypressed;
|
||||
menu;
|
||||
end;
|
||||
|
||||
{Vyvod pomoschi pri chtenii lekcii}
|
||||
procedure help_screen;
|
||||
begin;
|
||||
init_screen;
|
||||
{ochistka ekrana}
|
||||
setfillstyle(1,9);
|
||||
bar(0,0,640,480);
|
||||
{Title}
|
||||
setfillstyle(1, 1);
|
||||
bar(0, 0, 640, 18);
|
||||
setcolor(8);
|
||||
settextstyle(2,0,6);
|
||||
outtextxy(300, 0, 'Help');
|
||||
outtextxy(99, 170, 'B - Smena cveta fona');
|
||||
outtextxy(99, 230, 'N - Smena cveta texta');
|
||||
repeat until keypressed;
|
||||
menu;
|
||||
end;
|
||||
|
||||
{Procedura chtenia lectii}
|
||||
procedure lections(var lect:integer);
|
||||
begin
|
||||
init_screen;
|
||||
nolect := lect div 2;
|
||||
repeat p1:=readkey;
|
||||
{Obrabotka klavish upravlenia}
|
||||
if p1=#72 then cur:=cur-2 {UP}
|
||||
else if p1=#75 then cur:=cur-1 {LEFT}
|
||||
else if p1=#80 then cur:=cur+2 {DOWN}
|
||||
else if p1=#77 then cur:=cur+1; {RIGHT}
|
||||
{else if(p=#13) then cur:=cur-1;
|
||||
else if(p=#72) then cur:=cur-1;
|
||||
else if(p=#72) then cur:=cur-1; }
|
||||
TextWidth('defe');
|
||||
{Proverka peremennyh}
|
||||
if(cur<2) then cur:=2;
|
||||
if(cur>23) then cur:=23;
|
||||
{ochistka ekrana}
|
||||
setfillstyle(1,9);
|
||||
bar(0,0,640,480);
|
||||
{Title}
|
||||
setfillstyle(1, 1);
|
||||
bar(0, 0, 640, 18);
|
||||
setcolor(13);
|
||||
settextstyle(2,0,6);
|
||||
outtextxy(300, 0, 'Lekcia #'+chr(47+nolect));
|
||||
{Status}
|
||||
setfillstyle(1, 7);
|
||||
settextstyle(2,0,4);
|
||||
bar(0, 466, 640, 480);
|
||||
setcolor(24);
|
||||
outtextxy(10, 468, lectstatus);
|
||||
{Otrisovka menu}
|
||||
setcolor(14);
|
||||
settextstyle(1,0,3);
|
||||
|
||||
until (p1=#27) or (p1=#116) or (p1=#59)
|
||||
{ or (p=#80) or (p=#80) or (p=#13)};
|
||||
if(p1=#116) then menu {T - Test}
|
||||
else if(p1=#59) then help_screen; {F1 - Help}
|
||||
end;
|
||||
|
||||
{Procedura obrabotki vibrannogo punkta menu}
|
||||
procedure choicemenu(var cur:integer);
|
||||
begin
|
||||
if(cur=22) then author_screen {AUTHOR}
|
||||
else if(cur=23) then halt {EXIT}
|
||||
else {OTHER}
|
||||
begin
|
||||
if cur mod 2=0 then lections(cur)
|
||||
;{else question(cur div 2);}
|
||||
end;
|
||||
end;
|
||||
|
||||
{Procedura vyvoda menu}
|
||||
procedure menu;
|
||||
begin
|
||||
init_screen;
|
||||
setbkcolor(9);
|
||||
repeat p:=readkey;
|
||||
{Obrabotka klavish upravlenia}
|
||||
if p=#72 then cur:=cur-2 {UP}
|
||||
else if p=#75 then cur:=cur-1 {LEFT}
|
||||
else if p=#80 then cur:=cur+2 {DOWN}
|
||||
else if p=#77 then cur:=cur+1 {RIGHT}
|
||||
else if p=#13 then choicemenu(cur); {ENTER}
|
||||
{else if(p=#13) then cur:=cur-1;
|
||||
else if(p=#72) then cur:=cur-1;
|
||||
else if(p=#72) then cur:=cur-1; }
|
||||
{Proverka peremennyh}
|
||||
if(cur<2) then cur:=2;
|
||||
if(cur>23) then cur:=23;
|
||||
{ochistka ekrana}
|
||||
setfillstyle(1,9);
|
||||
bar(0,0,640,480);
|
||||
{Title}
|
||||
setfillstyle(1, 1);
|
||||
bar(0, 0, 640, 18);
|
||||
@ -87,19 +203,28 @@ program pr;
|
||||
outtextxy(10, 468, menustatus);
|
||||
{Otrisovka menu}
|
||||
setcolor(14);
|
||||
settextstyle(2,0,6);
|
||||
for i:= 1 to 10 do
|
||||
settextstyle(1,0,3);
|
||||
for i:= 1 to 11 do
|
||||
begin
|
||||
outtextxy(40, 40+i*20, mainmenu[i]);
|
||||
if(i=cur div 2) then
|
||||
begin
|
||||
setfillstyle(1,3);
|
||||
if (cur mod 2=0) then bar(115, 35+i*30, 230, 35+(i+1)*30)
|
||||
else bar(315, 35+i*30, 405, 35+(i+1)*30);
|
||||
setfillstyle(1,7);
|
||||
end;
|
||||
outtextxy(120, 40+i*30, mainmenu[i*2-1]);
|
||||
outtextxy(320, 40+i*30, mainmenu[i*2]);
|
||||
end;
|
||||
|
||||
readkey;
|
||||
until (p=#27) {or (p=#72) or (p=#75) or (p=#77)
|
||||
or (p=#80) or (p=#80) or (p=#13)};
|
||||
if(p=#27) then halt;
|
||||
end;
|
||||
|
||||
{Glavnaya programma}
|
||||
begin
|
||||
init_variables;
|
||||
{helloscreen;}
|
||||
helloscreen;
|
||||
menu;
|
||||
closegraph;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user