Displaying evrything at once without flicker

My application requires that I display everything fast enough that there appears to be no flicker. Let me put it like this:

I have a char array of 100x100,and I display little bits of that at a time, a 20x20 grid. When W is pressed, the screen shifts upward on the grid, displaying an additional line, but removing a line from the bottom. The thing is,system("CLS") is too much, so I've been using a function that involves setting the cursor at the place that needs to refresh, and then resetting it after everything is set. BUT, because everything on the screen gets shifted, this would ultimately be pointless. cout displays okay, but there is an epilepsy-inducing flicker associated with it, putchar just plain reeks...

so, does anybody have an idea as to how I could display everything instantly, or impercievably fast?

Examples would include Dwarf Fortress map-scrolling system.
You'd have to find a way to prevent the console from flushing. It would need to keep all data buffered until you've printed everything, at which point you would want it to flush and print everything in one go.

Unfortunately I have no idea how to do this. It's also not a common enough problem that it's easy to find an answer to; most console programs don't do this nor have any need to.

Maybe someone else can help -- but at least I was sort of able to tell you what to search for.


PS:

If this is for a game.... this is just one of many reasons why the console is a very poor medium for a game. Consider drawing to an actual window. 100x easier.
Last edited on
on the Dwarf Fortress pages I found a code base in source code form for an old game, which I would assume is similar to that game client and server situation of Dwarf Fortress

http://www.bay12games.com/lcs/

I don't know if it what you are looking for. I see what you are asking about but I would work or tweak things to see if I could get there. My first thought it was developed through SDL or SFML for a refined control of the console window. The other thought it uses (n)Curses and was compiled on Mingw or cygwin.

edit: I was also reading some of the other source codes and it jumps out to OpenGL stuff for things, which would require mapping your own graphics.

If I look at Dwarf Fortress a little closer it is an SDL app or a legacy nCurses. I can find the tiles for the console style window for the SDL version and the Legacy would be the same.
Last edited on
hey thanx for the share man......me and a programmer friend have been trying to figure this out....i don't know much about it except that the screen kept flickering......apparently my my friend was also unable to solve it....thanx .....










_________________________
http://www.musicgameslist.com
http://www.stickgameslist.com
I looked at the Liberal Crime Squad source code, and I learned they use ncurses. I finally decided to go ahead and give it a try, and it works really good.
Topic archived. No new replies allowed.