DIK KeyCodes: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (fixed typo)
(Add French Keyboard Key)
Line 493: Line 493:
|  ||  || 210 || INSERT ||  ||
|  ||  || 210 || INSERT ||  ||
|}
|}
=French keyboard=
{| class="wikitable" style="text-align:center"
|-
| 1 || ESC || 11 || 0 || 21 || Y
|-
| 2 || 1 || 12 || ) || 22 || U
|-
| 3 || 2 || 13 || = || 23 || I
|-
| 4 || 3 || 14 || BACKSPACE || 24 || O
|-
| 5 || 4 || 15 || TAB || 25 || P
|-
| 6 || 5 || 16 || A || 26 || ^
|-
| 7 || 6 || 17 || Z || 27 || $
|-
| 8 || 7 || 18 || E || 28 || ENTER
|-
| 9 || 8 || 19 || R || 29 || CTRLG
|-
| 10 || 9 || 20 || T || 30 || Q
|-
|  ||  ||  ||  ||  ||
|-
| 31 || S || 41 || ² || 51 || ;
|-
| 32 || D || 42 || SHIFTL || 52 || :
|-
| 33 || F || 43 || * || 53 || !
|-
| 34 || G || 44 || W || 54 || SHIFTR
|-
| 35 || H || 45 || X || 55 || NUM_*
|-
| 36 || J || 46 || C || 56 || ALT
|-
| 37 || K || 47 || V || 57 || SPACE
|-
| 38 || L || 48 || B || 58 || CAPS
|-
| 39 || M || 49 || N || 59 || F1
|-
| 40 || ù || 50 || , || 60 || F2
|-
|  ||  ||  ||  ||  ||
|-
| 61 || F3 || 71 || NUM_7 || 81 || NUM_3
|-
| 62 || F4 || 72 || NUM_8 || 82 || NUM_0
|-
| 63 || F5 || 73 || NUM_9 || 83 || NUM_.
|-
| 64 || F6 || 74 || NUM_- ||  ||
|-
| 65 || F7 || 75 || NUM_4 ||  ||
|-
| 66 || F8 || 76 || NUM_5 || 86 || <
|-
| 67 || F9 || 77 || NUM_6 || 87 || F11
|-
| 68 || F10 || 78 || NUM_+ || 88 || F12
|-
| 69 || NUM || 79 || NUM_1 ||  ||
|-
| 70 || SCROLL || 80 || NUM_2 ||  ||
|-
|  ||  ||  ||  ||  ||
|-
| 156 || NUM_ENTER || 200 || UP || 211 || DELETE
|-
| 157 || CTRLR || 201 || PAGEUP || 219 || WINR
|-
|  ||  || 220 || WINL || ||
|-
| 181 || NUM_/ || 203 || LEFT || 221 || APP
|-
| 183 || PRINT ||  ||  ||
|-
| 184 || ALTGR || 205 || RIGHT || NOT DEFINED || +
|-
|  ||  ||  ||  ||  ||
|-
| 197 || PAUSE || 207 || END ||  ||
|-
| 199 || POS1 || 208 || DOWN ||  ||
|-
|  ||  || 209 || PAGEDOWN ||  ||
|-
|  ||  || 210 || INSERT ||  ||
|}
[[Category:Reference Lists]]
[[Category:Reference Lists]]

Revision as of 14:02, 3 December 2017

Introduction

Each key on any keyboard has a unique Direct Input Keyboard (DIK) code. They are not character symbols.

The prime purpose of DIK is to recognise key strokes that cannot be represented in character equivalents. Function Keys eg. There is no character set code for F12.

  • Any other purpose is unreliable.
  • Function Key positions aren't necessarily accross the top. Their DIK Codes however, remain the same,
  • Unique DIK codes exist for numeric pad '9' versus standard key '9'. These are key-codes, not, characters.

Using DIK to detect the 'S' key depends on keyboard layout. Qwerty versus Dvorak eg. Or French versus Arabic.


As defined below, the assumption is a US QWERTY Layout.

Game designers operate within the constraints of

  • ergonomic needs: navigation buttons need garanteed finger positions (W,A,S,D eg)
  • controls: (Alt Ctl, Shift, Fx) which can be anywhere.

