Pixel-Composer/objects/o_dialog_scrollbox/Draw_64.gml

25 lines
867 B
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
#region draw
2022-11-03 11:44:49 +01:00
var hght = line_height(f_p0, 8);
2022-01-13 05:24:03 +01:00
2022-11-18 03:20:31 +01:00
draw_sprite_stretched(THEME.textbox, 1, dialog_x, dialog_y, dialog_w, dialog_h);
2022-01-13 05:24:03 +01:00
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)) {
2022-11-21 06:38:44 +01:00
draw_sprite_stretched_ext(THEME.textbox, 3, dialog_x, _ly, dialog_w, hght, COLORS.dialog_menubox_highlight, 1);
2022-01-13 05:24:03 +01:00
if(mouse_check_button_pressed(mb_left)) {
scrollbox.onModify(i);
instance_destroy();
}
}
2022-11-18 03:20:31 +01:00
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)
2022-11-03 11:44:49 +01:00
draw_text(dialog_x + ui(8), _ly + hght / 2, scrollbox.data_list[i]);
2022-01-13 05:24:03 +01:00
}
#endregion