Pixel-Composer/objects/o_main/Keyboard_1.gml

25 lines
625 B
Plaintext
Raw Normal View History

2022-12-12 09:08:03 +01:00
/// @description
var trigger = false;
2023-01-01 02:06:02 +01:00
KEYBOARD_PRESSED = vk_nokey;
2022-12-12 09:08:03 +01:00
kb_time += DELTA_TIME;
2023-10-31 05:30:42 +01:00
if(kb_hold && kb_time >= PREFERENCES.keyboard_repeat_speed) {
2022-12-12 09:08:03 +01:00
trigger = true;
2023-01-01 02:06:02 +01:00
kb_time = 0;
2023-10-31 05:30:42 +01:00
} else if(!kb_hold && kb_time >= PREFERENCES.keyboard_repeat_start) {
2023-01-01 02:06:02 +01:00
trigger = true;
kb_time = 0;
kb_hold = true;
}
2022-12-12 09:08:03 +01:00
if(!trigger) exit;
2023-01-01 02:06:02 +01:00
KEYBOARD_PRESSED = kb_hkey;
if(keyboard_check(vk_backspace))
2022-12-12 09:08:03 +01:00
KEYBOARD_STRING = string_copy(KEYBOARD_STRING, 1, string_length(KEYBOARD_STRING) - 1);
2023-01-01 02:06:02 +01:00
else
KEYBOARD_STRING += keyboard_lastchar;
if(WIDGET_CURRENT && is_instanceof(WIDGET_CURRENT, textInput))
WIDGET_CURRENT.onKey(KEYBOARD_PRESSED);