Pixel-Composer/objects/o_dialog_exit/Draw_64.gml

73 lines
1.9 KiB
Text
Raw Normal View History

2022-09-27 06:37:28 +02:00
/// @description init
if !ready exit;
2023-02-23 07:02:19 +01:00
2023-07-06 19:49:16 +02:00
#region dim BG
var lowest = true;
with(o_dialog_exit) {
if(id == other.id) continue;
if(depth > other.depth) lowest = false;
}
if(lowest) {
draw_set_color(c_black);
draw_set_alpha(0.5);
draw_rectangle(0, 0, WIN_W, WIN_H, false);
draw_set_alpha(1);
}
#endregion
2022-09-27 06:37:28 +02:00
2024-09-12 05:08:48 +02:00
DIALOG_PREDRAW
DIALOG_WINCLEAR
var _des = false;
DIALOG_DRAW_BG
if(sFOCUS) DIALOG_DRAW_FOCUS
2022-09-27 06:37:28 +02:00
#region text
2023-07-06 19:49:16 +02:00
var py = dialog_y + ui(16);
var txt = __txt($"Project modified");
2023-06-10 13:59:45 +02:00
draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text);
2023-07-06 19:49:16 +02:00
draw_text(dialog_x + ui(24), py, txt);
2023-05-28 20:00:51 +02:00
py += line_get_height(, 4);
2022-09-27 06:37:28 +02:00
2022-11-18 03:20:31 +01:00
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
var txt = __txta("Save project '{1}' before exit?", filename_name(project.path));
2023-11-22 10:21:50 +01:00
draw_text_ext(dialog_x + ui(24), py, txt, -1, dialog_w - ui(48));
_dialog_h = ui(118) + string_height_ext(txt, -1, dialog_w - ui(48));
2022-09-27 06:37:28 +02:00
2024-09-12 05:08:48 +02:00
var bw = ui(96), bh = BUTTON_HEIGHT;
2022-11-03 11:44:49 +01:00
var bx1 = dialog_x + dialog_w - ui(16);
var by1 = dialog_y + dialog_h - ui(16);
2022-09-27 06:37:28 +02:00
var bx0 = bx1 - bw;
var by0 = by1 - bh;
2022-11-18 03:20:31 +01:00
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text);
2024-03-31 05:36:11 +02:00
var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER);
2023-06-05 18:27:53 +02:00
draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Cancel"));
2022-09-27 06:37:28 +02:00
if(b == 2)
2024-09-12 05:08:48 +02:00
_des = true;
2022-09-27 06:37:28 +02:00
2022-11-03 11:44:49 +01:00
bx0 -= bw + ui(12);
2024-03-31 05:36:11 +02:00
var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER);
2023-06-05 18:27:53 +02:00
draw_text(bx0 + bw / 2, by0 + bh / 2, __txtx("dont_save", "Don't save"));
2022-09-27 06:37:28 +02:00
if(b == 2) {
2023-09-26 14:45:15 +02:00
if(instance_number(o_dialog_exit) == 1)
close_program();
2024-09-12 05:08:48 +02:00
_des = true;
2022-09-27 06:37:28 +02:00
}
2022-11-03 11:44:49 +01:00
bx0 -= bw + ui(12);
2024-03-31 05:36:11 +02:00
var b = buttonInstant(THEME.button_def, bx0, by0, bw, bh, mouse_ui, sFOCUS, sHOVER);
2023-06-05 18:27:53 +02:00
draw_text(bx0 + bw / 2, by0 + bh / 2, __txt("Save"));
2023-07-06 19:49:16 +02:00
if(b == 2 && SAVE(project)) {
2023-09-26 14:45:15 +02:00
if(instance_number(o_dialog_exit) == 1)
close_program();
2024-09-12 05:08:48 +02:00
_des = true;
2022-09-27 06:37:28 +02:00
}
2023-11-22 10:21:50 +01:00
dialog_h = _dialog_h;
2024-09-12 05:08:48 +02:00
#endregion
DIALOG_POSTDRAW
if(_des) instance_destroy();