+ 1
What do I do now??? Graphics in C program are flickering...How to stop that???? How to graphics without flicker??
Show me a solution
5 ответов
+ 1
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm,x,y,n,i=0;
char j[100];
clrscr();
initgraph(&gd,&gm,"C:\\TC\\BGI");
x=getmaxx();
y=getmaxy()/4;
printf("Enter your Name:");
gets(j);
clrscr();
n=strlen(j);
settextstyle(4,0,10);
i=x;
while(i!=-25*n)
{
outtextxy(i,y,j);
i--;
clearviewport();
}
getch();
closegraph();
}
+ 1
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm,x,y,n,i=0;
char j[100];
clrscr();
initgraph(&gd,&gm,"C:\\TC\\BGI");
x=getmaxx();
y=getmaxy()/4;
printf("Enter your Name:");
gets(j);
clrscr();
n=strlen(j);
settextstyle(4,0,10);
i=x;
while(i!=-25*n)
{
outtextxy(i,y,j);
i--;
clearviewport();
}
getch();
closegraph();
}
+ 1
I sadly dont know conio.h and havent worked with graphics.h.
But it looks like you are clearing your vieport after you write something.
Try clearviewport before the outtexty.
0
You can look for double buffering to prevent flickering.
But there are many reasons why your specific code could flicker. Can you show us your code?
0
Saree kanukuntaaaa le raa badhapadadhuuu