Pixel-Composer/objects/o_dialog_image_array_edit/Draw_64.gml

49 lines
1.6 KiB
Plaintext
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
if !ready exit;
if !target exit;
#region base UI
2022-11-18 03:20:31 +01:00
draw_sprite_stretched(THEME.dialog_bg, 0, dialog_x, dialog_y, dialog_w, dialog_h);
2022-11-03 11:44:49 +01:00
if(sFOCUS)
2022-11-18 03:20:31 +01:00
draw_sprite_stretched_ext(THEME.dialog_active, 0, dialog_x, dialog_y, dialog_w, dialog_h, COLORS._main_accent, 1);
2022-01-13 05:24:03 +01:00
2023-06-10 13:59:45 +02:00
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
2023-06-04 18:28:29 +02:00
draw_text(dialog_x + ui(padding), dialog_y + ui(20), __txtx("array_edit_title", "Image array edit"));
2022-01-13 05:24:03 +01:00
#endregion
#region content
2023-02-28 09:43:01 +01:00
var px = dialog_x + ui(padding);
var py = dialog_y + ui(title_height);
var pw = dialog_w - ui(padding + padding);
var ph = dialog_h - ui(title_height + padding);
2022-01-13 05:24:03 +01:00
2023-02-28 09:43:01 +01:00
draw_sprite_stretched(THEME.ui_panel_bg, 0, px - ui(8), py - ui(8), pw + ui(16), ph + ui(16));
2023-06-21 20:36:53 +02:00
sp_content.setFocusHover(sFOCUS, sHOVER);
2023-02-28 09:43:01 +01:00
sp_content.draw(px, py);
2022-01-13 05:24:03 +01:00
#endregion
#region button
2023-02-28 09:43:01 +01:00
var bw = ui(28);
var bh = ui(28);
var bx = dialog_x + dialog_w - ui(padding - 8) - bw;
var by = dialog_y + ui(18);
2023-01-25 06:49:00 +01:00
2023-06-05 18:27:53 +02:00
if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txt("Add") + "...", THEME.add,, COLORS._main_value_positive) == 2) {
2022-01-13 05:24:03 +01:00
var path = get_open_filenames(".png", "");
2023-02-28 09:43:01 +01:00
key_release();
2022-01-13 05:24:03 +01:00
if(path != "") {
var paths = paths_to_array(path);
var arr = target.inputs[| 0].getValue();
for( var i = 0; i < array_length(paths); i++ )
array_push(arr, paths[i]);
2023-01-25 06:49:00 +01:00
2022-01-13 05:24:03 +01:00
target.inputs[| 0].setValue(arr);
}
}
2023-02-28 09:43:01 +01:00
bx -= ui(36);
2023-01-25 06:49:00 +01:00
2023-06-04 18:28:29 +02:00
if(buttonInstant(THEME.button_hide, bx, by, bw, bh, mouse_ui, sFOCUS, sHOVER, __txtx("array_edit_sort_name", "Sort by name"), THEME.text) == 2)
2023-01-25 06:49:00 +01:00
sortByName();
2022-01-13 05:24:03 +01:00
#endregion