This commit is contained in:
Tanasart 2024-11-14 09:41:05 +07:00
parent e60a7d1b6c
commit cd79a657c7
3 changed files with 62 additions and 0 deletions

1
.gitignore vendored
View File

@ -22,3 +22,4 @@ fonts/_f_sdf_medium/_f_sdf_medium.yy
__KEYS_PRIVATE
scripts/panel_patreon/panel_patreon.gml
objects/o_dialog_patreon/o_dialog_patreon.yy

View File

@ -0,0 +1,18 @@
/// @description init
event_inherited();
#region data
dialog_w = ui(480);
dialog_h = ui(200);
title_height = ui(28);
destroy_on_click_out = false;
req_sign_in = "";
var port = 6510;
// do {
server = network_create_server_raw(network_socket_tcp, port, 32);
// } until(server >= 0 || port >= 65535);
// show_debug_message($"Create new server at {port}");
#endregion

View File

@ -0,0 +1,43 @@
/// @description init
if !ready exit;
#region base UI
DIALOG_DRAW_BG
draw_sprite_stretched_ext(THEME.ui_panel_bg, 3, dialog_x + 3, dialog_y + 3, dialog_w - 6, title_height + 2, COLORS._main_icon_light, 1);
draw_set_text(f_p2, fa_left, fa_top, COLORS._main_text_sub);
draw_text_cut(dialog_x + ui(10), dialog_y + ui(8), "Patreon connect", dialog_w - ui(32 + 32));
var _bx = dialog_x + dialog_w - ui(28);
var _by = dialog_y + ui(8);
var _bs = ui(20);
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, [ mouse_mx, mouse_my ], sFOCUS, sHOVER, "", THEME.window_exit) == 2) {
DIALOG_POSTDRAW
onDestroy();
instance_destroy();
}
if(sFOCUS) DIALOG_DRAW_FOCUS
#endregion
#region patreon login
var cx = dialog_x + dialog_w / 2;
var yy = dialog_y + title_height + ui(16);
draw_sprite(s_patreon_banner, 0, cx, yy);
var _bw = ui(172);
var _bh = ui(32);
var _bx = cx - _bw / 2;
var _by = yy + ui(104);
if(buttonInstant(THEME.button_def, _bx, _by, _bw, _bh, mouse_ui, sFOCUS, sHOVER) == 2) {
req_sign_in = url_open(@"www.patreon.com/oauth2/authorize?response_type=code
&client_id=oZ1PNvUY61uH0FiA7ZPMBy77Xau3Ok9tfvsT_Y8DQwyKeMNjaVC35r1qsK09QJhY
&redirect_uri=http://localhost:6510");
}
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text);
draw_text(cx, _by + _bh / 2, "Sign-in with Patreon");
#endregion