PDA

Click to See Complete Forum and Search --> : Flickering!!!!!!!


SteveCRM
Feb 4th, 2001, 12:26 PM
Okay I've gotten a character to bounce around a console window...but now how do I make it stop flickering??? This for example:

#include <iostream.h>
#include <windows.h>
#include <conio.h>
int dummy;

void pause(unsigned long amount);
int main()
{
float Yspeed = 1;
float Xspeed = 1;
float x = 10;
float y = 10;

cout<<"o Mover: By Steve Mack"<<endl<<"Use the keypad to move (5 to exit)"<<endl;
pause(2000);
while(x!=1000)
{
int i;
for(i=1;i<=y+10;i++)
{
cout<<endl;
}
for(i=1;i<=x;i++)
{
cout<<" ";
}
cout<<"o"<<endl;
for(i=1;i<=25-y;i++)
{
cout<<endl;
}
x=x+Xspeed;
y=y+Yspeed;
if(x>=79 || x<=1)
{
Xspeed=Xspeed*-1;
}
if(y>=25 || y<=2)
{
Yspeed=Yspeed*-1;
}
pause(400);
cout<<endl<<endl<<endl<<endl<<endl<<endl<<endl;
}
cin>>dummy;
return 0;
}

void pause(unsigned long amount)
{ //creates a delay with the duration of amount.
unsigned long t = GetTickCount();
while((GetTickCount() - t) < amount);
}


feel free to play with the pauses(by denniswrenn), I want it to go pretty fast but without the flickering. :(

HarryW
Feb 4th, 2001, 01:10 PM
I think the flickering is just a product of the fact that using console text is a crappy way to do graphics :) It's nothing wrong with your code, it's just that the console can't keep up with you.

have you tried it in full-screen mode? It doesn't look as bad like that, although there is still some flickering when the O is high in the screen.

SteveCRM
Feb 4th, 2001, 04:49 PM
How do I do that? You mean like setting it to 0X13?

parksie
Feb 4th, 2001, 04:52 PM
Not necessarily -- you could just use Alt-Enter while it's executing.

SteveCRM
Feb 4th, 2001, 04:53 PM
speaking of that...is there any good graphics tutorials?