|
-
Feb 4th, 2001, 01:26 PM
#1
Thread Starter
Frenzied Member
Okay I've gotten a character to bounce around a console window...but now how do I make it stop flickering??? This for example:
PHP Code:
#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.
-
Feb 4th, 2001, 02:10 PM
#2
Frenzied Member
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.
Harry.
"From one thing, know ten thousand things."
-
Feb 4th, 2001, 05:49 PM
#3
Thread Starter
Frenzied Member
How do I do that? You mean like setting it to 0X13?
-
Feb 4th, 2001, 05:52 PM
#4
Monday Morning Lunatic
Not necessarily -- you could just use Alt-Enter while it's executing.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 4th, 2001, 05:53 PM
#5
Thread Starter
Frenzied Member
speaking of that...is there any good graphics tutorials?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|