Switching between bitmaps and writing to the console

So I am making a game and I want to be able to switch between bitmap scenes and writing directly to the console. I have bitmaps writing to the screen and I can switch between bitmaps, but when I try to write to the console via printf or from a file, it is written behind the bitmap, and therefore cannot be seen.

So far I have tried all the methods listed on this link, http://cplusplus.com/forum/general/8145/, and no such luck. Also system("cls") does not work.

Pretty much, I'm wondering if anyone knows how to clear the screen after loading a bitmap to the screen. Also as a side note, this is for a school project and I have to stay in C, but if anyone knows anything, would be much appreciated!
Last edited on
You shouldn't be using the console at all. I don't even know how you figured out how to draw bitmaps to the console, it's kind of an insane task.

Read this:
http://cplusplus.com/forum/articles/28558/

Get a game lib. I recommend SFML for C++ but if you must stick with C, then SDL is pretty good:

http://www.libsdl.org
Unfortunately, I'm not sure that we can use any outside libraries, and regardless of how difficult or how bad it is to make a console game, it -is- our assignment. It unfortunately has to be in C, and the bitmap stuff wasn't actually so bad.

Thank you for the recommendations. I will look into them, but I don't think I can use them for this particular problem.
Get the font height of the console (either directly with GetConsoleFontSize() or indirectly by calculating how many lines there are and the console dimensions from GetConsoleScreenBufferInfo()),
then before you draw your bitmap on the console screen make sure to output enough newlines to draw past the height of the image.

Good luck!
Figured it out! I was switching between two screenbuffers and setting one to be the permanent active buffer. In finding this, I just switched to the game buffer using SetConsoleActiveScreenBuffer and it works!!! Yay
Topic archived. No new replies allowed.