To guarantee ergonomic needs, a QWERTY keyboard is assumed with Western European key variances avoided / not used.

Dik codes are always accompanied by the state of the shift, alt, and ctrl keys. Any script can differentiate between 'Q' and Alt-Q (should it wish to).

OnkeyDown passes _this array as:

_DisplayOrDialogOrControl = _this select 0; // Display, Dialog , or Control
_DikCode=                   _this select 1; // integer
_shiftState =                 _this select 2; // boolean
_ctrlState =                  _this select 3; // boolean
_altState =                    _this select 4; // boolean

Codes

These DIK code #defines, refer to a US QWERTY layout.

In otherwords treat any character label as representative of the fixed in concrete key code, not, the 'character' itself.

Headers

Regardless of original source, these are bis declarations. They are free to change the rules whenever it suits them. Depending on context: you *might* be better off making copies of these, current, headers so that your scripts and your configs know what you're talking about.

VBS2

To use these predefined codes, have the following include statement in your script or config:

#include "\vbs2\headers\dikCodes.hpp"

Personal Tools

#include "\bin\dikCodes.h"

Defines

Alphabetic sort

F1..15

DIK_F1              0x3B
DIK_F2              0x3C
DIK_F3              0x3D
DIK_F4              0x3E
DIK_F5              0x3F
DIK_F6              0x40
DIK_F7              0x41
DIK_F8              0x42
DIK_F9              0x43
DIK_F10             0x44
DIK_F11             0x57
DIK_F12             0x58
DIK_F13             0x64    /*                     (NEC PC98) */
DIK_F14             0x65    /*                     (NEC PC98) */
DIK_F15             0x66    /*                     (NEC PC98) */

0..9

DIK_0               0x0B
DIK_1               0x02
DIK_2               0x03
DIK_3               0x04
DIK_4               0x05
DIK_5               0x06
DIK_6               0x07
DIK_7               0x08
DIK_8               0x09
DIK_9               0x0A
DIK_NUMPAD0         0x52
DIK_NUMPAD1         0x4F
DIK_NUMPAD2         0x50
DIK_NUMPAD3         0x51
DIK_NUMPAD4         0x4B
DIK_NUMPAD5         0x4C
DIK_NUMPAD6         0x4D
DIK_NUMPAD7         0x47
DIK_NUMPAD8         0x48
DIK_NUMPAD9         0x49

alpha

DIK_A               0x1E
DIK_B               0x30
DIK_C               0x2E
DIK_D               0x20
DIK_E               0x12
DIK_F               0x21
DIK_G               0x22
DIK_H               0x23
DIK_I               0x17
DIK_J               0x24
DIK_K               0x25
DIK_L               0x26
DIK_M               0x32
DIK_N               0x31
DIK_O               0x18
DIK_P               0x19
DIK_Q               0x10
DIK_R               0x13
DIK_S               0x1F
DIK_T               0x14
DIK_U               0x16
DIK_V               0x2F
DIK_W               0x11
DIK_X               0x2D
DIK_Y               0x15
DIK_Z               0x2C

Controls

DIK_ESCAPE          0x01
DIK_TAB             0x0F
DIK_LSHIFT          0x2A
DIK_RSHIFT          0x36
DIK_LCONTROL        0x1D
DIK_RCONTROL        0x9D
DIK_BACK            0x0E    /* backspace */
DIK_BACKSPACE       DIK_BACK
DIK_RETURN          0x1C    /* Enter on main keyboard */
DIK_NUMPADENTER     0x9C    /* Enter on numeric keypad */
DIK_LMENU           0x38    /* left Alt */
DIK_LALT            DIK_LMENU
DIK_SPACE           0x39
DIK_CAPITAL         0x3A    /* capslock */
DIK_CAPSLOCK        DIK_CAPITAL 
DIK_NUMLOCK         0x45
DIK_SCROLL          0x46    /* Scroll Lock */
DIK_RMENU           0xB8    /* right Alt */
DIK_RALT            DIK_RMENU           /* right Alt */

Graphics

