Pixel-Composer/objects/o_main/Keyboard_1.gml

23 lines
651 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-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;
2024-09-12 12:42:35 +02:00
if(keyboard_check(vk_backspace)) KEYBOARD_STRING = string_copy(KEYBOARD_STRING, 1, string_length(KEYBOARD_STRING) - 1);
else KEYBOARD_STRING += keyboard_lastchar;
if(WIDGET_CURRENT && is_instanceof(WIDGET_CURRENT, textInput))
WIDGET_CURRENT.onKey(KEYBOARD_PRESSED);