Results 1 to 9 of 9

Thread: What is "Enter" key value?

  1. #1
    Member Contributor
    Join Date
    May 2001
    Location
    Malaysia
    Posts
    54

    What is "Enter" key value?

    Hai!

    What is "Enter" key value? And where to put it(special func or keyboard func)?

    Example: Ecs=27 (keyboard func)
    Up Arrow=GLUT_KEY_UP (special func)
    Enter=?? (?? func)

    I hope this can be understand.

  2. #2
    Senior Member Regular Contributor
    Join Date
    Sep 2000
    Location
    Italy
    Posts
    124

    Re: What is "Enter" key value?

    If it is a "keyboard func", it must be 13.
    tFz

  3. #3
    Member Contributor
    Join Date
    May 2001
    Location
    Malaysia
    Posts
    54

    Re: What is "Enter" key value?

    Thanks Teofuzz

    Err...How about space bar?

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: What is "Enter" key value?

    32 if I remember correctly.

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Adelaide, South Australia, Australia
    Posts
    763

    Re: What is "Enter" key value?

    Howdy,

    yep, we could all throw ascii values around until the cows come home (or, until we've covered all 255 of them, and then we can move onto java's 16bit character. heh heh)

    You don't need to do

    Code :
    char c;
    if(c==(char)32)
    because you can just do:

    Code :
    char c;
    if(c=='\n') { /* press ENTER' */ } 
    else if(c==' ') { /* press SPACE' */ }
    else if(c=='A') { /* press .. er... uhm... */
    }
    and so on. Also, if you REALLY want to know the magically cool keys, like the cursors, then you can easily write a simple program to print out the value your glut keyboard function is called with, and then just look at the numbers... =)

    cheers
    John




    [This message has been edited by john (edited 05-28-2001).]

  6. #6
    Member Contributor
    Join Date
    May 2001
    Location
    Malaysia
    Posts
    54

    Re: What is "Enter" key value?

    Hello!

    Thanks to all. This really help me! But did all the keys has their ascii value? For example SHIFT key?

  7. #7
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: What is "Enter" key value?

    All keys that has a direct character mapped to it has an ascii code. Shift is a, uuh, what's it called, dead/silent key (?). Never mind. Shift does not work alone, like 'A' and Enter. It has a scan code (the code generated by the keyboard which is, in turn, translated to a character), but no ascii code. This is why you have to use GLUT's special key function.

  8. #8
    Member Contributor
    Join Date
    May 2001
    Location
    Malaysia
    Posts
    54

    Re: What is "Enter" key value?

    Hai! This will maybe out off the original topic.

    I create a first person camera walking in a world using the UP,DOWN,LEFT,RIGHT key. When the user press the 'R' key, the camera will move faster.

    I use glutIgnoreKeyRepeat to make my app runs faster. Each time a key is pressed, it will return a TRUE value and when the key is released, it will return a FALSE value.

    Here's my pseudecode:

    void keyboardPress(...)
    { if(key=='R')R_key_pressed=TRUE; }

    void keyboardRelease(...)
    { if(key=='R')R_key_pressed=FALSE; }

    void specialPress() {...}
    void specialRelease() {...}

    void idle()
    { int speed=10;
    if(R_key_pressed)speed=20;
    if(Up_key_pressed)moveMeFlat*speed;
    ...
    glutPostRedisplay();
    }

    My question is, how can I change the 'R' key to SHIFT key? Can anybody show me the code?

  9. #9
    Guest

    Re: What is "Enter" key value?

    Might Try VK_SHIFT or I DONT KNOW WHAT THIS IS REALLY FOR but it might work GLUT_ACTIVE_SHIFT

Similar Threads

  1. Can't enter game mode under linux with Glut
    By goldangel in forum OpenGL: General
    Replies: 2
    Last Post: 08-31-2002, 09:06 PM
  2. Enter Command from prompt.
    By in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 08-10-2001, 06:31 AM
  3. does anyone knows how to make 3d studio max files enter my code
    By ryariv in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 04-21-2000, 12:28 PM
  4. darker while enter selection mode...
    By SiuBanana in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 03-04-2000, 01:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean