Pixel-Composer/objects/o_dialog_splash/Create_0.gml

503 lines
17 KiB
Text
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description init
event_inherited();
#region data
destroy_on_click_out = true;
2022-11-03 11:44:49 +01:00
dialog_w = ui(960);
dialog_h = ui(600);
2023-02-15 10:43:24 +01:00
2023-02-16 02:51:51 +01:00
pages = ["Sample projects"];
if(STEAM_ENABLED)
2023-03-05 07:16:44 +01:00
array_push(pages, "Workshop");
2023-02-15 10:43:24 +01:00
project_page = 0;
2023-03-05 07:16:44 +01:00
thumbnail_retriever = 0;
2023-06-01 10:32:21 +02:00
recent_thumbnail = false;
show_autosaves = false;
2023-03-05 07:16:44 +01:00
2023-10-31 05:30:42 +01:00
recent_width = PREFERENCES.splash_expand_recent? ui(576) : ui(288);
2022-01-13 05:24:03 +01:00
#endregion
#region content
2023-03-05 07:16:44 +01:00
function resize() {
var x0 = dialog_x + ui(16);
var x1 = x0 + recent_width;
var y0 = dialog_y + ui(128);
var y1 = dialog_y + dialog_h - ui(16);
2023-03-25 12:27:04 +01:00
sp_recent.resize(x1 - x0 - ui(12), y1 - y0);
2023-03-05 07:16:44 +01:00
x0 = x1 + ui(16);
x1 = dialog_x + dialog_w - ui(16);
2023-03-25 12:27:04 +01:00
sp_sample.resize(x1 - x0 - ui(12), y1 - y0);
2023-06-25 20:12:17 +02:00
sp_contest.resize(x1 - x0 - ui(12), y1 - y0 - 2);
2023-03-05 07:16:44 +01:00
}
2023-06-01 10:32:21 +02:00
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
2023-03-25 12:27:04 +01:00
sp_recent = new scrollPane(x1 - x0 - ui(12), y1 - y0, function(_y, _m) {
2022-11-18 03:20:31 +01:00
draw_clear_alpha(COLORS.panel_bg_clear_inner, 0);
2023-10-31 05:30:42 +01:00
var expand = PREFERENCES.splash_expand_recent;
2023-03-25 12:27:04 +01:00
var ww = ui(264);
2022-01-13 05:24:03 +01:00
var hh = 0;
2022-11-03 11:44:49 +01:00
var pad = ui(8);
2023-05-28 20:00:51 +02:00
var hgt = ui(16) + line_get_height(f_p0b) + line_get_height(f_p1);
2022-01-13 05:24:03 +01:00
_y += pad;
2023-03-05 07:16:44 +01:00
var col = expand? 2 : 1;
var row = ceil(ds_list_size(RECENT_FILES) / col);
for(var i = 0; i < row; i++) {
for(var j = 0; j < col; j++) {
var ind = i * col + j;
if(ind >= ds_list_size(RECENT_FILES)) break;
2022-01-13 05:24:03 +01:00
2023-03-05 07:16:44 +01:00
var _rec = RECENT_FILES[| ind];
var _dat = RECENT_FILE_DATA[| ind];
if(!file_exists(_rec)) continue;
var thmb = noone;
var hg = hgt;
if(recent_thumbnail) {
hg = ui(100);
thmb = _dat.getThumbnail();
}
2022-01-13 05:24:03 +01:00
2023-03-05 07:16:44 +01:00
var fx = j * (ww + ui(8));
draw_sprite_stretched(THEME.ui_panel_bg, 1, fx, _y, ww, hg);
if(thmb && _y + hg > 0 && _y < sp_recent.h) {
2023-09-08 21:37:36 +02:00
var sw = surface_get_width_safe(thmb);
var sh = surface_get_height_safe(thmb);
2023-03-05 07:16:44 +01:00
var ss = (ww - ui(8)) / sw;
var sy = (((sh * ss) - hg) * clamp((_y + hg) / (sp_recent.h + hg), 0, 1)) / ss;
draw_surface_part_ext(thmb, 0, sy, sw, (hg - ui(8)) / ss, fx + ui(4), _y + ui(4), ss, ss, COLORS._main_icon_light, 0.9);
draw_sprite_stretched_ext(s_fade_up, 0, fx + ui(4), _y + hg - ui(64), ww - ui(8), ui(64), COLORS._main_icon_dark, 1);
2022-01-13 05:24:03 +01:00
}
2023-03-05 07:16:44 +01:00
if(sHOVER && sp_recent.hover && point_in_rectangle(_m[0], _m[1], fx, _y, fx + ww, _y + hg)) {
TOOLTIP = [ _dat.getThumbnail(), VALUE_TYPE.surface ];
draw_sprite_stretched_ext(THEME.node_active, 0, fx, _y, ww, hg, COLORS._main_accent, 1);
if(mouse_press(mb_left, sFOCUS)) {
LOAD_PATH(_rec);
instance_destroy();
}
}
2022-01-13 05:24:03 +01:00
2023-05-28 20:00:51 +02:00
var ly = recent_thumbnail? _y + hg - (line_get_height(f_p0b) + line_get_height(f_p1)) - ui(8) : _y + ui(8);
2023-06-10 13:59:45 +02:00
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_inner);
2023-03-05 07:16:44 +01:00
draw_text(fx + ui(12), ly, filename_name(_rec));
2023-06-10 13:59:45 +02:00
ly += line_get_height(, ui(4));
2023-03-05 07:16:44 +01:00
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);
draw_text_cut(fx + ui(12), ly, _rec, ww - ui(24));
}
2022-01-13 05:24:03 +01:00
hh += hg + pad;
_y += hg + pad;
}
return hh;
});
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-25 12:27:04 +01:00
sp_sample = new scrollPane(x1 - x0 - ui(12), y1 - y0, function(_y, _m) {
2022-11-18 03:20:31 +01:00
draw_clear_alpha(COLORS.panel_bg_clear_inner, 0);
2023-06-01 10:32:21 +02:00
var txt = pages[project_page];
var list;
switch(txt) {
case "Sample projects" : list = SAMPLE_PROJECTS; break;
case "Workshop" : list = STEAM_PROJECTS; break;
}
2023-02-15 10:43:24 +01:00
2022-01-13 05:24:03 +01:00
var hh = 0;
2022-11-03 11:44:49 +01:00
var grid_heigh = ui(96);
var grid_width = ui(128);
var grid_space = ui(20);
2023-02-15 10:43:24 +01:00
var node_count = ds_list_size(list);
2022-01-13 05:24:03 +01:00
var col = floor(sp_sample.surface_w / (grid_width + grid_space));
var row = ceil(node_count / col);
var hh = grid_space;
var yy = _y + grid_space;
var name_height = 0;
for(var i = 0; i < row; i++) {
name_height = 0;
for(var j = 0; j < col; j++) {
var index = i * col + j;
if(index < node_count) {
2023-02-15 10:43:24 +01:00
var _project = list[| index];
var _nx = grid_space + (grid_width + grid_space) * j;
var _boxx = _nx;
2022-01-13 05:24:03 +01:00
2022-11-18 03:20:31 +01:00
draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_width, grid_heigh);
2022-12-19 13:35:30 +01:00
if(sHOVER && sp_sample.hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_heigh)) {
2023-05-07 20:55:13 +02:00
var _meta = _project.getMetadata();
2023-06-01 10:32:21 +02:00
if(txt == "Workshop")
2023-05-07 20:55:13 +02:00
TOOLTIP = _meta;
2022-11-21 06:38:44 +01:00
draw_sprite_stretched_ext(THEME.node_active, 0, _boxx, yy, grid_width, grid_heigh, COLORS._main_accent, 1);
2022-12-10 05:06:01 +01:00
if(mouse_press(mb_left, sFOCUS)) {
2023-02-15 10:43:24 +01:00
LOAD_PATH(_project.path, true);
2023-06-01 10:32:21 +02:00
METADATA.steam = txt == "Workshop";
if(txt == "Workshop")
2023-05-07 20:55:13 +02:00
METADATA.file_id = _meta.file_id;
2022-01-13 05:24:03 +01:00
instance_destroy();
}
}
2023-02-15 10:43:24 +01:00
var spr = _project.getSpr();
if(spr) {
2023-07-15 20:01:29 +02:00
var gw = grid_width - ui(8);
var gh = grid_heigh - ui(8);
2022-12-10 05:06:01 +01:00
2023-02-15 10:43:24 +01:00
var sw = sprite_get_width(spr);
var sh = sprite_get_height(spr);
2022-12-10 05:06:01 +01:00
2023-07-15 20:01:29 +02:00
var s = min(1, gw / sw, gh / sh);
2023-02-15 10:43:24 +01:00
2023-07-15 20:01:29 +02:00
var ox = (sprite_get_xoffset(spr) - sw / 2) * s;
var oy = (sprite_get_yoffset(spr) - sh / 2) * s;
2023-02-15 10:43:24 +01:00
2023-07-15 20:01:29 +02:00
var _sx = _boxx + grid_width / 2 + ox;
var _sy = yy + grid_heigh / 2 + ox;
draw_sprite_ui_uniform(spr, 0, _sx, _sy, s);
2022-12-10 05:06:01 +01:00
}
2022-01-29 14:25:18 +01:00
var tx = _boxx + grid_width / 2;
2022-11-03 11:44:49 +01:00
var ty = yy + grid_heigh + ui(4);
2022-11-18 03:20:31 +01:00
draw_set_text(f_p2, fa_center, fa_top);
2023-06-01 10:32:21 +02:00
if(txt == "Sample projects") {
2023-02-15 10:43:24 +01:00
var _tw = string_width(_project.tag);
var _th = string_height(_project.tag);
2022-01-29 14:25:18 +01:00
2023-02-15 10:43:24 +01:00
draw_set_color(COLORS.dialog_splash_badge);
2023-04-08 20:06:27 +02:00
draw_roundrect_ext(tx - _tw / 2 - ui(6), ty - ui(2), tx + _tw / 2 + ui(6), ty + _th, THEME_VALUE.selection_corner_radius, THEME_VALUE.selection_corner_radius, 0);
2023-02-15 10:43:24 +01:00
draw_set_color(_project.tag == "Getting started"? COLORS._main_text_accent : COLORS._main_text_sub);
draw_text(tx, ty - ui(2), _project.tag);
2023-06-10 13:59:45 +02:00
ty += line_get_height(, ui(4));
2023-02-15 10:43:24 +01:00
}
2022-01-29 14:25:18 +01:00
2022-11-18 03:20:31 +01:00
draw_set_text(f_p1, fa_center, fa_top, COLORS._main_text);
2023-02-15 10:43:24 +01:00
name_height = max(name_height, string_height_ext(_project.name, -1, grid_width) + ui(8));
draw_text_ext_add(tx, ty - ui(2), _project.name, -1, grid_width);
2022-01-13 05:24:03 +01:00
}
}
2022-11-03 11:44:49 +01:00
var hght = grid_heigh + grid_space + name_height + ui(20);
2022-01-13 05:24:03 +01:00
hh += hght;
yy += hght;
}
2023-06-01 10:32:21 +02:00
return hh;
});
#endregion
#region contest
discord_map = ds_map_create();
discord_map[? "Authorization"] = "Bot " + get_discord_bot_token();
contest_req = noone;
contest_message_req = [];
2023-06-01 10:32:21 +02:00
if(os_is_network_connected()) {
var url = "https://discord.com/api/v10/guilds/953634069646835773/threads/active";
contest_req = http_request(url, "GET", discord_map, "");
}
nicknames = ds_map_create();
attachment = ds_map_create();
contests = [];
2023-06-01 10:32:21 +02:00
grid_surface = surface_create(1, 1);
banner = noone;
2023-06-01 10:32:21 +02:00
banner_alpha = 0;
contest_viewing = noone;
2023-06-25 20:12:17 +02:00
sp_contest = new scrollPane(x1 - x0 - ui(12), y1 - y0 - 2, function(_y, _m) {
2023-06-01 10:32:21 +02:00
draw_clear_alpha(COLORS.panel_bg_clear_inner, 0);
var hh = 0;
if(contest_viewing == noone) {
var amo = array_length(contests);
var bx = sp_contest.surface_w / 2;
var sy = ui(16);
var spr_w = sprite_get_width(s_contest_banner);
var spr_h = sprite_get_height(s_contest_banner);
var ss = (sp_contest.surface_w - 40) / spr_w;
draw_sprite_ext(s_contest_banner, 0, bx, _y + sy, ss, ss, 0, c_white, 1);
spr_w *= ss;
spr_h *= ss;
if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], bx - spr_w / 2, _y + sy, bx + spr_w / 2, _y + sy + spr_h)) {
TOOLTIP = "Go to Pixel Composer Discord server";
if(mouse_press(mb_left, sFOCUS))
url_open("https://discord.gg/aHGbYjQh63");
}
sy += spr_h - ui(4);
var tx, ty, _col, _row;
var grid_heigh = ui(128);
var grid_width = ui(276);
var grid_space = ui(20);
var grid_hspac = ui(40);
var col = floor(sp_contest.surface_w / (grid_width + grid_space));
grid_surface = surface_verify(grid_surface, grid_width, grid_heigh);
for( var i = 0; i < amo; i++ ) {
var contest = contests[i];
_col = i % col;
_row = floor(i / col);
tx = grid_space + (grid_width + grid_space) * _col;
ty = sy + grid_space + (grid_heigh + grid_hspac + grid_space) * _row;
hh = max(hh, ty + grid_heigh + grid_hspac + grid_space + ui(32));
ty = _y + ty;
draw_sprite_stretched(THEME.node_bg, 0, tx, ty, grid_width, grid_heigh);
var att = contest.title.attachments;
if(att != noone) {
var attSurf = attachment[? att.id];
if(!is_array(attSurf) && sprite_exists(attSurf)) {
var _sw = sprite_get_width(attSurf);
var _sh = sprite_get_height(attSurf);
var ss = max(grid_width / _sw, grid_heigh / _sh);
surface_set_target(grid_surface);
DRAW_CLEAR
draw_sprite_stretched(THEME.node_bg, 0, 0, 0, grid_width, grid_heigh);
gpu_set_colorwriteenable(1, 1, 1, 0);
draw_sprite_ext(attSurf, 0, grid_width / 2, grid_heigh / 2, ss, ss, 0, c_white, 1);
gpu_set_colorwriteenable(1, 1, 1, 1);
surface_reset_target();
2023-09-09 13:52:16 +02:00
draw_surface_ext_safe(grid_surface, tx, ty, 1, 1, 0, c_white, 0.85);
2023-06-01 10:32:21 +02:00
}
}
if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], tx, ty, tx + grid_width, ty + grid_heigh)) {
draw_sprite_stretched_ext(THEME.node_active, 0, tx, ty, grid_width, grid_heigh, COLORS._main_accent, 1);
if(mouse_press(mb_left, sFOCUS))
contest_viewing = contest;
} else
draw_sprite_stretched_ext(THEME.node_active, 0, tx, ty, grid_width, grid_heigh, COLORS._main_icon, 0.75);
//draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text);
//draw_text_ext_add(tx + ui(12), ty + ui(8), contest.name, -1, grid_width - ui(24));
var ch_x = tx + grid_width - ui(8);
var ch_y = ty + grid_heigh + ui(4);
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text);
draw_text_ext_add(tx + ui(8), ch_y, contest.name, -1, grid_width - ui(8));
var nm_h = string_height_ext(contest.name, -1, grid_width - ui(8));
draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text);
draw_text_add(ch_x, ch_y, contest.message_count);
var _w = string_width(contest.message_count);
draw_sprite_ui(THEME.chat, 0, ch_x - _w - ui(16), ch_y + ui(12), 0.75, 0.75,, COLORS._main_icon);
var auth_msg = contest.title;
var auth_nam = ds_map_try_get(nicknames, auth_msg.author.id, auth_msg.author.username);
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
draw_text_add(tx + ui(8), ch_y + nm_h - ui(0), auth_nam);
if(!struct_has(contest.title.meta, "theme")) continue;
2023-06-05 18:27:53 +02:00
var _thm = __txt("Theme") + ": ";
var txt = _thm + contest.title.meta.theme;
2023-06-01 10:32:21 +02:00
draw_set_text(f_p1, fa_left, fa_bottom, COLORS._main_text);
var ww = string_width(txt);
var thx = tx + grid_width - ui(12) - ww;
var thy = ty + grid_heigh - ui(8);
2023-06-05 18:27:53 +02:00
2023-06-01 10:32:21 +02:00
draw_set_color(COLORS._main_text_sub);
2023-06-05 18:27:53 +02:00
draw_text_ext_add(thx, thy, _thm, -1, grid_width - ui(12 + 8));
2023-06-01 10:32:21 +02:00
draw_set_color(COLORS._main_text);
2023-06-05 18:27:53 +02:00
draw_text_ext_add(thx + string_width(_thm), thy, contest.title.meta.theme, -1, grid_width - ui(12 + 8));
2023-06-01 10:32:21 +02:00
}
} else {
var con_name = contest_viewing.name;
var con_title = contest_viewing.title;
var con_author = ds_map_try_get(nicknames, con_title.author.id, con_title.author.username);
var con_thumb = con_title.attachments;
if(con_thumb != noone)
con_thumb = attachment[? con_thumb.id];
var tx = ui(8);
var ty = _y + ui(68);
hh = ui(68);
2023-06-01 10:32:21 +02:00
var tw = sp_contest.surface_w - ui(16);
var th = 0;
var pad = ui(12);
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
th = string_height_ext(con_title.content, -1, tw - pad * 2) + pad * 2;
if(sprite_exists(con_thumb)) {
var spr_w = sprite_get_width(con_thumb);
var spr_h = sprite_get_height(con_thumb);
ss = (tw - pad * 2) / spr_w;
spr_w *= ss;
spr_h *= ss;
th += pad + spr_h;
}
var txt_y = ty + pad;
draw_sprite_stretched_ext(THEME.node_bg, 0, tx, ty, tw, th, c_white, 0.8);
draw_text_ext_add(tx + pad, txt_y, con_title.content, -1, tw - pad * 2);
txt_y += string_height_ext(con_title.content, -1, tw - pad * 2) + pad;
if(sprite_exists(con_thumb))
draw_sprite_ext(con_thumb, 0, sp_contest.surface_w / 2, txt_y + spr_h / 2, ss, ss, 0, c_white, 1);
hh += th + pad;
var submissions = contest_viewing.messages;
var amo = 0, col = 0;
var grid_space = ui(20);
var grid_width = (sp_contest.surface_w - grid_space - ui(16)) / 2;
var _yy = txt_y + spr_h + pad * 2;
var cx = sp_contest.surface_w / 2;
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub);
2023-06-05 18:27:53 +02:00
draw_text(cx, _yy + ui(8), __txt("Submissions"));
var txt_w = string_width(__txt("Submissions"));
2023-06-01 10:32:21 +02:00
draw_line(cx - txt_w / 2 - ui(8), _yy + ui(8), cx - ui(200), _yy + ui(8));
draw_line(cx + txt_w / 2 + ui(8), _yy + ui(8), cx + ui(200), _yy + ui(8));
_yy += ui(32);
var grid_ys = [ _yy, _yy ];
2023-07-25 20:12:40 +02:00
for( var i = 0, n = array_length(submissions) - 1; i < n; i++ ) {
2023-06-01 10:32:21 +02:00
var _sub = submissions[i];
var _att = _sub.attachments;
if(array_length(_att) == 0) continue;
amo++;
var _att_first = _att[0];
if(!ds_map_exists(attachment, _att_first.id)) {
2023-11-01 08:10:25 +01:00
var path = TEMPDIR + _att_first.id + ".png";
2023-06-01 10:32:21 +02:00
attachment[? _att_first.id] = [ http_get_file(_att_first.url, path), path ];
} else if(!is_array(attachment[? _att_first.id]) && sprite_exists(attachment[? _att_first.id])) {
var sub = attachment[? _att_first.id];
var spr_w = sprite_get_width(sub);
var spr_h = sprite_get_height(sub);
var ss = (grid_width - ui(16)) / spr_w;
if(ss > 1) ss = floor(ss);
spr_w *= ss;
spr_h *= ss;
var _col = grid_ys[0] > grid_ys[1];
var grid_x = ui(8) + (grid_width + grid_space) * _col;
var grid_y = grid_ys[_col];
var grid_h = spr_h + ui(8) * 2;
draw_sprite_stretched_ext(THEME.node_bg, 0, grid_x, grid_y, grid_width, grid_h, c_white, 0.8);
draw_sprite_ext(sub, 0, grid_x + grid_width / 2, grid_y + grid_h / 2, ss, ss, 0, c_white, 1);
var label_h = ui(32);
var sub_author = ds_map_try_get(nicknames, _sub.author.id, _sub.author.username);
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text);
draw_text_add(grid_x + ui(8), grid_y + grid_h + ui(4), sub_author);
var react = _sub.reactions;
var hearts = 0;
for( var j = 0; j < array_length(react); j++ ) {
if(react[i].emoji.name != "💖") return;
hearts = react[i].count_details.normal;
}
var ch_x = grid_x + grid_width - ui(8);
var ch_y = grid_y + grid_h + ui(4);
draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text);
draw_text_add(ch_x, ch_y, hearts);
var _w = string_width(hearts);
draw_sprite_ui(THEME.heart, 0, ch_x - _w - ui(16), ch_y + ui(10),,,, COLORS._main_icon_light);
2023-06-01 10:32:21 +02:00
grid_ys[_col] += grid_h + label_h + ui(8);
}
}
hh = max(grid_ys[0] - _y, grid_ys[1] - _y);
//banner
banner_alpha = lerp_float(banner_alpha, _y < 0, 3);
2023-06-01 10:32:21 +02:00
draw_sprite_stretched_ext(THEME.shadow_drop_down_24, 0, 0, ui(56), sp_contest.surface_w, ui(20), c_white, banner_alpha);
draw_set_color(COLORS.panel_bg_clear);
draw_rectangle(0, 0, sp_contest.surface_w, ui(64), false);
draw_set_text(f_h5, fa_left, fa_top, COLORS._main_text);
draw_text_add(ui(32 + 8), ui(8 + 4), con_name);
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
2023-06-05 18:27:53 +02:00
draw_text_add(ui(32 + 8), ui(8 + 30), __txt("By") + " " + con_author);
2023-06-01 10:32:21 +02:00
draw_set_text(f_p0b, fa_right, fa_top, COLORS._main_text_accent);
draw_text_add(sp_contest.surface_w - ui(44), ui(8 + 8), amo);
draw_set_text(f_p2, fa_right, fa_top, COLORS._main_text_sub);
2023-06-05 18:27:53 +02:00
draw_text_add(sp_contest.surface_w - ui(44), ui(8 + 28), __txt("Submissions"));
2023-06-01 10:32:21 +02:00
if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], ui(20 - 16), ui(36 - 16), ui(20 + 16), ui(36 + 16))) {
draw_sprite_ui(THEME.arrow_back_32, 0, ui(20), ui(36),,,, c_white);
if(mouse_press(mb_left, sFOCUS))
contest_viewing = noone;
} else
draw_sprite_ui(THEME.arrow_back_32, 0, ui(20), ui(36),,,, COLORS._main_icon);
var bx = sp_contest.surface_w - ui(20);
var by = ui(36);
if(sHOVER && sp_contest.hover && point_in_rectangle(_m[0], _m[1], bx - ui(16), by - ui(16), bx + ui(16), by + ui(16))) {
2023-06-05 18:27:53 +02:00
TOOLTIP = __txtx("contest_open_discord", "Open in Discord");
2023-06-01 10:32:21 +02:00
draw_sprite_ui(THEME.discord, 0, bx, by,,,, c_white);
if(mouse_press(mb_left, sFOCUS))
url_open($"https://discord.com/channels/953634069646835773/{contest_viewing.id}");
} else
draw_sprite_ui(THEME.discord, 0, bx, by,,,, COLORS._main_icon);
}
2022-01-13 05:24:03 +01:00
return hh;
});
#endregion