Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: need to process both normal and special keys for keyUp status

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Regular Contributor
    Join Date
    May 2017
    Posts
    101

    need to process both normal and special keys for keyUp status

    How do I use if (key==number){do stuff;} instead of

    Code cpp:
    switch (key) {
            case GLUT_KEY_LEFT : pGv->deltaAngle = 0.0f; break;//pGv->strafe_left = false; break;
            case GLUT_KEY_RIGHT : pGv->deltaAngle = 0.0f;break;//pGv->strafe_right = false; break;
            case GLUT_KEY_UP : pGv->deltaMove = 0.0f;break; //was deltaAngle CHANGE to DeltaAngle constantly move forward
            case GLUT_KEY_DOWN : pGv->deltaMove = 0.0f;break;
            case (97): std::cout<<".."; break;
        }

    the reason is that I want to process keyUp with both normal keys and special and they are already a mixture of if (key==) and case(key) statements. Of course if you know the better way I'm all ears. I know that if(key==) is supposed to be equivalent to case(key) switch but I can't detect the up arrow with the key==arrow number.

    Thanks in advance
    Last edited by Dark Photon; 12-31-2017 at 04:11 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •