Intranet Catprocess
  1. news...
  2. about Blackvoxel
  3. download
  4. manual
  5. videos
  6. about us
  1. GetKey

    Description

    bool GetKey(integer Keycode)

    GetKey() function give the status of the specified key on the keyboard to knows if it is pushed or not.
    This function can handle detection of several keys pushed at the same time. But remember a lot of non gaming keyboards are subjet to key ghosting problems. So use multiple keys capability carefully.

    Parameters

    Keycode : The code of the key to test.

    Return Value

    A boolean value depending on the status of the specified key. True means the key is pushed, false mean it is released.

    Example of use

    Try this program to know the keycode associated with a given key. Informations outputs on the terminal. Use Blackvoxel in windowed mode for looking at the terminal.

    // Listing #1: Keyboard polling.

    function Voxel_Step()
    {
    local i;

    for (i=0;i<1024;i++)
    {
    if (GetKey(i)) print("Key Pressed : " + i + " ");
    }
    }

    See Also

     

     

     
  2. Google+