DIK_AT              0x91    /*                     (NEC PC98) */
DIK_COLON           0x92    /*                     (NEC PC98) */
DIK_UNDERLINE       0x93    /*                     (NEC PC98) */
DIK_MINUS           0x0C    /* - on main keyboard */
DIK_EQUALS          0x0D
DIK_LBRACKET        0x1A
DIK_RBRACKET        0x1B
DIK_SEMICOLON       0x27
DIK_APOSTROPHE      0x28
DIK_GRAVE           0x29    /* accent grave */
DIK_BACKSLASH       0x2B
DIK_COMMA           0x33
DIK_PERIOD          0x34    /* . on main keyboard */
DIK_SLASH           0x35    /* / on main keyboard */
DIK_MULTIPLY        0x37    /* * on numeric keypad */
DIK_NUMPADSTAR      DIK_MULTIPLY 
DIK_SUBTRACT        0x4A    /* - on numeric keypad */
DIK_ADD             0x4E    /* + on numeric keypad */
DIK_DECIMAL         0x53    /* . on numeric keypad */
DIK_NUMPADEQUALS    0x8D    /* = on numeric keypad (NEC PC98) */
DIK_NUMPADMINUS     DIK_SUBTRACT        /* - on numeric keypad */
DIK_NUMPADPLUS      DIK_ADD             /* + on numeric keypad */
DIK_NUMPADPERIOD    DIK_DECIMAL         /* . on numeric keypad */
DIK_NUMPADSLASH     DIK_DIVIDE          /* / on numeric keypad */

KataKana

DIK_KANA            0x70    /* (Japanese keyboard)            */
DIK_ABNT_C1         0x73    /* / ? on Portugese (Brazilian) keyboards */
DIK_CONVERT         0x79    /* (Japanese keyboard)            */
DIK_NOCONVERT       0x7B    /* (Japanese keyboard)            */
DIK_YEN             0x7D    /* (Japanese keyboard)            */
DIK_OEM_102         0x56    /* < > | on UK/Germany keyboards */
DIK_ABNT_C2         0x7E    /* Numpad . on Portugese (Brazilian) keyboards */
DIK_PREVTRACK       0x90    /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */
DIK_KANJI           0x94    /* (Japanese keyboard)            */
DIK_STOP            0x95    /*                     (NEC PC98) */
DIK_AX              0x96    /*                     (Japan AX) */
DIK_UNLABELED       0x97    /*                        (J3100) */
DIK_NUMPADCOMMA     0xB3    /* , on numeric keypad (NEC PC98) */
/* Alternate names for keys originally not used on US keyboards. */
DIK_CIRCUMFLEX      DIK_PREVTRACK       /* Japanese keyboard */

Apps

DIK_NEXTTRACK       0x99    /* Next Track */
DIK_MUTE            0xA0    /* Mute */
DIK_CALCULATOR      0xA1    /* Calculator */
DIK_PLAYPAUSE       0xA2    /* Play / Pause */
DIK_MEDIASTOP       0xA4    /* Media Stop */
DIK_VOLUMEDOWN      0xAE    /* Volume - */
DIK_VOLUMEUP        0xB0    /* Volume + */
DIK_WEBHOME         0xB2    /* Web home */
DIK_SYSRQ           0xB7
DIK_PAUSE           0xC5    /* Pause */
DIK_APPS            0xDD    /* AppMenu key */
DIK_POWER           0xDE    /* System Power */
DIK_SLEEP           0xDF    /* System Sleep */
DIK_WAKE            0xE3    /* System Wake */
DIK_WEBSEARCH       0xE5    /* Web Search */
DIK_WEBFAVORITES    0xE6    /* Web Favorites */
DIK_WEBREFRESH      0xE7    /* Web Refresh */
DIK_WEBSTOP         0xE8    /* Web Stop */
DIK_WEBFORWARD      0xE9    /* Web Forward */
DIK_WEBBACK         0xEA    /* Web Back */
DIK_MYCOMPUTER      0xEB    /* My Computer */
DIK_MAIL            0xEC    /* Mail */
DIK_MEDIASELECT     0xED    /* Media Select */

ArrowKeypad

