Ola!
estou fazendo um menu com cores so que ele pisca muito alguém me pode ajudar?
#include <stdio.h>
#include <stdlib.h>
#include<conio.h>
#include <locale.h>
#include <windows.h>
#define KEY_UP 72
#define KEY_DOWN 80
#define KEY_ESC 27
#define KEY_ENTER 13
key = 0;
void MenuPrincipal();
void MenuPrincipal()
{
int FundoOp1=9, FundoOp2=0, FundoOp3=0, FundoOp4=0;
int ContUp=4,ContDown=4;
int n =0;
while(n<1)
{
system("cls");
setlocale(LC_ALL, "Portuguese");
printf("\n \n ************* Menu principal ***************\n");
printf(" * *\n");
//Gestão de Utentes
printf(" *\t ");
textbackground(FundoOp1) ;
printf("Gestão de Utentes");
textbackground(0);
textcolor(15);
printf("\t\t *\n");
//Gestão de Equipamentos
printf(" *\t ");
textbackground(FundoOp2) ;
printf("Gestão de Equipamentos");
textbackground(0);
textcolor(15);
printf("\t *\n");
//Gestão de Requesições
printf(" *\t ");
textbackground(FundoOp3) ;
printf("Gestão de Requesições");
textbackground(0);
textcolor(15);
printf("\t *\n");
//Sair do programa
printf(" *\t ");
textbackground(FundoOp4) ;
printf("Sair do programa");
textbackground(0);
textcolor(15);
printf("\t\t *\n");
//
printf(" * *\n");
printf(" ********************************************\n \n \n");
printf("Up:%d|Down: %d",ContUp,ContDown);
key = getch();
if (key == KEY_ESC)
{
return;
}
if (key == KEY_UP)
{
ContUp++;
if (ContUp==5)
{
ContUp=1;
}
switch(ContUp)
{
case 1:
FundoOp1=0;
FundoOp2=0;
FundoOp3=0;
FundoOp4=9;
ContDown=1;
break;
case 2:
FundoOp1=0;
FundoOp2=0;
FundoOp3=9;
FundoOp4=0;
ContDown=2;
break;
case 3:
FundoOp1=0;
FundoOp2=9;
FundoOp3=0;
FundoOp4=0;
ContDown=3;
break;
case 4:
FundoOp1=9;
FundoOp2=0;
FundoOp3=0;
FundoOp4=0;
ContDown=4;
break;
default:
break;
}
}
if (key == KEY_DOWN)
{
if (ContDown==1)
{
ContDown=5;
}
ContDown--;
switch(ContDown)
{
case 1:
FundoOp1=0;
FundoOp2=0;
FundoOp3=0;
FundoOp4=9;
ContUp=1;
break;
case 2:
FundoOp1=0;
FundoOp2=0;
FundoOp3=9;
FundoOp4=0;
ContUp=2;
break;
case 3:
FundoOp1=0;
FundoOp2=9;
FundoOp3=0;
FundoOp4=0;
ContUp=3;
break;
case 4:
FundoOp1=9;
FundoOp2=0;
FundoOp3=0;
FundoOp4=0;
ContUp=4;
break;
default:
break;
}
}
if (key==KEY_ENTER)
{
n=1;
system("cls");
switch(ContDown)
{
case 1:
return;
break;
case 2:
printf("Gestão de Requesições");
break;
case 3:
MenuEquipamentos();
break;
case 4:
MenuUtentes();
break;
default:
break;
}
}
}
}