download through browser

This commit is contained in:
Tanasart 2024-05-07 15:54:34 +07:00
parent b8918d21fb
commit 79b3d8b5be
6 changed files with 74 additions and 57 deletions

View file

@ -128,7 +128,7 @@ event_inherited();
for( var i = 0, n = array_length(dls); i < n; i++ ) { for( var i = 0, n = array_length(dls); i < n; i++ ) {
var dl = dls[i]; var dl = dls[i];
var vr = dl.version; var vr = dl.version;
hh = dl.status? ui(56) : ui(36); hh = dl.status == 0? ui(36) : ui(56);
var hov = sHOVER && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + hh); var hov = sHOVER && point_in_rectangle(_m[0], _m[1], xx, yy, xx + ww, yy + hh);
@ -152,6 +152,11 @@ event_inherited();
if(mouse_press(mb_left, sFOCUS)) if(mouse_press(mb_left, sFOCUS))
shellOpenExplorer(filename_dir(dl.download_path)); shellOpenExplorer(filename_dir(dl.download_path));
} else if(dl.status == -1 && hov) {
draw_sprite_stretched_ext(THEME.ui_panel_fg, 1, xx, yy, ww, hh, COLORS._main_accent, 1);
if(mouse_press(mb_left, sFOCUS))
url_open(dl.download_path);
} else } else
draw_sprite_stretched_ext(THEME.ui_panel_fg, 1, xx, yy, ww, hh, COLORS.node_display_text_frame_outline, 1); draw_sprite_stretched_ext(THEME.ui_panel_fg, 1, xx, yy, ww, hh, COLORS.node_display_text_frame_outline, 1);
@ -171,6 +176,10 @@ event_inherited();
} else if(dl.status == 2) { } else if(dl.status == 2) {
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub); 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)); draw_text_cut(xx + ui(8), yy + ui(32), dl.download_path, ww - ui(16));
} else if(dl.status == -1) {
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_value_negative);
draw_text_cut(xx + ui(8), yy + ui(32), $"HTTP get error : open the download link in browser.", ww - ui(16));
} }
if(dl.status) { if(dl.status) {

View file

@ -40,13 +40,24 @@ if (_id == note_get) {
var dl = downloading[$ _id]; var dl = downloading[$ _id];
if(_status == 0) { if(_status == 0) {
if(dl.size_downloaded < 10000) {
dl.status = -1;
} else {
dl.status = 2; dl.status = 2;
PREFERENCES.versions[$ dl.version] = dl.download_path; PREFERENCES.versions[$ dl.version] = dl.download_path;
PREF_SAVE(); PREF_SAVE();
}
} else if(_status == 1) { } else if(_status == 1) {
if(ds_map_exists(async_load, "http_status")) {
var _http_status = ds_map_find_value(async_load, "http_status");
print(_http_status);
}
dl.size_total = ds_map_find_value(async_load, "contentLength"); dl.size_total = ds_map_find_value(async_load, "contentLength");
dl.size_downloaded = ds_map_find_value(async_load, "sizeDownloaded"); dl.size_downloaded = ds_map_find_value(async_load, "sizeDownloaded");
} } else
noti_warning($"HTTP get error {_status}");
} }

View file

@ -27,7 +27,7 @@ if(winMan_isMinimized()) exit;
break; break;
case VALUE_TYPE.curve : case VALUE_TYPE.curve :
draw_tooltip_text("[" + __txt("Curve Object") + "]"); draw_tooltip_text($"[{__txt("Curve Object"}]");
break; break;
case VALUE_TYPE.color : case VALUE_TYPE.color :
@ -39,11 +39,11 @@ if(winMan_isMinimized()) exit;
break; break;
case VALUE_TYPE.d3object : case VALUE_TYPE.d3object :
draw_tooltip_text("[" + __txt("3D Object") + "]"); draw_tooltip_text($"[{__txt("3D Object")}]");
break; break;
case VALUE_TYPE.object : case VALUE_TYPE.object :
draw_tooltip_text("[" + __txt("Object") + "]"); draw_tooltip_text($"[{__txt("Object")}]");
break; break;
case VALUE_TYPE.surface : case VALUE_TYPE.surface :
@ -51,43 +51,38 @@ if(winMan_isMinimized()) exit;
break; break;
case VALUE_TYPE.rigid : case VALUE_TYPE.rigid :
draw_tooltip_text("[" + __txt("Rigidbody Object") + " (id: " + string(content[$ "object"]) + ")]"); draw_tooltip_text($"[{__txt("Rigidbody Object")} (id: {content[$ "object"]})]");
break; break;
case VALUE_TYPE.particle : case VALUE_TYPE.particle :
var txt = "[" + var txt = $"[{__txt("Particle Object")} (size: {array_length(content)}) ]";
__txt("Particle Object") +
" (size: " + string(array_length(content)) + ") " +
"]";
draw_tooltip_text(txt); draw_tooltip_text(txt);
break; break;
case VALUE_TYPE.pathnode : case VALUE_TYPE.pathnode :
draw_tooltip_text("[" + __txt("Path Object") + "]"); draw_tooltip_text($"[{__txt("Path Object")}]");
break; break;
case VALUE_TYPE.sdomain : case VALUE_TYPE.sdomain :
draw_tooltip_text("[" + __txt("Domain") + " (id: " + string(content) + ")]"); draw_tooltip_text($"[{__txt("Domain")} (id: {content})]");
break; break;
case VALUE_TYPE.strands : case VALUE_TYPE.strands :
var txt = __txt("Strands Object"); var txt = __txt("Strands Object");
if(is_struct(content)) if(is_struct(content))
txt += " (strands: " + string(array_length(content.hairs)) + ")"; txt += $" (strands: {array_length(content.hairs)})";
draw_tooltip_text("[" + txt + "]"); draw_tooltip_text($"[{txt}]");
break; break;
case VALUE_TYPE.mesh : case VALUE_TYPE.mesh :
var txt = __txt("Mesh Object"); var txt = __txt("Mesh Object");
if(is_struct(content)) if(is_struct(content))
txt += " (triangles: " + string(array_length(content.triangles)) + ")"; txt += $" (triangles: {array_length(content.triangles)})";
draw_tooltip_text("[" + txt + "]"); draw_tooltip_text($"[{txt}]");
break; break;
case VALUE_TYPE.d3vertex : case VALUE_TYPE.d3vertex :
var txt = __txt("3D Vertex"); draw_tooltip_text($"[{__txt("3D Vertex")} (groups: {array_length(content)})]");
txt += " (groups: " + string(array_length(content)) + ")";
draw_tooltip_text("[" + txt + "]");
break; break;
case VALUE_TYPE.buffer : case VALUE_TYPE.buffer :

View file

@ -79,6 +79,7 @@ if(PROJECT.active && !PROJECT.safeMode) { #region
load_file_path(drop_path); load_file_path(drop_path);
drop_path = []; drop_path = [];
} }
} else if(OS == os_macosx) { } else if(OS == os_macosx) {
file_dnd_set_files(file_dnd_pattern, file_dnd_allowfiles, file_dnd_allowdirs, file_dnd_allowmulti); file_dnd_set_files(file_dnd_pattern, file_dnd_allowfiles, file_dnd_allowdirs, file_dnd_allowmulti);
file_dnd_filelist = file_dnd_get_files(); file_dnd_filelist = file_dnd_get_files();
@ -128,7 +129,7 @@ if(PROJECT.active && !PROJECT.safeMode) { #region
if(STEAM_ENABLED) { if(STEAM_ENABLED) {
if (steam_is_screenshot_requested()) { if (steam_is_screenshot_requested()) {
var file = "PixelComposer_" + string(irandom_range(100_000, 999_999)) + ".png"; var file = $"PixelComposer_{seed_random(6)}.png";
screen_save(file); screen_save(file);
steam_send_screenshot(file, window_get_width(), window_get_height()); steam_send_screenshot(file, window_get_width(), window_get_height());
} }

View file

@ -11,6 +11,7 @@ _HOVERING_ELEMENT = noone;
if(!minimized) game_set_speed(1, gamespeed_fps); if(!minimized) game_set_speed(1, gamespeed_fps);
minimized = true; minimized = true;
exit; exit;
} else if(!minimized) } else if(!minimized)
window_preminimize_rect = [ window_get_x(), window_get_y(), window_get_width(), window_get_height() ]; window_preminimize_rect = [ window_get_x(), window_get_y(), window_get_width(), window_get_height() ];

View file

@ -1,7 +1,7 @@
{ {
"$GMObject":"", "$GMObject": "",
"%Name":"o_main", "%Name": "o_main",
"eventList":[ "eventList": [
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"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":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":3,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
@ -13,41 +13,41 @@
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":4,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":4,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":3,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":3,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":5,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":5,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":10,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":75,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":1,"eventType":9,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":69,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":69,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":68,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":68,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":60,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":60,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":70,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":70,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":20,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",}, {"$GMEvent":"","%Name":"","collisionObjectId":null,"eventNum":20,"eventType":7,"isDnD":false,"name":"","resourceType":"GMEvent","resourceVersion":"2.0",},
{"resourceVersion":"1.0","name":"","resourceType":"GMEvent","eventNum":1,"eventType":9,"isDnD":false,},
{"resourceVersion":"1.0","name":"","resourceType":"GMEvent","eventNum":1,"eventType":10,"isDnD":false,},
], ],
"managed":true, "managed": true,
"name":"o_main", "name": "o_main",
"overriddenProperties":[], "overriddenProperties": [],
"parent":{ "parent": {
"name":"main", "name": "main",
"path":"folders/main.yy", "path": "folders/main.yy",
}, },
"parentObjectId":null, "parentObjectId": null,
"persistent":true, "persistent": true,
"physicsAngularDamping":0.1, "physicsAngularDamping": 0.1,
"physicsDensity":0.5, "physicsDensity": 0.5,
"physicsFriction":0.2, "physicsFriction": 0.2,
"physicsGroup":1, "physicsGroup": 1,
"physicsKinematic":false, "physicsKinematic": false,
"physicsLinearDamping":0.1, "physicsLinearDamping": 0.1,
"physicsObject":false, "physicsObject": false,
"physicsRestitution":0.1, "physicsRestitution": 0.1,
"physicsSensor":false, "physicsSensor": false,
"physicsShape":1, "physicsShape": 1,
"physicsShapePoints":[], "physicsShapePoints": [],
"physicsStartAwake":true, "physicsStartAwake": true,
"properties":[], "properties": [],
"resourceType":"GMObject", "resourceType": "GMObject",
"resourceVersion":"2.0", "resourceVersion": "2.0",
"solid":false, "solid": false,
"spriteId":null, "spriteId": null,
"spriteMaskId":null, "spriteMaskId": null,
"visible":true, "visible": true,
} }