DIK_HOME            0xC7    /* Home on arrow keypad */
DIK_UP              0xC8    /* UpArrow on arrow keypad */
DIK_PRIOR           0xC9    /* PgUp on arrow keypad */
DIK_LEFT            0xCB    /* LeftArrow on arrow keypad */
DIK_RIGHT           0xCD    /* RightArrow on arrow keypad */
DIK_END             0xCF    /* End on arrow keypad */
DIK_DOWN            0xD0    /* DownArrow on arrow keypad */
DIK_NEXT            0xD1    /* PgDn on arrow keypad */
DIK_INSERT          0xD2    /* Insert on arrow keypad */
DIK_DELETE          0xD3    /* Delete on arrow keypad */
DIK_UPARROW         DIK_UP              /* UpArrow on arrow keypad */
DIK_PGUP            DIK_PRIOR           /* PgUp on arrow keypad */
DIK_LEFTARROW       DIK_LEFT            /* LeftArrow on arrow keypad */
DIK_RIGHTARROW      DIK_RIGHT           /* RightArrow on arrow keypad */
DIK_DOWNARROW       DIK_DOWN            /* DownArrow on arrow keypad */
DIK_PGDN            DIK_NEXT            /* PgDn on arrow keypad */

other

DIK_LWIN            0xDB    /* Left Windows key */
DIK_RWIN            0xDC    /* Right Windows key */

Numeric sort

