Взаимодействие основных частей ЭВМ при выполнении программы
|1: begin |
|FuncKeyWindow[2].Put(XS, YS); |
|Page_1; |
|Move_1 |
|end; |
|2: begin |
|FuncKeyWindow[1].Put(XS, YS); |
|Page_2; |
|Move_2 |
|end; |
|3: begin |
|FuncKeyWindow[1].Put(XS, YS); |
|Page_3; |
|Move_3 |
|end; |
|4: begin |
|FuncKeyWindow[3].Put(XS, YS); |
|Page_4_1; |
|Move_4_1; |
|Delay(Time_3 * 20); |
|Page_4_2; |
|Delay(Time_3 * 20); |
|Move_4_2; |
|Delay(Time_3 * 20); |
|Page_4_3; |
|Delay(Time_3 * 20); |
|Move_4_3; |
|Move_4_4; |
|Page_4_4; |
|Delay(Time_3 * 20); |
|Page_4_5; |
|Delay(Time_3 * 20); |
|Move_4_5; |
|Delay(Time_3 * 20); |
|Page_4_6; |
|Delay(Time_3 * 20); |
|Move_4_6; |
|Delay(Time_3 * 20); |
|Page_4_7 |
|end |
|end |
|end; {SelectPage} |
|{-------------} |
| |
|const |
|Back = #75; |
|Next = #77; |
|F1 = #59; |
|Esc = #27; |
|var |
|ArrowsAndEsc: set of Char; |
|ExtentedKey: Boolean; |
|Flag: Boolean; |
|CH: Char; |
|N: Byte; |
|begin |
|ClearDevice; |
|MainWin; |
|N := 0; |
| |
| |
| ArrowsAndEsc := [Back, Next, F1, Esc]; |
|repeat |
|ExtentedKey := False; |
|Flag := False; |
|CH := ReadKey; |
|if CH = Esc then |
|Flag := True; |
|if CH = #0 then |
|begin |
|CH := ReadKey; |
|ExtentedKey := True |
|end; |
|if ExtentedKey then |
|case CH of |
|Back: begin |
|Dec(N); |
|SelectPage(N); |
|if N < 1 then N := 1 |
|end; |
|Next: begin |
|Inc(N); |
|SelectPage(N); |
|if N > 4 then N := 4 |
|end; |
|F1: begin |
|Temp[1].Get(X0, Y0, X0 + 380, Y0 + 300); |
|Temp[2].Get(X0, Y0 + 305, GetMaxX - X0, YS - 5); |
|Help; |
|MainWin; |
|Temp[1].Put(X0, Y0); |
|Temp[2].Put(X0, Y0 + 305); |
|if N #27 then |
|begin |
| |
|Val(C, Res, Code); |
|if Res = Ok[N] then |
|begin |
|Quastion := 1; |
|SetColor(Green); |
|MyText(GetMaxX div 2 - 20, GetMaxY - 200, 'ВЕРНО') |
|end |
|else |
|begin |
|Quastion := 0; |
|SetColor(Red); |
|MyText(GetMaxX div 2 - 28, GetMaxY - 200, 'НЕВЕРНО') |
|end; |
|Delay(Time_2) |
|end |
|else |
|CH := C; |
|ClearDevice |
|end; {Quastion} |
|{-----------------} |
| |
|function Mark(Res: Byte): Char; |
|begin |
|case Res of |
|1: Mark := '1'; |
|2: Mark := '2'; |
| |
| |
| 3: Mark := '3'; |
|4: Mark := '4'; |
|5: Mark := '5'; |
|else |
|Mark := '0' |
|end |
|end; {Mark} |
|{-----------------} |
| |
|var |
|I: Byte; |
|Result: Byte; |
|StrRes: string[2]; |
|TempS: TText; |
|C: Char; |
|begin |
|C := #0; |
|ClearDevice; |
|Result := 0; |
|TempS := EndofTest; |
|for I := 1 to 5 do |
|begin |
|if Quastion(I, C) = 1 then |
|Inc(Result); |
|if C = #27 then Exit |
|end; |
|ClearDevice; |
|SetColor(BRDCol); |
|Rectangle(0, 0, GetMaxX, GetMaxY); |
|Str(Result, StrRes); |
|TempS[3] := EndofTest[3] + StrRes; |
|TempS[4] := EndofTest[4] + Mark(Result); |
|SetColor(BRDCol); |
|Rectangle(GetMaxX div 2 - 150, GetMaxY div 2 - 60, |
|GetMaxX div 2 + 150, GetMaxY div 2 + 40); |
|TextT(TestCol, TempS); |
|_Pause; |
|ClearDevice |
|end; {TestMode} |
|{-------------------} |
| |
|procedure MainMenu; |
|var |
|C: Char; |
|ExtentedKey: Boolean; |
|TempCol: TColor; |
|K: ShortInt; |
|begin |
|ClearDevice; |
|TempCol[1] := MenuCol[1]; |
|TempCol[2] := MenuCol[3]; |
|TempCol[3] := MenuCol[4]; |
|TempCol[4] := MenuCol[4]; |
|K := 1; |
|repeat |
|SetColor(BRDCol); |
|Rectangle(GetMaxX div 2 - 150, GetMaxY div 2 - 60, |
|GetMaxX div 2 + 150, GetMaxY div 2 + 40); |
|Rectangle(0, 0, GetMaxX, GetMaxY); |
|ExtentedKey := False; {флаг поступления расширенного кода} |
|TextT(TempCol, Menu); |
|while KeyPressed do ReadKey; {очистка буфера клавиатуры} |
|C := ReadKey; {считывание кода новой нажатой клавиши} |
|if C = #0 then {если "да" - код расширенный} |
|begin |
| |
| |
| |
| C := ReadKey; {считывается второй символ расширенного кода} |
|ExtentedKey := True |
|end; |
|if ExtentedKey then {если код был расширенный} |
|case C of |
|#72: K := K - 1; |
|#80: K := K + 1 |
|end; |
|if C = #13 then |
|case K of |
|1: Play; {Обучение} |
|2: TestMode; {Проверка знаний} |
|3: Exit {Выход} |
|end; |
|if K < 1 then K := 3; |
|if K > 3 then K := 1; |
|for I := 2 to 4 do |
|TempCol[I] := MenuCol[4]; |
|TempCol[K + 1] := MenuCol[3]; {Смена цвета выделленого пункта} |
|until C = #27 {т.е. нажата клавиша "Esc"} |
|end; {MainMenu} |
|{-------------------} |
| |
|begin |
|MyInitGraph; {Инициализация графического режима} |
|Title; {Титульный лист} |
|MainMenu; {Главное меню} |
|CloseGraph; {Закрытие графического режима} |
|end. {LEAN_Ecm;} |
|{-------------------} |
|Текст модуля Sm_Const |
|unit Sm_Const; |
|interface |
|uses Graph, Sm_Graph; |
|type |
|TText = array [1..4] of string; |
|TColor = array [1..4] of Word; |
|------------------- type |
|const |
|X0: Integer = 10; {Начальная координата X} |
|Y0: Integer = 20; {Начальная координата Y} |
|XS: Integer = 10; {FuncKey} |
Страницы: 1, 2, 3, 4, 5
|