Share your repls and programming experiences

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

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).

Voters
Dunce
EpicGamer007
DynamicSquid
ANDREWVOSS
Comments
hotnewtop
DynamicSquid

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

How did you clear the screen?

realTronsi

@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

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

ANDREWVOSS

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