Pixel-Composer/objects/o_dialog_splash/Draw_64.gml

120 lines
4.5 KiB
Text
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
if !ready 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
#endregion
#region content
2022-11-18 03:20:31 +01:00
draw_sprite_ui_uniform(THEME.icon_64, 0, dialog_x + ui(56), dialog_y + ui(56));
draw_set_text(f_h5, fa_left, fa_center, COLORS._main_text_accent);
2022-11-03 11:44:49 +01:00
draw_text(dialog_x + ui(56 + 48), dialog_y + ui(56), "Pixel Composer");
2022-01-13 05:24:03 +01:00
2022-11-03 11:44:49 +01:00
var bx = dialog_x + ui(56 + 48) + string_width("Pixel Composer") + ui(16);
var by = dialog_y + ui(56);
2022-01-13 05:24:03 +01:00
var txt = "v. " + VERSION_STRING;
2022-11-18 03:20:31 +01:00
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_sub);
2022-11-03 11:44:49 +01:00
var ww = string_width(txt) + ui(16);
var hh = line_height(, 16);
2022-11-18 03:20:31 +01:00
if(buttonInstant(THEME.button_hide, bx, by - hh / 2, ww, hh, mouse_ui, sFOCUS, sHOVER) == 2) {
2022-01-13 05:24:03 +01:00
dialogCall(o_dialog_release_note, WIN_W / 2, WIN_H / 2);
}
2022-11-03 11:44:49 +01:00
draw_text(bx + ui(8), by, txt);
2022-01-13 05:24:03 +01:00
2022-11-03 11:44:49 +01:00
var bx = dialog_x + dialog_w - ui(52);
var by = dialog_y + ui(16);
2022-11-18 03:20:31 +01:00
if(buttonInstant(THEME.button_hide, bx, by, ui(36), ui(36), mouse_ui, sFOCUS, sHOVER, "Preference", THEME.gear) == 2) {
2022-01-13 05:24:03 +01:00
dialogCall(o_dialog_preference, WIN_W / 2, WIN_H / 2);
}
2022-11-03 11:44:49 +01:00
bx -= ui(40);
2022-11-18 03:20:31 +01:00
if(buttonInstant(THEME.button_hide, bx, by, ui(36), ui(36), mouse_ui, sFOCUS, sHOVER, "Show on startup", THEME.icon_splash_show_on_start, PREF_MAP[? "show_splash"]) == 2) {
2022-11-01 03:06:03 +01:00
PREF_MAP[? "show_splash"] = !PREF_MAP[? "show_splash"];
PREF_SAVE();
}
2022-11-03 11:44:49 +01:00
var x0 = dialog_x + ui(16);
2023-03-05 07:16:44 +01:00
var x1 = x0 + recent_width;
2022-11-03 11:44:49 +01:00
var y0 = dialog_y + ui(128);
var y1 = dialog_y + dialog_h - ui(16);
2022-01-13 05:24:03 +01:00
2022-11-18 03:20:31 +01:00
draw_set_text(f_p0, fa_left, fa_bottom, COLORS._main_text_sub);
2022-11-03 11:44:49 +01:00
draw_text(x0, y0 - ui(4), "Recent files");
2022-11-18 03:20:31 +01:00
draw_sprite_stretched(THEME.ui_panel_bg, 0, x0, y0, x1 - x0, y1 - y0);
2023-02-28 09:43:01 +01:00
sp_recent.setActiveFocus(sFOCUS, sHOVER);
2022-11-03 11:44:49 +01:00
sp_recent.draw(x0 + ui(6), y0);
2022-01-13 05:24:03 +01:00
2023-03-05 07:16:44 +01:00
var bx = x1 - ui(28);
var by = y0 - ui(28 + 4);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Clear recent files", THEME.icon_delete,, COLORS._main_value_negative) == 2) {
ds_list_clear(RECENT_FILES);
RECENT_SAVE();
}
bx -= ui(28 + 4);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, recent_thumbnail? "Hide thumbnail" : "Show thumbnail", THEME.splash_thumbnail, recent_thumbnail) == 2) {
recent_thumbnail = !recent_thumbnail;
}
2023-03-07 14:29:47 +01:00
bx -= ui(28 + 4);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, sFOCUS, sHOVER, "Open autosave folder", THEME.save_auto, 0) == 2) {
shellOpenExplorer(DIRECTORY + "autosave");
}
2023-03-05 07:16:44 +01:00
var expandAction = false;
var expand = PREF_MAP[? "splash_expand_recent"];
if(buttonInstant(THEME.button_hide_fill, x1, (y0 + y1) / 2 - ui(32), ui(16), ui(32), mouse_ui, sFOCUS, sHOVER,, THEME.arrow, expand? 2 : 0) == 2) {
PREF_MAP[? "splash_expand_recent"] = !PREF_MAP[? "splash_expand_recent"];
expandAction = true;
}
2022-11-03 11:44:49 +01:00
x0 = x1 + ui(16);
x1 = dialog_x + dialog_w - ui(16);
2022-01-13 05:24:03 +01:00
2023-03-05 07:16:44 +01:00
bx = x0;
2023-02-15 10:43:24 +01:00
for( var i = 0; i < array_length(pages); i++ ) {
draw_set_text(f_p0, fa_left, fa_bottom, COLORS._main_text_sub);
var tw = string_width(pages[i]) + ui(16);
if(project_page == i)
draw_sprite_stretched(THEME.ui_panel_bg, 0, bx, y0 - ui(32), tw, ui(40));
else if(point_in_rectangle(mouse_mx, mouse_my, bx, y0 - ui(32), bx + tw, y0)) {
draw_sprite_stretched_ext(THEME.ui_panel_bg, 0, bx, y0 - ui(32), tw, ui(40), c_white, 0.5);
if(mouse_click(mb_left, sFOCUS))
project_page = i;
}
draw_text(bx + ui(8), y0 - ui(4), pages[i]);
bx += tw;
}
2022-11-18 03:20:31 +01:00
draw_sprite_stretched(THEME.ui_panel_bg, 0, x0, y0, x1 - x0, y1 - y0);
2023-02-28 09:43:01 +01:00
sp_sample.setActiveFocus(sFOCUS, sHOVER);
2022-11-03 11:44:49 +01:00
sp_sample.draw(x0 + ui(6), y0);
2022-01-13 05:24:03 +01:00
2023-02-15 10:43:24 +01:00
if(project_page == 0) {
2023-03-05 07:16:44 +01:00
if(!expand) {
draw_set_text(f_p1, fa_right, fa_bottom, COLORS._main_text_sub);
draw_text(x1 - ui(82), y0 - ui(4), "Art by ");
draw_sprite_ui_uniform(s_kenney, 0, x1, y0 - ui(4), 2, c_white, 0.5);
}
2023-02-15 10:43:24 +01:00
} else if(project_page == 1) {
var bx = x1 - ui(32);
var by = y0 - ui(32);
2023-02-17 11:31:33 +01:00
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, "Open Steam Workshop", THEME.steam) == 2)
steam_activate_overlay_browser("https://steamcommunity.com/app/2299510/workshop/");
bx -= ui(36);
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, "Refresh content", THEME.refresh) == 2)
steamUCGload();
2023-02-15 10:43:24 +01:00
}
2023-03-05 07:16:44 +01:00
if(expandAction) {
2023-03-25 12:27:04 +01:00
recent_width = PREF_MAP[? "splash_expand_recent"]? ui(564) : ui(288);
2023-03-05 07:16:44 +01:00
resize();
}
2022-01-13 05:24:03 +01:00
#endregion