uses Crt,graph,variavel,inicial,texto,jogador,torneio; {****************************************************************************} {****************************************************************************} {*******************************Main*****************************************} {****************************************************************************} {****************************************************************************} var Gd, Gm: Integer; fundo : pointer; tamaho : Word; begin Gd := Detect; InitGraph(Gd, Gm, ''); if GraphResult <> grOk then Halt(1); inicializa; setbkcolor(1); cleardevice; line(1,1,639,479); { Caso exista um desenho ter  de ser inserido aqui para 640X100 } tamaho := ImageSize(1, 22, 639, 200); GetMem(fundo, tamaho); GetImage(1, 22, 639, 200,fundo^); apre_menu; while(sair=0) do begin if keypressed then begin tecla:=readkey; if (tecla<>'1') then begin if tecla=enter then begin if opcao=4 then begin ficheiro_joga; if salta=9 then grava_joga; apre_menu; FreeMem(aponta, Size); end else if opcao=6 then begin joga_alterar; apre_menu; FreeMem(aponta, Size); end else if opcao=7 then begin joga_eliminar; apre_menu; FreeMem(aponta, Size); end else if opcao=8 then begin imprimir_j; apre_menu; end else if opcao=9 then begin joga_consulta1; apre_menu; FreeMem(aponta, Size); end else if opcao=10 then begin joga_consulta2; apre_menu; FreeMem(aponta, Size); end else if opcao=11 then begin torneio_cria; apre_menu; FreeMem(aponta, Size); end else if opcao=12 then begin torneio_inserir; apre_menu; FreeMem(aponta, Size); end else if opcao=14 then begin torneio_apaga; apre_menu; FreeMem(aponta, Size); end else if opcao=15 then begin torneio_visual; apre_menu; FreeMem(aponta, Size); end else if opcao=16 then begin torneio_imprime; apre_menu; FreeMem(aponta, Size); end else if opcao=3 then sair:=1; end; if (opcao=1) or ((opcao>=4) and (opcao<=8)) and (tecla<>enter) then begin if ((tecla=scim) or (tecla=sbax)) and (opcao=1) then opcao:=3 else if ((tecla=scim) and (opcao<>4)) then opcao:=opcao-1 else if ((tecla=scim) and (opcao=4)) then opcao:=8; if ((tecla=sbax) and (opcao<>8)) then opcao:=opcao+1 else if ((tecla=sbax) and (opcao=8)) then opcao:=4; end else if ((opcao>=9) and (opcao<=10)) or ((opcao=5) and (tecla=enter)) then begin if (opcao=5) and (tecla=enter) then opcao:=9; if ((tecla=scim) and (opcao<>9)) then opcao:=opcao-1 else if ((tecla=scim) and (opcao=9)) then opcao:=10; if ((tecla=sbax) and (opcao<>10)) then opcao:=opcao+1 else if ((tecla=sbax) and (opcao=10)) then opcao:=9; end else if (opcao=2) or ((opcao>=11) and (opcao<=14)) and (tecla<>enter) then begin if (tecla=scim) and (opcao=2) then opcao:=1 else if (tecla=sbax) and (opcao=2) then opcao:=10 else if ((tecla=scim) and (opcao<>11)) then opcao:=opcao-1 else if ((tecla=scim) and (opcao=11)) then opcao:=14; if ((tecla=sbax) and (opcao<>14)) then opcao:=opcao+1 else if ((tecla=sbax) and (opcao=14)) then opcao:=11; end else if (opcao=3) and (tecla=scim) then begin opcao:=2; end else if ((opcao>=15) and (opcao<=16)) or ((opcao=13) and (tecla=enter)) then begin if (opcao=13) and (tecla=enter) then opcao:=15; if ((tecla=scim) and (opcao<>15)) then opcao:=opcao-1 else if ((tecla=scim) and (opcao=15)) then opcao:=16; if ((tecla=sbax) and (opcao<>16)) then opcao:=opcao+1 else if ((tecla=sbax) and (opcao=16)) then opcao:=15; end; if ((tecla=sesq) or (tecla=sdir)) and (opcao>3) then begin if (opcao>=4) and (opcao<=8) then opcao:=1 else if (opcao>=9) and (opcao<=10) then opcao:=5 else if (opcao>=11) and (opcao<=14) then opcao:=2 else if (opcao=15) and (tecla=sdir) then opcao:=12 else if (opcao=15) and (tecla=sesq) then opcao:=14 else if (opcao=16) and (tecla=sdir) then opcao:=12 else if (opcao=16) and (tecla=sesq) then opcao:=14; putimage(1, 22, fundo^ ,0); end; if ((tecla=sesq) and (opcao<>1)) then opcao:=opcao-1 else if ((tecla=sesq) and (opcao=1)) then opcao:=3; if ((tecla=sdir) and (opcao<>3)) then opcao:=opcao+1 else if ((tecla=sdir) and (opcao=3)) then opcao:=1; apre_menu; end; if (tecla=esc) and (opcao<=3) then begin sair:=1; end else if (tecla=esc) and (opcao<=10) then begin opcao:=1; putimage(1, 22, fundo^ ,0); apre_menu; end else if (tecla=esc) and (opcao>=10) and (opcao<=15) then begin opcao:=2; putimage(1, 22, fundo^ ,0); apre_menu; end end; end; FreeMem(fundo, tamaho); {****Termina o modo gr fico *****} CloseGraph; nosound; end. {********************************}