Pixel-Composer/objects/o_dialog_scrollbox/Draw_64.gml
2022-11-18 09:20:31 +07:00

25 lines
853 B
Plaintext

/// @description init
#region draw
var hght = line_height(f_p0, 8);
draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h);
for(var i = 0; i < array_length(scrollbox.data_list); i++) {
var _ly = dialog_y + i * hght;
if(point_in_rectangle(mouse_mx, mouse_my, dialog_x, _ly + 1, dialog_x + dialog_w, _ly + hght - 1)) {
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, _ly, dialog_w, hght, COLORS._main_text, 1);
if(mouse_check_button_pressed(mb_left)) {
scrollbox.onModify(i);
instance_destroy();
}
}
draw_set_text(f_p0, align, fa_center, COLORS._main_text);
if(align == fa_center)
draw_text(dialog_x + dialog_w / 2, _ly + hght / 2, scrollbox.data_list[i]);
else if(align == fa_left)
draw_text(dialog_x + ui(8), _ly + hght / 2, scrollbox.data_list[i]);
}
#endregion