can anyone tell me what are these two lines for:
kdeltas = kstates ^ buttons; //
kstates = buttons;
can anyone tell me what are these two lines for:
kdeltas = kstates ^ buttons; //
kstates = buttons;
^ is the symbol for binary xor. kdeltas is equal to kstates where a bit is inverted if that bit in buttons is on. the second statement just assigns buttons to kstates
In other words:
buttons is a set of bits, like any integer is a set of bits. Somewhere your program set buttons as something so that the program could later specify the states to trigger.
kstates is also a set of bits, where each bit is a state of true or false. when xor'ed with buttons, some states in kstates can be switched to their opposite
kdeltas just stores the value produced by kstates