You don't have to disable DXDraw. Just do as Traveler suggested. Move drawing code form OnKeyUp event to separate Draw procedure. (procedure you do all the drawing). When you draw in OnKeyUp event the selected menu is drawn only once which causes this blink.
Another suggestion. You don't have to call DXDraw.Flip each time you draw something. Call it only once after everything is already drawn. To make it more clear here is an example code
Code:
// This is not the best example of an efficient drawing procedure
// because one menu item is drawn twice - first time as normal
// and second as selected. I did it like this to make it as simple
// as possible.
procedure TMain.Draw;
begin
// Game Logo
MenuImages.Items[0].Draw(DXDraw1.Surface,255,50,0);
// Draw Start New Game
MenuImages.Items[1].Draw(DXDraw1.Surface,350,300,0);
//Draw Options
MenuImages.Items[2].Draw(DXDraw1.Surface,350,360,0);
// Draw Exit
MenuImages.Items[3].Draw(DXDraw1.Surface,350,410,0);
//Draw selected menu
Case Menuchoice of
0 : MenuImages.Items[4].Draw(DXDraw1.Surface,350,300,0);
1 : MenuImages.Items[5].Draw(DXDraw1.Surface,350,360,0);
2 : MenuImages.Items[6].Draw(DXDraw1.Surface,350,410,0);
end;
//the flip is called when everything is drawn
DXDraw1.Flip;
end;
I hope it helps.
Bookmarks