Share your repls and programming experiences

← Back to all posts
C++ 2d Game starter

An easy-to-use game starter with builtin classes for basic graphics and some code for basic movement and controls. Also has conditional compilation, so you can run it on your PC (Windows or Linux).

DynamicSquid (4899)

Nice! I like how there's almost no flickering :)

How did you clear the screen?

realTronsi (926)

@DynamicSquid flickering usually comes from terminal buffering. He enables raw mode, which if I recall does disable some of this bbuffering. Also with terminal games you don't clear and redraw every "frame" per se, you can use escape sequences to move your cursor around and clear specific pixels. Even if you were to use escape sequences to clear the entire console, that would be usually faster than any native console clearing commands as it doesn't require a bunch of intermediate steps which are used for buffering, formatting, etc.

DynamicSquid (4899)

@realTronsi Oh okay. That's very similar to the way Windows does it, which I'm more familiar with


@DynamicSquid Yeah. It uses the ANSI escape code for clearing parts of the screen, which behaves a little weird on Windows and Ubuntu.