c++ - Clear input command line? -
i'm making console application. starts menu if press key; 1. menu changes menu screen. note, without me pressing 'enter'. means 1 still remains, bad when stepping down further in menus.
how clear input command line?
the function im using.
if(getasynckeystate('1')) { ieventdataptr gamestate(gcc_new evtdata_set_game_state("pregamestate")); em->vtriggerevent(gamestate); //enter line clearing code. }
the function getasynckeystate
gives "the current state of key". return true between point when keyboard driver has received "key 1 has been pressed" until keyboard driver receives "key 1 has been released".
i suggest use readconsoleinput
instead if want 1 keypress @ time.
the alternative use this:
while(getasynckeystate('1')) { // nothing. }
to wait key released.
Comments
Post a Comment