case Menu_item of
1: begin
Selected_Menu_item: = 'Start';
Score: = 0;
FuelGoToWay: = false;
NextKM_GenerFuel: = 1;
CountKM: = 0;
CountFuel: = 8;
CountNitro: = 0;
MinusFuel: = 0.00002;
Y_KordFuel: = 1.5;
FuelGoToWay: = false;
GasDeley: = 1;
Gas: = false;
NextKmEnymy: = 0.3;
Y_Enymi: = 1.2;
end;
2: begin Selected_Menu_item: = 'Car'; end;
3: begin Selected_Menu_item: = 'Actors'; end;
4: begin Selected_Menu_item: = 'Exit'; end;
end;
end;
end;
if CountTickTimer> 100 then begin
if Selected_Menu_item = 'Actors' then// Натиснуто клавіша Sound
begin
if SpeedGL.MediaPlayer1.FileName <> 'Sound Actor.mp3' then begin
SpeedGL.MediaPlayer1.FileName: = 'Sound Actor.mp3';
SpeedGL.MediaPlayer1.Open;
SpeedGL.MediaPlayer1.Play;
end;
if PressedKey [27] = true then
begin
Selected_Menu_item: ='';
SpeedGL.MediaPlayer1.Stop;
SpeedGL.MediaPlayer1.Close;
SpeedGL.MediaPlayer1.FileName: ='';
CountTickTimer: = 0;
end;
end;
if Selected_Menu_item = 'Car' then// Натиснуто клавіша Car
begin// Car
if SpeedGL.MediaPlayer1.FileName <> 'Sound Garage.mp3' then begin
SpeedGL.MediaPlayer1.FileName: = 'Sound Garage.mp3';
SpeedGL.MediaPlayer1.Open;
SpeedGL.MediaPlayer1.Play;
end;
if PressedKey [27] = true then
begin
Selected_Menu_item: ='';
SpeedGL.MediaPlayer1.Stop;
SpeedGL.MediaPlayer1.Close;
SpeedGL.MediaPlayer1.FileName: ='';
CountTickTimer: = 0;
OldSelectMenyItem: = 'Car';
end;
if PressedKey [37] = true then
begin
Dec (CarMenuItem);
CountTickTimer: = 0;
LeftButton: = true;
PlaySound ('Sound Select_CarMenu.wav', 0, SND_ASYNC);
end;
if PressedKey [39] = true then
begin
Inc (CarMenuItem);
CountTickTimer: = 0;
RightButton: = true;
PlaySound ('Sound Select_CarMenu.wav', 0, SND_ASYNC);
end;
if CarMenuItem> 4 then CarMenuItem: = 1;
if CarMenuItem <1 then CarMenuItem: = 4;
end;// Car
end ;//CountTickTimer
if Selected_Menu_item = 'Exit' then// Натиснуто клавіша Exit в Гланом меню
begin
В
SpeedGL.MediaPlayer1.Free;
Application.Terminate;
Application.ProcessMessages;
end;
InvalidateRect (SpeedGL.Handle, nil, False) ;//перемальовування
if (Symvol = 0) and
(PressedKey [78] = true) and
(CountNitro> 0) and
(GasDeley = 1) then
begin
Gas: = true;
CountNitro: = CountNitro-1;
GasDeley: = 0;
PlaySound ('Sound Start_Nitro.wav', 0, SND_ASYNC);
end;
end;
подія OnPaint :
procedure TSpeedGL.FormPaint (Sender: TObject);
var
ps: TPaintStruct;
begin
BeginPaint (dc, ps);
if Selected_Menu_item ='' then
begin
case Menu_item of
1: begin LeftTiresMeny: = -0.849; RightTiresMeny: = 0.8; TopTiresMeny: = 0.76; end;
2: begin LeftTiresMeny: = -1.1; RightTiresMeny: = 1.0; TopTiresMeny: = 0.4; end;
3: begin LeftTiresMeny: = -0.8; RightTiresMeny: = 0.8; TopTiresMeny: = 0.0; end;
4: begin LeftTiresMeny: = -0.8; RightTiresMeny: = 0.8; TopTiresMeny: = -0.58; end;
end;
if OldSelectMenyItem = 'Car' then begin
if RemoveMeny> = 0.0 then begin RemoveMeny: = 0.0; OldSelectMenyItem: ='' end else
RemoveMeny: = RemoveMeny +0.018;
glCallList (Background);
glPushMatrix;
glTranslatef (RemoveMeny, 0.0,0.0);
glCallList (StringMeny);
glPopMatrix;
end
else begin
glCallList (Background) ;//Завантаження фону
glCallList (StringMeny) ;//Завантаження написів в меню
end;
if (Selected_Menu_item <> 'Car') and (RemoveMeny = 0.0) then begin
Angel: = Angel +1;
if Angel = 360 then Angel: = 0;
glCallList (8) ;//Завантаження колеса
glPushMatrix;
glScalef (0.5,0.66,0.5);
glTranslatef (LeftTiresMeny, TopTiresMeny, 0.0);
glRotatef (Angel, 0.0,0.0,1.0);
glCallList (Tires);
glPopMatrix;
glPushMatrix;
glScalef (0.5,0.66,1.0);
glTranslatef (RightTiresMeny, TopTiresMeny, 0.0);
...