Clearing/rewriting screen with no delay?
Currently in my console based RPG, the logic is as follows:
if left/right/up/down are pressed, move P in that direction.
Wait 100 MS, then continue.
if left/right/up/down are NOT pressed, goto the loop before checking to see if they ARE pressed.
There's no flicker when I'm not moving. But every move has flicker...
Is there a way to remove the flicker? I currently use system("cls") to clear the screen, then my DisplayMap(); to Write to the screen.
If there's anyway at all to even JUST clear the player's character and then re-write the player's character that would be AMAZING.
Nope, there's no way to clear the screen without system("cls"). I've read about this before, can't remember why.
I HAVE read a way to clear the screen using a homemade function, so I was kind of hoping. Ah well. Super flickering game foreva then.
I'm not too great with this. I'll try it out when I get home.
I need to create a console buffer, or can I just use
CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
csbiInfo.dwCursorPosition.X = PlayerX;
csbiInfo.dwCursorPosition.Y = PlayerY;
Also, can I use cout still to write to the screen, or do I have to use
LPSTR lpszPrompt1/2/3/4/5 etc.
I'm not great with high level input/output functions..
I dont know if i got what you want, but maybe....
void Navigate(){
if(Key1){
system("cls");
cout << "shit" << endl;
}
//hotkeys shit
}
//main(), while(1) loop
if(key1 || key2 || key){
Navigate();
}
That way, only if the key is pressed it will clear..So it will not blink, is that what you want?
I used something like that a while ago and worked