Input mechanism
From ENIGMA
ENIGMA keeps a centrally located array of input ordinals for the keyboard and mouse. These include ASCII ordinals and Microsoft key codes in one array, and mouse buttons in another. A separate integer is kept for other input types, enumerated below.
Contents |
Keyboard
The keyboard input array is 256 characters in length. For efficiency, I have considered downsizing to 127, but I have not researched the implications of doing so[developer confirmations: Josh].
The following is a table of keycodes borrowed from Game Maker, which stole them from Microsoft. The constant names shown are used in EDL and GML, and represent an actual offset in a globally allocated array.
| Constant Name | Value |
|---|---|
| vk_left | 37 |
| vk_right | 39 |
| vk_up | 38 |
| vk_down | 40 |
| vk_enter | 13 |
| vk_shift | 16 |
| vk_control | 17 |
| vk_alt | 18 |
| vk_space | 32 |
| vk_numpad0 | 96 |
| vk_numpad1 | 97 |
| vk_numpad2 | 98 |
| vk_numpad3 | 99 |
| vk_numpad4 | 100 |
| vk_numpad5 | 101 |
| vk_numpad6 | 102 |
| vk_numpad7 | 103 |
| vk_numpad8 | 104 |
| vk_numpad9 | 105 |
| vk_multiply | 106 |
| vk_add | 107 |
| vk_subtract | 109 |
| vk_decimal | 110 |
| vk_divide | 111 |
| vk_f1 | 112 |
| vk_f2 | 113 |
| vk_f3 | 114 |
| vk_f4 | 115 |
| vk_f5 | 116 |
| vk_f6 | 117 |
| vk_f7 | 118 |
| vk_f8 | 119 |
| vk_f9 | 120 |
| vk_f10 | 121 |
| vk_f11 | 122 |
| vk_f12 | 123 |
| vk_backspace | 8 |
| vk_escape | 27 |
| vk_pageup | 33 |
| vk_pagedown | 34 |
| vk_end | 35 |
| vk_home | 36 |
| vk_insert | 45 |
| vk_delete | 46 |
Mouse
Mouse input isn't so extensive. However, the mouse button constants do not correspond to values in any API. In fact, they're not even convenient for use in an array, as they must be decremented before access.
| Constant name | Value |
|---|---|
| mb_left | 1 |
| mb_right | 2 |
| mb_middle | 3 |
Additionally, the average mouse presents a couple other data values. These are each various-sized integers:
| Variable name | Type | Description |
|---|---|---|
| mouse_x | long | the x-coordinate of the mouse. |
| mouse_y | long | the y-coordinate of the mouse. |
| mouse_hscrolls | short | the number of whole horizontal scroll ticks |
| mouse_vscrolls | short | the number of whole vertical scroll ticks |
Other input devices are not covered by the scope of mice.
Joysticks
At present, none of the main developers own a joystick. ENIGMA should have support for Joysticks and controllers by late December[developer confirmations: 1].
Phone and console input
A mechanism is planned by which the angle of the controller (be it a phone or Wii remote) can be retrieved, as well as the number of shakes of either. No naming convention has been set. Developers are in the dark as to a convention for individual controller audio output, which only applies to Wii remotes[developer confirmations: 1].