DIK_ESCAPE          0x01
DIK_1               0x02
DIK_2               0x03
DIK_3               0x04
DIK_4               0x05
DIK_5               0x06
DIK_6               0x07
DIK_7               0x08
DIK_8               0x09
DIK_9               0x0A
DIK_0               0x0B
DIK_MINUS           0x0C    /* - on main keyboard */
DIK_EQUALS          0x0D
DIK_BACK            0x0E    /* backspace */
DIK_TAB             0x0F
DIK_Q               0x10
DIK_W               0x11
DIK_E               0x12
DIK_R               0x13
DIK_T               0x14
DIK_Y               0x15
DIK_U               0x16
DIK_I               0x17
DIK_O               0x18
DIK_P               0x19
DIK_LBRACKET        0x1A
DIK_RBRACKET        0x1B
DIK_RETURN          0x1C    /* Enter on main keyboard */
DIK_LCONTROL        0x1D
DIK_A               0x1E
DIK_S               0x1F
DIK_D               0x20
DIK_F               0x21
DIK_G               0x22
DIK_H               0x23
DIK_J               0x24
DIK_K               0x25
DIK_L               0x26
DIK_SEMICOLON       0x27
DIK_APOSTROPHE      0x28
DIK_GRAVE           0x29    /* accent grave */
DIK_LSHIFT          0x2A
DIK_BACKSLASH       0x2B
DIK_Z               0x2C
DIK_X               0x2D
DIK_C               0x2E
DIK_V               0x2F
DIK_B               0x30
DIK_N               0x31
DIK_M               0x32
DIK_COMMA           0x33
DIK_PERIOD          0x34    /* . on main keyboard */
DIK_SLASH           0x35    /* / on main keyboard */
DIK_RSHIFT          0x36
DIK_MULTIPLY        0x37    /* * on numeric keypad */
DIK_LMENU           0x38    /* left Alt */
DIK_SPACE           0x39
DIK_CAPITAL         0x3A
DIK_F1              0x3B
DIK_F2              0x3C
DIK_F3              0x3D
DIK_F4              0x3E
DIK_F5              0x3F
DIK_F6              0x40
DIK_F7              0x41
DIK_F8              0x42
DIK_F9              0x43
DIK_F10             0x44
DIK_NUMLOCK         0x45
DIK_SCROLL          0x46    /* Scroll Lock */
DIK_NUMPAD7         0x47
DIK_NUMPAD8         0x48
DIK_NUMPAD9         0x49
DIK_SUBTRACT        0x4A    /* - on numeric keypad */
DIK_NUMPAD4         0x4B
DIK_NUMPAD5         0x4C
DIK_NUMPAD6         0x4D
DIK_ADD             0x4E    /* + on numeric keypad */
DIK_NUMPAD1         0x4F
DIK_NUMPAD2         0x50
DIK_NUMPAD3         0x51
DIK_NUMPAD0         0x52
DIK_DECIMAL         0x53    /* . on numeric keypad */
DIK_OEM_102         0x56    /* < > | on UK/Germany keyboards */
DIK_F11             0x57
DIK_F12             0x58
DIK_F13             0x64    /*                     (NEC PC98) */
DIK_F14             0x65    /*                     (NEC PC98) */
DIK_F15             0x66    /*                     (NEC PC98) */
DIK_KANA            0x70    /* (Japanese keyboard)            */
DIK_ABNT_C1         0x73    /* / ? on Portugese (Brazilian) keyboards */
DIK_CONVERT         0x79    /* (Japanese keyboard)            */
DIK_NOCONVERT       0x7B    /* (Japanese keyboard)            */
DIK_YEN             0x7D    /* (Japanese keyboard)            */
DIK_ABNT_C2         0x7E    /* Numpad . on Portugese (Brazilian) keyboards */
DIK_NUMPADEQUALS    0x8D    /* = on numeric keypad (NEC PC98) */
DIK_PREVTRACK       0x90    /* Previous Track (DIK_CIRCUMFLEX on Japanese keyboard) */
DIK_AT              0x91    /*                     (NEC PC98) */
DIK_COLON           0x92    /*                     (NEC PC98) */
DIK_UNDERLINE       0x93    /*                     (NEC PC98) */
DIK_KANJI           0x94    /* (Japanese keyboard)            */
DIK_STOP            0x95    /*                     (NEC PC98) */
DIK_AX              0x96    /*                     (Japan AX) */
DIK_UNLABELED       0x97    /*                        (J3100) */
DIK_NEXTTRACK       0x99    /* Next Track */
DIK_NUMPADENTER     0x9C    /* Enter on numeric keypad */
DIK_RCONTROL        0x9D
DIK_MUTE            0xA0    /* Mute */
DIK_CALCULATOR      0xA1    /* Calculator */
DIK_PLAYPAUSE       0xA2    /* Play / Pause */
DIK_MEDIASTOP       0xA4    /* Media Stop */
DIK_VOLUMEDOWN      0xAE    /* Volume - */
DIK_VOLUMEUP        0xB0    /* Volume + */
DIK_WEBHOME         0xB2    /* Web home */
DIK_NUMPADCOMMA     0xB3    /* , on numeric keypad (NEC PC98) */
DIK_DIVIDE          0xB5    /* / on numeric keypad */
DIK_SYSRQ           0xB7
DIK_RMENU           0xB8    /* right Alt */
DIK_PAUSE           0xC5    /* Pause */
DIK_HOME            0xC7    /* Home on arrow keypad */
DIK_UP              0xC8    /* UpArrow on arrow keypad */
DIK_PRIOR           0xC9    /* PgUp on arrow keypad */
DIK_LEFT            0xCB    /* LeftArrow on arrow keypad */
DIK_RIGHT           0xCD    /* RightArrow on arrow keypad */
DIK_END             0xCF    /* End on arrow keypad */
DIK_DOWN            0xD0    /* DownArrow on arrow keypad */
DIK_NEXT            0xD1    /* PgDn on arrow keypad */
DIK_INSERT          0xD2    /* Insert on arrow keypad */
DIK_DELETE          0xD3    /* Delete on arrow keypad */
DIK_LWIN            0xDB    /* Left Windows key */
DIK_RWIN            0xDC    /* Right Windows key */
DIK_APPS            0xDD    /* AppMenu key */
DIK_POWER           0xDE    /* System Power */
DIK_SLEEP           0xDF    /* System Sleep */
DIK_WAKE            0xE3    /* System Wake */
DIK_WEBSEARCH       0xE5    /* Web Search */
DIK_WEBFAVORITES    0xE6    /* Web Favorites */
DIK_WEBREFRESH      0xE7    /* Web Refresh */
DIK_WEBSTOP         0xE8    /* Web Stop */
DIK_WEBFORWARD      0xE9    /* Web Forward */
DIK_WEBBACK         0xEA    /* Web Back */
DIK_MYCOMPUTER      0xEB    /* My Computer */
DIK_MAIL            0xEC    /* Mail */
DIK_MEDIASELECT     0xED    /* Media Select */

