Pretoze ked si pozries, ako su
reprezentovane zaporne cisla v pamati, tak zistis, ze cislo -32767 je v dvojkovej sustave 1000000000000001, cize je nastaveny prvy a posledny bit. Ked si potom pozries
dokumentaciu k funkcii GetAsyncKeyState, zistis, ze sa tam pise:
msdn píše:
If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState.
Mohol som ti to napisat aj takto:
Kód:
if( GetAsyncKeyState( c ) == 0x8001 )
alebo takto:
Kód:
if( ( GetAsyncKeyState( c ) & 0x8001 ) == 0x8001 )
a tak dalej a tak dalej, ale stale sa jedna o ten isty zapis 16-bitoveho cisla, ktore ma nastaveny prvy a posledny bit.