← Back to Community
NON-BLOCKING UNBUFFERED CONSOLE INPUT in C++
Profile icon
SPQR

Console input which runs in parallel to the rest of the program (and for which pressing Enter isn't necessary) via CPU threading.

Just a proof of concept at this point, press a key and it'll repeat it back to you with an "FPS" counter running in parallel to prove that it works

Join my Discord server for development of the games i'm making here: https://discord.gg/wTTZ6G (is empty rn)
If that's self promotion and if that's not allowed I'll delete that last bit :P

Voters
Profile icon
ManuelSanGT
Profile icon
LorranaTenorio
Profile icon
wilfredofuturi
Profile icon
abc3354
Profile icon
MarcusWeinberger
Profile icon
21natzil
Profile icon
Zavexeon
Profile icon
SPQR
Comments
hotnewtop
Profile icon
[deleted]

a switch case would help cleanup your janky if statements from 46 to 52 in input.hpp

switch (game.lastKeyPressed) { case 'x': game.stop(); break; case 'w': {} break; case 'a': {} break; case 's': {} break; case 'd': {} break; default: break; }
Profile icon
Zavexeon

Coolio.