t2:keymapping

keymapping


keymapping — Configure keyboard mapping

Description


bool keymapping(const uint8 map[]);
bool keymapping();

Configure the keyboard mapping according with map[] parameter or call keymapping() without parameter to disable the default mapping. Once the keyboard mapping is configured, it remains active until the memory slot is unloaded or keymapping_reset() is called.

The function keymapping() is equivalent to a Keyboard Mapping created using the Input Translator interface on Gtuner IV.

Parameters


  • map[]: Constant array of a variable number of mapping pairs that defines an keyboard mapping.

Return Value


Returns true if the keyboard mapping was successfully loaded, or FALSE if the keyboard mapping failed to load.

keymapping() fails to load an new mapping if there is an Input Translator with Keyboard Mapping already loaded by the user.

Examples


Example #1 keymapping() example

#include <keyboard.gph>
 
init {
    // Load an Keyboard Mapping to reproduce the default BF1 layout
    const uint8 map[] = {
        KEY_W,          STICK_2_Y | KEYMAP_NEGATIVE, 
        KEY_A,          STICK_2_X | KEYMAP_NEGATIVE, 
        KEY_S,          STICK_2_Y, 
        KEY_D,          STICK_2_X, 
        KEY_R,          BUTTON_17, 
        KEY_SPACEBAR,   BUTTON_16, 
        KEY_Z,          BUTTON_15, 
        KEY_LEFTSHIFT,  BUTTON_9, 
        KEY_F,          BUTTON_6, 
        KEY_G,          BUTTON_7, 
        KEY_Q,          BUTTON_4, 
        KEY_T,          BUTTON_10, 
        KEY_3,          BUTTON_12, 
        KEY_4,          BUTTON_13, 
        KEY_V,          BUTTON_11, 
        KEY_TAB,        BUTTON_3, 
        KEY_M,          BUTTON_18, 
    };
    keymapping(map);
}

See Also

t2/keymapping.txt · Last modified: 2020/04/21 06:26 by J2Kbr