I am setting up a slot machine with 3 squares that blink alternatively using double buffering; the while loop is infinite and stops using kbhit()
(Which I believe is the mistake), even though the loop stops the commands in the if
condition is not executed.
rectangle()
-A function I wrote to make three squares spaced out equally on the screen.
while(z!=1)
{
if(kbhit()!=0)
{ cleardevice();
delay(3000);
bar3d((150),(110),(230),(190),0,0);
z=1;
continue;}
setvisualpage(page);
setactivepage(1-page);
settextstyle(3,0,5);
rectangle((x-190),y,(x+190),(y+60));
outtextxy((x-120),(y+3),"Slot Machine");
if(page==0)
setfillstyle(SOLID_FILL,4);
else
setfillstyle(SOLID_FILL,GREEN);
rectanfle(x,y);
setfillstyle(SOLID_FILL,BLUE);
bar3d((x-90),(y+255),(x+90),(y+295),5,5);
floodfill((x-89),(y+264),WHITE);
settextstyle(0,0,2);
outtextxy((x-85),(y+265),"Press Enter");
page=1-page;
delay(100);
}