c++ - Key down functions -
hey how make in c++: have variable, , when press key '+' should increase one, when press , hold key more 500ms, variable should start increasing 5 every 500ms while still holding button down, , should stop when release it. know of getactivekeystate() function, can't seem make work way want. how this?
i don't know native c++ functions it's doable sfml libraries.
if (event.type == event::keypressed){ if (sf::keyboard::iskeypressed(sf::keyboard::add)) { //start counter if(count < 5) sum++; else sum+=5; } } you can same thing winapi in both cases you'll need use multithreading/multiprocessing counter, or find way sync code. try adding sleep(500) sleep thread 500ms or similar.
Comments
Post a Comment