/* Alternate names for keys, to facilitate transition from DOS. */
DIK_BACKSPACE       DIK_BACK            /* backspace */
DIK_NUMPADSTAR      DIK_MULTIPLY        /* * on numeric keypad */
DIK_LALT            DIK_LMENU           /* left Alt */
DIK_CAPSLOCK        DIK_CAPITAL         /* CapsLock */
DIK_NUMPADMINUS     DIK_SUBTRACT        /* - on numeric keypad */
DIK_NUMPADPLUS      DIK_ADD             /* + on numeric keypad */
DIK_NUMPADPERIOD    DIK_DECIMAL         /* . on numeric keypad */
DIK_NUMPADSLASH     DIK_DIVIDE          /* / on numeric keypad */
DIK_RALT            DIK_RMENU           /* right Alt */
DIK_UPARROW         DIK_UP              /* UpArrow on arrow keypad */
DIK_PGUP            DIK_PRIOR           /* PgUp on arrow keypad */
DIK_LEFTARROW       DIK_LEFT            /* LeftArrow on arrow keypad */
DIK_RIGHTARROW      DIK_RIGHT           /* RightArrow on arrow keypad */
DIK_DOWNARROW       DIK_DOWN            /* DownArrow on arrow keypad */
DIK_PGDN            DIK_NEXT            /* PgDn on arrow keypad */

/* Alternate names for keys originally not used on US keyboards. */
DIK_CIRCUMFLEX      DIK_PREVTRACK       /* Japanese keyboard */

German keyboard

1 ESC 11 0 21 Z
2 1 12 ß 22 U
3 2 13 ´ 23 I
4 3 14 BACKSPACE 24 O
5 4 15 TAB 25 P
6 5 16 Q 26 Ü
7 6 17 W
8 7 18 E 28 ENTER
9 8 19 R 29 STRGL
10 9 20 T 30 A
31 S 41 ^ 51 ,
32 D 42 SHIFTL 52 .
33 F 43 # 53 -
34 G 44 Y 54 SHIFTR
35 H 45 X 55 NUM_*
36 J 46 C 56 ALT
37 K 47 V 57 SPACE
38 L 48 B 58 CAPS
39 Ö 49 N 59 F1
40 Ä 50 M 60 F2
61 F3 71 NUM_7 81 NUM_3
62 F4 72 NUM_8 82 NUM_0
63 F5 73 NUM_9 83 NUM_,
64 F6 74 NUM_-
65 F7 75 NUM_4
66 F8 76 NUM_5 86 <
67 F9 77 NUM_6 87 F11
68 F10 78 NUM_+ 88 F12
69 NUM 79 NUM_1
70 SCROLL 80 NUM_2
156 NUM_ENTER 200 UP 211 DELETE
157 STRGR 201 PAGEUP 219 WINR
220 WINL
181 NUM_/ 203 LEFT 221 APP
183 PRINT
184 ALTGR 205 RIGHT NOT DEFINED +
197 PAUSE 207 END
199 POS1 208 DOWN
209 PAGEDOWN
210 INSERT

French keyboard

1 ESC 11 0 21 Y
2 1 12 ) 22 U
3 2 13 = 23 I
4 3 14 BACKSPACE 24 O
5 4 15 TAB 25 P
6 5 16 A 26 ^
7 6 17 Z 27 $
8 7 18 E 28 ENTER
9 8 19 R 29 CTRLG
10 9 20 T 30 Q
31 S 41 ² 51 ;
32 D 42 SHIFTL 52 :
33 F 43 * 53 !
34 G 44 W 54 SHIFTR
35 H 45 X 55 NUM_*
36 J 46 C 56 ALT
37 K 47 V 57 SPACE
38 L 48 B 58 CAPS
39 M 49 N 59 F1
40 ù 50 , 60 F2
61 F3 71 NUM_7 81 NUM_3
62 F4 72 NUM_8 82 NUM_0
63 F5 73 NUM_9 83 NUM_.
64 F6 74 NUM_-
65 F7 75 NUM_4
66 F8 76 NUM_5 86 <
67 F9 77 NUM_6 87 F11
68 F10 78 NUM_+ 88 F12
69 NUM 79 NUM_1
70 SCROLL 80 NUM_2
156 NUM_ENTER 200 UP 211 DELETE
157 CTRLR 201 PAGEUP 219 WINR
220 WINL
181 NUM_/ 203 LEFT 221 APP
183 PRINT
184 ALTGR 205 RIGHT NOT DEFINED +
197 PAUSE 207 END
199 POS1 208 DOWN
209 PAGEDOWN
210 INSERT