opengl 里 state==GLUT_DOWN 这句是什么意思??
if(button==GLUT_LEFT_BUTTON){if(state==GLUT_DOWN){mousedown=true;loopr=false;}elsemou...
if(button == GLUT_LEFT_BUTTON)
{
if(state == GLUT_DOWN)
{ mousedown = true; loopr = false;}
else
mousedown=false;
}
if (button== GLUT_RIGHT_BUTTON)
{if(state == GLUT_DOWN)
loopr=true; glutTimerFunc(200,timer,0);
上下文 展开
{
if(state == GLUT_DOWN)
{ mousedown = true; loopr = false;}
else
mousedown=false;
}
if (button== GLUT_RIGHT_BUTTON)
{if(state == GLUT_DOWN)
loopr=true; glutTimerFunc(200,timer,0);
上下文 展开
2个回答
展开全部
if(state == GLUT_DOWN) //callback was due to a press (of a mouse button)
//相当于“如果某个鼠标键被按下”
if(state == GLUT_UP) //callback was due to a release (of a mouse button)
//相当于“如果某个鼠标键被放开(弹起)”
if (button== GLUT_LEFT_BUTTON) //callback was due to a release/press of the LEFT button
//相当于“如果鼠标左键被按下或者被放开”
if (button== GLUT_RIGHT_BUTTON) //callback was due to a release/press of the RIGHT button
//相当于“如果鼠标右键被按下或者被放开”
if (button== GLUT_MIDDLE_BUTTON) //callback was due to a release/press of the MIDDLE
//button
//相当于“如果鼠标中键被按下或者被放开”
因此,
if(button == GLUT_LEFT_BUTTON)
{
if(state == GLUT_DOWN)
……
//相当于“如果鼠标左键被按下”
if(button == GLUT_RIGHT_BUTTON)
{
if(state == GLUT_DOWN)
……
//相当于“如果鼠标右键被按下”
//相当于“如果某个鼠标键被按下”
if(state == GLUT_UP) //callback was due to a release (of a mouse button)
//相当于“如果某个鼠标键被放开(弹起)”
if (button== GLUT_LEFT_BUTTON) //callback was due to a release/press of the LEFT button
//相当于“如果鼠标左键被按下或者被放开”
if (button== GLUT_RIGHT_BUTTON) //callback was due to a release/press of the RIGHT button
//相当于“如果鼠标右键被按下或者被放开”
if (button== GLUT_MIDDLE_BUTTON) //callback was due to a release/press of the MIDDLE
//button
//相当于“如果鼠标中键被按下或者被放开”
因此,
if(button == GLUT_LEFT_BUTTON)
{
if(state == GLUT_DOWN)
……
//相当于“如果鼠标左键被按下”
if(button == GLUT_RIGHT_BUTTON)
{
if(state == GLUT_DOWN)
……
//相当于“如果鼠标右键被按下”
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询