Pixel-Composer/objects/o_dialog_scrollbox/Draw_64.gml

22 lines
693 B
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
#region draw
var hght = 32;
draw_sprite_stretched(s_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(s_textbox, 3, dialog_x, _ly, dialog_w, hght, c_ui_blue_white, 1);
if(mouse_check_button_pressed(mb_left)) {
scrollbox.onModify(i);
instance_destroy();
}
}
draw_set_text(f_p0, fa_center, fa_center, c_white);
draw_text(dialog_x + dialog_w / 2, _ly + hght / 2, scrollbox.data_list[i]);
}
#endregion