mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
Download pages
This commit is contained in:
parent
be1ab0ba66
commit
454bdfe3c3
13 changed files with 170 additions and 28 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -16,3 +16,5 @@ sprites/BBMOD*
|
|||
*.DS_Store
|
||||
fonts/_f_sdf/_f_sdf.yy
|
||||
fonts/_f_sdf_medium/_f_sdf_medium.yy
|
||||
|
||||
__KEYS_PRIVATE
|
|
@ -550,6 +550,7 @@
|
|||
{"name":"luaHighlight","order":1,"path":"scripts/luaHighlight/luaHighlight.yy",},
|
||||
{"name":"mac_window_step","order":1,"path":"scripts/mac_window_step/mac_window_step.yy",},
|
||||
{"name":"mask_function","order":1,"path":"scripts/mask_function/mask_function.yy",},
|
||||
{"name":"materialBox","order":14,"path":"scripts/materialBox/materialBox.yy",},
|
||||
{"name":"math_function","order":3,"path":"scripts/math_function/math_function.yy",},
|
||||
{"name":"matrixGrid","order":6,"path":"scripts/matrixGrid/matrixGrid.yy",},
|
||||
{"name":"meta_data","order":12,"path":"scripts/meta_data/meta_data.yy",},
|
||||
|
@ -1102,6 +1103,7 @@
|
|||
{"name":"safe_operation","order":6,"path":"scripts/safe_operation/safe_operation.yy",},
|
||||
{"name":"sample_projects","order":6,"path":"scripts/sample_projects/sample_projects.yy",},
|
||||
{"name":"save_function","order":1,"path":"scripts/save_function/save_function.yy",},
|
||||
{"name":"__KEYS_PRIVATE","order":21,"path":"scripts/__KEYS_PRIVATE/__KEYS_PRIVATE.yy",},
|
||||
{"name":"scrollBox","order":2,"path":"scripts/scrollBox/scrollBox.yy",},
|
||||
{"name":"scrollPane","order":3,"path":"scripts/scrollPane/scrollPane.yy",},
|
||||
{"name":"shell_functions","order":20,"path":"scripts/shell_functions/shell_functions.yy",},
|
||||
|
@ -1121,7 +1123,6 @@
|
|||
{"name":"surface_get_palette","order":2,"path":"scripts/surface_get_palette/surface_get_palette.yy",},
|
||||
{"name":"surface_valid","order":5,"path":"scripts/surface_valid/surface_valid.yy",},
|
||||
{"name":"surfaceBox","order":4,"path":"scripts/surfaceBox/surfaceBox.yy",},
|
||||
{"name":"materialBox","order":14,"path":"scripts/materialBox/materialBox.yy",},
|
||||
{"name":"text_file","order":5,"path":"scripts/text_file/text_file.yy",},
|
||||
{"name":"textArrayBox","order":1,"path":"scripts/textArrayBox/textArrayBox.yy",},
|
||||
{"name":"textBox","order":2,"path":"scripts/textBox/textBox.yy",},
|
||||
|
|
|
@ -943,6 +943,7 @@
|
|||
{"id":{"name":"mac_window_init","path":"scripts/mac_window_init/mac_window_init.yy",},},
|
||||
{"id":{"name":"mac_window_step","path":"scripts/mac_window_step/mac_window_step.yy",},},
|
||||
{"id":{"name":"mask_function","path":"scripts/mask_function/mask_function.yy",},},
|
||||
{"id":{"name":"materialBox","path":"scripts/materialBox/materialBox.yy",},},
|
||||
{"id":{"name":"math_function","path":"scripts/math_function/math_function.yy",},},
|
||||
{"id":{"name":"matrixGrid","path":"scripts/matrixGrid/matrixGrid.yy",},},
|
||||
{"id":{"name":"meta_data","path":"scripts/meta_data/meta_data.yy",},},
|
||||
|
@ -1579,6 +1580,7 @@
|
|||
{"id":{"name":"safe_operation","path":"scripts/safe_operation/safe_operation.yy",},},
|
||||
{"id":{"name":"sample_projects","path":"scripts/sample_projects/sample_projects.yy",},},
|
||||
{"id":{"name":"save_function","path":"scripts/save_function/save_function.yy",},},
|
||||
{"id":{"name":"__KEYS_PRIVATE","path":"scripts/__KEYS_PRIVATE/__KEYS_PRIVATE.yy",},},
|
||||
{"id":{"name":"scrollBox","path":"scripts/scrollBox/scrollBox.yy",},},
|
||||
{"id":{"name":"scrollPane","path":"scripts/scrollPane/scrollPane.yy",},},
|
||||
{"id":{"name":"shader_functions","path":"scripts/shader_functions/shader_functions.yy",},},
|
||||
|
@ -1604,7 +1606,6 @@
|
|||
{"id":{"name":"surface_get_palette","path":"scripts/surface_get_palette/surface_get_palette.yy",},},
|
||||
{"id":{"name":"surface_valid","path":"scripts/surface_valid/surface_valid.yy",},},
|
||||
{"id":{"name":"surfaceBox","path":"scripts/surfaceBox/surfaceBox.yy",},},
|
||||
{"id":{"name":"materialBox","path":"scripts/materialBox/materialBox.yy",},},
|
||||
{"id":{"name":"testing_script","path":"scripts/testing_script/testing_script.yy",},},
|
||||
{"id":{"name":"text_file","path":"scripts/text_file/text_file.yy",},},
|
||||
{"id":{"name":"textArea","path":"scripts/textArea/textArea.yy",},},
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
/// @description init
|
||||
#region size
|
||||
draw_set_font(f_p0);
|
||||
#endregion
|
||||
|
||||
event_inherited();
|
||||
|
|
@ -6,14 +6,18 @@ event_inherited();
|
|||
dialog_h = ui(480);
|
||||
destroy_on_click_out = true;
|
||||
|
||||
note = "";
|
||||
pages = [ "Release note", "Downloads" ];
|
||||
page = 0;
|
||||
|
||||
var _link = $"https://gist.githubusercontent.com/Ttanasart-pt/f21a140906a60c6e12c99ebfecec1645/raw/{VERSION_STRING}";
|
||||
note_get = http_get(_link);
|
||||
#endregion
|
||||
|
||||
#region note
|
||||
note_get = http_get($"https://gist.githubusercontent.com/Ttanasart-pt/f21a140906a60c6e12c99ebfecec1645/raw/{VERSION_STRING}");
|
||||
note = "";
|
||||
|
||||
sp_note = new scrollPane(dialog_w - ui(80), dialog_h - ui(88), function(_y, _m) {
|
||||
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||
BLEND_ALPHA_MULP
|
||||
draw_clear_alpha(COLORS.dialog_splash_badge, 1);
|
||||
|
||||
var xx = ui(8);
|
||||
var yy = ui(8);
|
||||
var ww = sp_note.surface_w - ui(16);
|
||||
|
@ -103,7 +107,81 @@ event_inherited();
|
|||
}
|
||||
}
|
||||
|
||||
BLEND_NORMAL
|
||||
return yy + ui(64);
|
||||
})
|
||||
#endregion
|
||||
|
||||
#region downloads
|
||||
dl_get = http_get(global.KEYS.download_links);
|
||||
dls = [];
|
||||
downloading = {};
|
||||
|
||||
sp_dl = new scrollPane(dialog_w - ui(80), dialog_h - ui(88), function(_y, _m) {
|
||||
draw_clear_alpha(COLORS.dialog_splash_badge, 1);
|
||||
|
||||
var xx = ui(8);
|
||||
var yy = _y + ui(8);
|
||||
|
||||
var ww = sp_dl.surface_w - ui(16);
|
||||
var hh = ui(56);
|
||||
|
||||
for( var i = 0, n = array_length(dls); i < n; i++ ) {
|
||||
var dl = dls[i];
|
||||
var vr = dl.version;
|
||||
hh = dl.status? ui(56) : ui(36);
|
||||
|
||||
var hov = sHOVER && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + hh);
|
||||
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 0, xx, yy, ww, hh);
|
||||
|
||||
if(dl.status == 0 && hov) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_fg, 1, xx, yy, ww, hh, COLORS._main_accent, 1);
|
||||
if(mouse_press(mb_left, sFOCUS)) {
|
||||
var path = get_save_filename("Compressed zip (.zip)| *.zip", $"PixelComposer {vr}.zip");
|
||||
if(path != "") {
|
||||
dl.status = 1;
|
||||
dl.download_path = path;
|
||||
|
||||
var _get = http_get_file(dl.link, path);
|
||||
downloading[$ _get] = dl;
|
||||
}
|
||||
}
|
||||
|
||||
} else if(dl.status == 2 && hov) {
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_fg, 1, xx, yy, ww, hh, COLORS._main_accent, 1);
|
||||
if(mouse_press(mb_left, sFOCUS))
|
||||
shellOpenExplorer(filename_dir(dl.download_path));
|
||||
|
||||
} else
|
||||
draw_sprite_stretched_ext(THEME.ui_panel_fg, 1, xx, yy, ww, hh, COLORS.node_display_text_frame_outline, 1);
|
||||
|
||||
draw_set_text(f_p0b, fa_left, fa_top, dl.status == 2? COLORS._main_text : COLORS._main_text_sub);
|
||||
draw_text(xx + ui(8), yy + ui(8), vr);
|
||||
|
||||
if(dl.status == 1) {
|
||||
var _bw = ww - ui(16);
|
||||
var _bh = ui(12);
|
||||
var _bx = xx + ui(8);
|
||||
var _by = yy + hh - _bh - ui(8);
|
||||
var _prg = dl.size_total == 0? 0 : dl.size_downloaded / dl.size_total;
|
||||
|
||||
draw_sprite_stretched(THEME.progress_bar, 0, _bx, _by, _bw, _bh);
|
||||
draw_sprite_stretched(THEME.progress_bar, 1, _bx, _by, _bw * _prg, _bh);
|
||||
|
||||
} else if(dl.status == 2) {
|
||||
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);
|
||||
draw_text_cut(xx + ui(8), yy + ui(32), dl.download_path, ww - ui(16));
|
||||
}
|
||||
|
||||
if(dl.status) {
|
||||
draw_set_text(f_p1, fa_right, fa_top, COLORS._main_text_sub);
|
||||
draw_text(xx + ww - ui(8), yy + ui(10), string_byte_format(dl.size_total));
|
||||
|
||||
}
|
||||
|
||||
yy += hh + ui(4);
|
||||
}
|
||||
|
||||
return yy + ui(64) - _y;
|
||||
})
|
||||
#endregion
|
|
@ -8,11 +8,33 @@ if !ready exit;
|
|||
#endregion
|
||||
|
||||
#region text
|
||||
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
|
||||
draw_text(dialog_x + ui(24), dialog_y + ui(16), string(VERSION_STRING) + " Release note");
|
||||
|
||||
var bh = line_get_height(f_p0) + ui(8);
|
||||
var _x = dialog_x + ui(24);
|
||||
var _y = dialog_y + ui(16);
|
||||
|
||||
for( var i = 0, n = array_length(pages); i < n; i++ ) {
|
||||
var r = __txt(pages[i]);
|
||||
var rw = string_width(r);
|
||||
|
||||
if(buttonInstant(THEME.button_hide_fill, _x - ui(8), _y - ui(4), rw + ui(20), bh, [ mouse_mx, mouse_my ], sFOCUS, sHOVER) == 2)
|
||||
page = i;
|
||||
|
||||
draw_set_text(f_p0b, fa_left, fa_top, i == page? COLORS._main_text : COLORS._main_text_sub);
|
||||
draw_text(_x, _y, r);
|
||||
|
||||
_x += string_width(r) + ui(24);
|
||||
}
|
||||
|
||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, dialog_x + ui(24), dialog_y + ui(48), dialog_w - ui(48), dialog_h - ui(72));
|
||||
|
||||
sp_note.setFocusHover(sFOCUS, sHOVER);
|
||||
sp_note.draw(dialog_x + ui(40), dialog_y + ui(56));
|
||||
if(page == 0) {
|
||||
sp_note.setFocusHover(sFOCUS, sHOVER);
|
||||
sp_note.draw(dialog_x + ui(40), dialog_y + ui(56));
|
||||
|
||||
} else if(page == 1) {
|
||||
sp_dl.setFocusHover(sFOCUS, sHOVER);
|
||||
sp_dl.draw(dialog_x + ui(40), dialog_y + ui(56));
|
||||
|
||||
}
|
||||
#endregion
|
|
@ -1,7 +1,36 @@
|
|||
/// @description init
|
||||
if (ds_map_find_value(async_load, "id") == note_get) {
|
||||
if (ds_map_find_value(async_load, "status") == 0) {
|
||||
var _id = ds_map_find_value(async_load, "id");
|
||||
var _status = ds_map_find_value(async_load, "status");
|
||||
|
||||
if (_id == note_get) {
|
||||
if (_status == 0) {
|
||||
note = ds_map_find_value(async_load, "result");
|
||||
alarm[0] = 1;
|
||||
}
|
||||
|
||||
} else if (_id == dl_get) {
|
||||
if (_status == 0) {
|
||||
var res = ds_map_find_value(async_load, "result");
|
||||
dls = json_try_parse(res, []);
|
||||
|
||||
for( var i = 0, n = array_length(dls); i < n; i++ ) {
|
||||
dls[i].status = 0;
|
||||
dls[i].download_path = "";
|
||||
|
||||
dls[i].size_total = 0;
|
||||
dls[i].size_downloaded = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} else if ( struct_has(downloading, _id)) {
|
||||
var dl = downloading[$ _id];
|
||||
|
||||
if(_status == 0) {
|
||||
dl.status = 2;
|
||||
|
||||
} else if(_status == 1) {
|
||||
dl.size_total = ds_map_find_value(async_load, "contentLength");
|
||||
dl.size_downloaded = ds_map_find_value(async_load, "sizeDownloaded");
|
||||
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@
|
|||
"eventList":[
|
||||
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":2,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":62,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
|
||||
],
|
||||
"managed":true,
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
var t = get_timer();
|
||||
var _lua = PROGRAM_ARGUMENTS._lua;
|
||||
|
||||
__initKeys()
|
||||
__initPatreon(); log_message("SESSION", $"> init Patreon | complete in {get_timer() - t}"); t = get_timer();
|
||||
if(!IS_CMD) { __initTheme(); log_message("SESSION", $"> init Theme | complete in {get_timer() - t}"); t = get_timer(); }
|
||||
if(!IS_CMD) { __initLocale(); log_message("SESSION", $"> init Locale | complete in {get_timer() - t}"); t = get_timer(); }
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
HOTKEY_CONTEXT[| 0] = "";
|
||||
|
||||
globalvar TOOLTIP, DRAGGING, DIALOG_DEPTH_HOVER;
|
||||
global.KEYS = {
|
||||
download_links: ""
|
||||
};
|
||||
#endregion
|
||||
|
||||
#region inputs
|
||||
|
|
|
@ -212,9 +212,10 @@ function Node_Crop(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
|
|||
} #endregion
|
||||
|
||||
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
|
||||
var _inSurf = _data[0];
|
||||
var _crop = _data[1];
|
||||
var _dim = [ surface_get_width_safe(_inSurf) - _crop[0] - _crop[2], surface_get_height_safe(_inSurf) - _crop[1] - _crop[3] ];
|
||||
var _inSurf = _data[0];
|
||||
var _crop = _data[1];
|
||||
var _sdim = surface_get_dimension(_inSurf);
|
||||
var _dim = [ _sdim[0] - _crop[0] - _crop[2], _sdim[1] - _crop[1] - _crop[3] ];
|
||||
|
||||
_outSurf = surface_verify(_outSurf, _dim[0], _dim[1]);
|
||||
|
||||
|
|
|
@ -8,3 +8,12 @@ function string_lead_zero(val, digit) {
|
|||
|
||||
return ss;
|
||||
}
|
||||
|
||||
function string_byte_format(bytes) {
|
||||
static suffix = [ "B", "KB", "MB", "GB", "TB" ];
|
||||
|
||||
var lv = clamp(floor(log2(bytes) / 10), 0, array_length(suffix) - 1);
|
||||
var amo = bytes / power(2, lv * 10);
|
||||
|
||||
return $"{amo} {suffix[lv]}"
|
||||
}
|
|
@ -2,6 +2,8 @@
|
|||
#macro struct_key variable_struct_get_names
|
||||
|
||||
function struct_override(original, override) { #region
|
||||
INLINE
|
||||
|
||||
var args = variable_struct_get_names(override);
|
||||
|
||||
for( var i = 0, n = array_length(args); i < n; i++ ) {
|
||||
|
@ -15,11 +17,12 @@ function struct_override(original, override) { #region
|
|||
} #endregion
|
||||
|
||||
function struct_append(original, append) { #region
|
||||
INLINE
|
||||
|
||||
var args = variable_struct_get_names(append);
|
||||
|
||||
for( var i = 0, n = array_length(args); i < n; i++ ) {
|
||||
for( var i = 0, n = array_length(args); i < n; i++ )
|
||||
original[$ args[i]] = append[$ args[i]];
|
||||
}
|
||||
|
||||
return original;
|
||||
} #endregion
|
||||
|
|
Loading…
Reference in a new issue