This should be a simple one. I am trying to rewrite this MouseCallback function. It is a Gluts MouseCallback function not that it matters i guess. I ran across a set of statements which im pretty sure are conditoinal statements. but i have never seen this kind of set up for a conditional statement before.
mouseLClickButton |= (button == GLUT_LEFT_BUTTON && state == GLUT_DOWN); mouseRClickButton |= (button == GLUT_RIGHT_BUTTON && state == GLUT_DOWN); mouseMClickButton |= (button == GLUT_MIDDLE_BUTTON && state == GLUT_DOWN); mouseLClickButton &= !(button == GLUT_LEFT_BUTTON && state == GLUT_UP); mouseRClickButton &= !(button == GLUT_RIGHT_BUTTON && state == GLUT_UP); mouseMClickButton &= !(button == GLUT_MIDDLE_BUTTON && state == GLUT_UP);
can some one explain what the first set of operators are saying. |= and &=
im assuming that the first three are conditional statements for individual button presses and the second three are for multiple button presses. But i would just like an explanation of what exactly is going on here with the syntax. I have never seen anything like that.
mouseClickButton are all bools. im guessing that if the contitional statement on the right of the operator is tru then it makes that bool on the left tru but its just kind of confusing to me.
Edited by greenzone, 27 June 2013 - 07:59 PM.