Pixel-Composer/objects/o_main/Keyboard_1.gml

25 lines
629 B
Text
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-01-01 02:06:02 +01:00
if(kb_hold && kb_time >= PREF_MAP[? "keyboard_repeat_speed"]) {
2022-12-12 09:08:03 +01:00
trigger = true;
2023-01-01 02:06:02 +01:00
kb_time = 0;
} else if(!kb_hold && kb_time >= PREF_MAP[? "keyboard_repeat_start"]) {
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);