I finish my game menu but there is one problem in the menu . I the menu you don't have mouse ,you choose start game or options or exit with arrows form keyboard and here is the problem . When i push up or down in the menu work only exit and options . I read my code but look like everythings is all right .
Here is the code for the game menu :
First i draw the logo start game , options and exit :
Code:
MenuImages.Items[0].Draw(DXDraw1.Surface,255,50,0); // Game Logo
DXDraw1.Flip;
// Draw Start New Game
MenuImages.Items[1].Draw(DXDraw1.Surface,350,300,0);
DXDraw1.Flip;
//Draw Options
MenuImages.Items[2].Draw(DXDraw1.Surface,350,360,0);
DXDraw1.Flip;
// Draw Exit
MenuImages.Items[3].Draw(DXDraw1.Surface,350,410,0);
DXDraw1.Flip;
and here is the problem part - when i push up or down in the menu work only exit and options. (change the picture) and when i press random key from my keyboard then work start game very strange problem
Code:
procedure TMain.FormKeyUp(Sender: TObject; var Key: Word;
Shift: TShiftState);
var Menuchoice : integer;
begin
Menuchoice:=1;
if key = vk_escape then begin Exit.ShowModal; if Exitg = 1 then close; end;
if key = vk_up then begin
if menuChoice = 1 then menuChoice := 3 else dec(menuChoice);
end;
if key = vk_down then begin
if menuChoice = 3 then menuChoice := 1 else inc(menuChoice);
end;
Case Menuchoice of
1 : begin MenuImages.Items[4].Draw(DXDraw1.Surface,350,300,0);
DXDraw1.Flip; end;
2 : begin MenuImages.Items[5].Draw(DXDraw1.Surface,350,360,0);
DXDraw1.Flip; end;
3 : begin MenuImages.Items[6].Draw(DXDraw1.Surface,350,410,0);
DXDraw1.Flip; end;
end;
end;
Bookmarks