2
\$\begingroup\$

I create a Window XNA game project from the template in Visual studio 2015. Then I right click and set the property to console application because I think it is convinient to use Console.WriteLine() for debugging.

console application

In the game constructor I add

graphics.PreferredBackBufferWidth = 1920;
graphics.PreferredBackBufferHeight = 1080;
graphics.IsFullScreen = true;

Now the console text flicker. I use Console.Clear() the first thing I do in Update(). When I run the game in a window then the console text do not flicker. I even add counter to not update the text every time Update() is called and the console text still flicker in full screen mode. The same problem is there when I start form Windows Powershell. (The exact same thing do not flicker with MonoGame though.)

\$\endgroup\$
  • 2
    \$\begingroup\$ When there is no console, by default Console.WriteLine() writes to the output window/tab in Visual Studio. If you can't find a fix for the flickering, that can still work for you. \$\endgroup\$ – Icy Defiance Dec 28 '15 at 14:32
1
\$\begingroup\$

The flicker you see is the result of clearing the console which is being displayed by the graphic card, then text get drawn and "reappear".

It's only by sheer luck that it didn't flicker before.

Using the Console.Clear() command will "always" make the console text flicker. It's not designed to redraw text like this.

Invest time in making your own virtual terminal console that you can display in a separate window or as an overlay over your game with the option of writing the text to a log file and possibly a command line.

It'll make it easier later to test your game by typing cheat commands.

You can probably get this done in a day or two.

\$\endgroup\$
  • \$\begingroup\$ I don't have that experience. I worked with loads of console application that use "clear" in one form of another to keep numbers updated in real time and it never flickered before. Both in terminal only and in windowed mode. \$\endgroup\$ – Lord Wolfenstein Jul 8 '16 at 19:22
0
\$\begingroup\$

Utilize double buffering when you draw to eliminate flickering. Instead of displaying debug information through the console draw your own output onto your game screen in whatever way you see fit.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.