2023-07-12 16:28:32 +02:00
|
|
|
/// @description
|
|
|
|
if(!active) exit;
|
|
|
|
if(textbox == noone) exit;
|
2023-07-31 20:06:44 +02:00
|
|
|
if(textbox != WIDGET_CURRENT) exit;
|
2023-07-12 16:28:32 +02:00
|
|
|
|
|
|
|
#region
|
|
|
|
draw_set_text(f_code, fa_left, fa_top, COLORS._main_text);
|
|
|
|
dialog_w = string_width(prompt) + ui(16);
|
|
|
|
dialog_h = string_height(prompt) + ui(16);
|
|
|
|
|
|
|
|
dialog_x = clamp(dialog_x, 0, WIN_W - dialog_w - 1);
|
|
|
|
var dy = clamp(dialog_y - dialog_h, 0, WIN_H - dialog_h - 1);
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region draw
|
|
|
|
draw_sprite_stretched(THEME.textbox, 3, dialog_x, dy, dialog_w, dialog_h);
|
|
|
|
|
|
|
|
var cx = dialog_x + ui(8);
|
|
|
|
var cy = dy + ui(8);
|
|
|
|
var ind = 1;
|
|
|
|
var amo = string_length(prompt);
|
|
|
|
var cch = "";
|
|
|
|
var fname = true;
|
|
|
|
var var_ind = 0;
|
2023-07-14 20:34:35 +02:00
|
|
|
var def_val = false;
|
2023-07-12 16:28:32 +02:00
|
|
|
|
|
|
|
repeat(amo) {
|
|
|
|
cch = string_char_at(prompt, ind);
|
|
|
|
ind++;
|
|
|
|
|
|
|
|
if(cch == "(") fname = false;
|
2023-07-14 20:34:35 +02:00
|
|
|
if(cch == ",") {
|
|
|
|
def_val = false;
|
|
|
|
var_ind++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(cch == "=")
|
|
|
|
def_val = true;
|
2023-07-12 16:28:32 +02:00
|
|
|
|
|
|
|
if(cch == "(" || cch == ")" || cch == "[" || cch == "]" || cch == "{" || cch == "}")
|
|
|
|
draw_set_color(COLORS.lua_highlight_bracklet);
|
|
|
|
else if(cch == ",")
|
|
|
|
draw_set_color(COLORS._main_text);
|
|
|
|
else if(fname)
|
|
|
|
draw_set_color(COLORS.lua_highlight_function);
|
2023-07-14 20:34:35 +02:00
|
|
|
else {
|
|
|
|
if(var_ind == index) {
|
|
|
|
draw_set_color(def_val? COLORS._main_text : COLORS.lua_highlight_number);
|
|
|
|
} else
|
|
|
|
draw_set_color(COLORS._main_text_sub);
|
|
|
|
}
|
2023-07-12 16:28:32 +02:00
|
|
|
|
|
|
|
draw_text(cx, cy, cch);
|
|
|
|
cx += string_width(cch);
|
|
|
|
}
|
|
|
|
|
|
|
|
draw_sprite_stretched(THEME.textbox, 1, dialog_x, dy, dialog_w, dialog_h);
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
if(keyboard_check_pressed(vk_escape))
|
|
|
|
active = false;
|