Created
December 18, 2022 10:54
-
-
Save lyf-is-coding/08ff4a95fc6dc9ecb6084e0e442cc16f to your computer and use it in GitHub Desktop.
Revisions
-
lyf-is-coding created this gist
Dec 18, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #include <Windows.h> int main() { const int keyW = 0x57; while(true) { if (GetAsyncKeyState( keyW ) & 0x8000) { std::cout << "key is held down\n"; } else if (GetAsyncKeyState( keyW ) & 0x0001) { // only excute 1 time after key is pressed std::cout << "key is pressed\n"; } else { std::cout << "no key interaction\n"; } } }