Question

I am trying to create a rougelike, and I am using windows for the different layers. The bottom most one is the map, and the one above that is the entity layer. I have the player character, and I want to move them around on the screen. I am printing a new @ (the way the player is represented) to where they move, and I am trying to put a blank space to where the character was, so that you can see the map layer where before you couldn't. I tried using NULL, but it outputs ^@. Any idea what I can use?

Était-ce utile?

La solution

Use a blank character, ' ', or if you prefer just 32 or 0x20.

NULL is actually defined as:

#define NULL 0

So you are writing the character with ASCII code 0, that is a NUL character, sometimes represented as Ctrl+@, or ^@.

Autres conseils

On modern day machines clearing the screen and redrawing the whole screen completely after each edit would probably not cause too much performance issues. I know it's not the most optimal solution, but it gets rid of that kind of trail artifacts for good.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top