mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-25 06:26:42 +01:00
canvas ui
This commit is contained in:
parent
be6ba22147
commit
e096f9d87a
13 changed files with 234 additions and 161 deletions
Binary file not shown.
|
@ -474,10 +474,7 @@ event_inherited();
|
||||||
cProg = 0;
|
cProg = 0;
|
||||||
curr_height = 0;
|
curr_height = 0;
|
||||||
|
|
||||||
array_push(group_labels, {
|
array_push(group_labels, { y: yy, text: __txt(_node) });
|
||||||
y: yy,
|
|
||||||
text: __txt(_node)
|
|
||||||
});
|
|
||||||
|
|
||||||
hh += ui(24 + 12);
|
hh += ui(24 + 12);
|
||||||
yy += ui(24 + 12);
|
yy += ui(24 + 12);
|
||||||
|
@ -553,7 +550,7 @@ event_inherited();
|
||||||
if(len) {
|
if(len) {
|
||||||
gpu_set_blendmode(bm_subtract);
|
gpu_set_blendmode(bm_subtract);
|
||||||
draw_set_color(c_white);
|
draw_set_color(c_white);
|
||||||
draw_rectangle(0, 0, content_pane.surface_w, ui(16 + 24 / 2), false);
|
draw_rectangle(0, 0, content_pane.surface_w, ui(36), false);
|
||||||
gpu_set_blendmode(bm_normal);
|
gpu_set_blendmode(bm_normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,8 +562,8 @@ event_inherited();
|
||||||
draw_sprite_stretched_ext(THEME.group_label, 0, ui(16), _yy, content_pane.surface_w - ui(32), ui(24), c_white, 0.3);
|
draw_sprite_stretched_ext(THEME.group_label, 0, ui(16), _yy, content_pane.surface_w - ui(32), ui(24), c_white, 0.3);
|
||||||
BLEND_NORMAL;
|
BLEND_NORMAL;
|
||||||
|
|
||||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
draw_set_text(f_p2, fa_left, fa_center, CDEF.main_ltgrey);
|
||||||
draw_text(ui(16 + 16), _yy + ui(12), lb.text);
|
draw_text_add(ui(16 + 16), _yy + ui(12), lb.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -665,7 +662,7 @@ event_inherited();
|
||||||
if(len) {
|
if(len) {
|
||||||
gpu_set_blendmode(bm_subtract);
|
gpu_set_blendmode(bm_subtract);
|
||||||
draw_set_color(c_white);
|
draw_set_color(c_white);
|
||||||
draw_rectangle(0, 0, content_pane.surface_w, ui(16 + 24 / 2), false);
|
draw_rectangle(0, 0, content_pane.surface_w, ui(36), false);
|
||||||
gpu_set_blendmode(bm_normal);
|
gpu_set_blendmode(bm_normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,8 +674,8 @@ event_inherited();
|
||||||
draw_sprite_stretched_ext(THEME.group_label, 0, ui(16), _yy, content_pane.surface_w - ui(32), ui(24), c_white, 0.3);
|
draw_sprite_stretched_ext(THEME.group_label, 0, ui(16), _yy, content_pane.surface_w - ui(32), ui(24), c_white, 0.3);
|
||||||
BLEND_NORMAL;
|
BLEND_NORMAL;
|
||||||
|
|
||||||
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
|
draw_set_text(f_p2, fa_left, fa_center, CDEF.main_ltgrey);
|
||||||
draw_text(ui(16 + 16), _yy + ui(12), lb.text);
|
draw_text_add(ui(16 + 16), _yy + ui(12), lb.text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,8 @@ event_inherited();
|
||||||
dialog_w = ui(960);
|
dialog_w = ui(960);
|
||||||
dialog_h = ui(600);
|
dialog_h = ui(600);
|
||||||
|
|
||||||
pages = ["Sample projects"];
|
pages = ["Welcome Files"];
|
||||||
if(STEAM_ENABLED)
|
if(STEAM_ENABLED) array_push(pages, "Workshop");
|
||||||
array_push(pages, "Workshop");
|
|
||||||
project_page = 0;
|
project_page = 0;
|
||||||
|
|
||||||
thumbnail_retriever = 0;
|
thumbnail_retriever = 0;
|
||||||
|
@ -112,127 +111,169 @@ event_inherited();
|
||||||
x1 = dialog_x + dialog_w - ui(16);
|
x1 = dialog_x + dialog_w - ui(16);
|
||||||
|
|
||||||
sp_sample = new scrollPane(x1 - x0 - ui(12), y1 - y0 - 1, function(_y, _m) { #region
|
sp_sample = new scrollPane(x1 - x0 - ui(12), y1 - y0 - 1, function(_y, _m) { #region
|
||||||
draw_clear_alpha(COLORS.panel_bg_clear_inner, 0);
|
draw_clear_alpha(CDEF.main_black, 0);
|
||||||
|
draw_set_color(CDEF.main_black);
|
||||||
|
draw_rectangle(0, 1, sp_sample.surface_w, sp_sample.surface_h - 1, false);
|
||||||
|
|
||||||
var txt = pages[project_page];
|
var txt = pages[project_page];
|
||||||
var list;
|
var list, _group_label;
|
||||||
|
|
||||||
switch(txt) {
|
switch(txt) {
|
||||||
case "Sample projects" : list = SAMPLE_PROJECTS; break;
|
case "Welcome Files" : list = SAMPLE_PROJECTS; _group_label = true; break;
|
||||||
case "Workshop" : list = STEAM_PROJECTS; break;
|
case "Workshop" : list = STEAM_PROJECTS; _group_label = false; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ww = sp_sample.surface_w;
|
||||||
var hh = 0;
|
var hh = 0;
|
||||||
var grid_width = ui(128);
|
var grid_width = ui(104);
|
||||||
var grid_heigh = txt == "Workshop"? ui(128) : ui(96);
|
var grid_heigh = txt == "Workshop"? grid_width : grid_width * 0.75;
|
||||||
var grid_space = ui(20);
|
var grid_space = grid_width / 8;
|
||||||
var grid_line = ui(4);
|
var grid_line = ui(4);
|
||||||
|
|
||||||
var node_count = ds_list_size(list);
|
var node_count = ds_list_size(list);
|
||||||
var col = floor(sp_sample.surface_w / (grid_width + grid_space));
|
var col = floor(ww / (grid_width + grid_space));
|
||||||
var row = ceil(node_count / col);
|
var row = ceil(node_count / col);
|
||||||
var hh = ui(20);
|
var hh = ui(20);
|
||||||
var yy = _y + ui(20);
|
var xx = grid_space;
|
||||||
|
var yy = _y + hh;
|
||||||
var name_height = 0;
|
var name_height = 0;
|
||||||
|
|
||||||
for(var i = 0; i < row; i++) {
|
grid_space = (ww - col * grid_width) / (col + 1);
|
||||||
name_height = 0;
|
var group_labels = [];
|
||||||
|
var _curr_tag = "";
|
||||||
|
var _cur_col = 0;
|
||||||
|
var _nx, _boxx;
|
||||||
|
|
||||||
|
for(var i = 0; i < node_count; i++) {
|
||||||
|
|
||||||
for(var j = 0; j < col; j++) {
|
var _project = list[| i];
|
||||||
var index = i * col + j;
|
|
||||||
if(index >= node_count) break;
|
if(_group_label && _curr_tag != _project.tag) {
|
||||||
|
|
||||||
var _project = list[| index];
|
if(name_height) {
|
||||||
var _nx = grid_space + (grid_width + grid_space) * j;
|
var hght = grid_heigh + name_height + grid_line;
|
||||||
var _boxx = _nx;
|
hh += hght;
|
||||||
|
yy += hght;
|
||||||
if(yy > -grid_heigh && yy < sp_sample.surface_h) {
|
|
||||||
draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_width, grid_heigh);
|
|
||||||
if(sHOVER && sp_sample.hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_heigh)) { #region
|
|
||||||
var _meta = _project.getMetadata();
|
|
||||||
if(txt == "Workshop")
|
|
||||||
TOOLTIP = _meta;
|
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.node_active, 0, _boxx, yy, grid_width, grid_heigh, COLORS._main_accent, 1);
|
|
||||||
if(mouse_press(mb_left, sFOCUS)) {
|
|
||||||
LOAD_PATH(_project.path, true);
|
|
||||||
PROJECT.thumbnail = array_safe_get_fast(_project.spr_path, 0);
|
|
||||||
|
|
||||||
if(txt == "Workshop") {
|
|
||||||
PROJECT.meta.file_id = _meta.file_id;
|
|
||||||
PROJECT.meta.steam = FILE_STEAM_TYPE.steamOpen;
|
|
||||||
}
|
|
||||||
instance_destroy();
|
|
||||||
}
|
|
||||||
} #endregion
|
|
||||||
|
|
||||||
var spr = _project.getSpr();
|
|
||||||
if(spr) { #region
|
|
||||||
var gw = grid_width - ui(8);
|
|
||||||
var gh = grid_heigh - ui(8);
|
|
||||||
|
|
||||||
var sw = sprite_get_width(spr);
|
|
||||||
var sh = sprite_get_height(spr);
|
|
||||||
|
|
||||||
var s = min(gw / sw, gh / sh);
|
|
||||||
|
|
||||||
var ox = (sprite_get_xoffset(spr) - sw / 2) * s;
|
|
||||||
var oy = (sprite_get_yoffset(spr) - sh / 2) * s;
|
|
||||||
|
|
||||||
var _sx = _boxx + grid_width / 2 + ox;
|
|
||||||
var _sy = yy + grid_heigh / 2 + oy;
|
|
||||||
|
|
||||||
var _spw = sw * s;
|
|
||||||
var _sph = sh * s;
|
|
||||||
|
|
||||||
if(txt == "Workshop") {
|
|
||||||
clip_surf = surface_verify(clip_surf, _spw, _sph);
|
|
||||||
|
|
||||||
surface_set_target(clip_surf);
|
|
||||||
DRAW_CLEAR
|
|
||||||
|
|
||||||
draw_sprite_uniform(spr, 0, 0, 0, s);
|
|
||||||
gpu_set_blendmode_ext(bm_dest_colour, bm_zero);
|
|
||||||
draw_sprite_stretched(THEME.ui_panel_bg, 4, 0, 0, _spw, _sph);
|
|
||||||
BLEND_NORMAL
|
|
||||||
surface_reset_target();
|
|
||||||
|
|
||||||
draw_surface(clip_surf, _sx, _sy);
|
|
||||||
} else {
|
|
||||||
draw_sprite_uniform(spr, 0, _sx, _sy, s);
|
|
||||||
}
|
|
||||||
} #endregion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var tx = _boxx + grid_width / 2;
|
array_push(group_labels, { y: yy, text: _project.tag });
|
||||||
var ty = yy + grid_heigh + ui(4);
|
hh += ui(24 + 12);
|
||||||
draw_set_text(f_p2, fa_center, fa_top);
|
yy += ui(24 + 12);
|
||||||
|
|
||||||
|
_nx = xx;
|
||||||
|
_curr_tag = _project.tag;
|
||||||
|
_cur_col = 0;
|
||||||
|
name_height = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_nx = xx + (grid_width + grid_space) * _cur_col;
|
||||||
|
_boxx = _nx;
|
||||||
|
|
||||||
|
if(yy > -grid_heigh && yy < sp_sample.surface_h) {
|
||||||
|
draw_sprite_stretched(THEME.node_bg, 0, _boxx, yy, grid_width, grid_heigh);
|
||||||
|
if(sHOVER && sp_sample.hover && point_in_rectangle(_m[0], _m[1], _nx, yy, _nx + grid_width, yy + grid_heigh)) {
|
||||||
|
var _meta = _project.getMetadata();
|
||||||
|
if(txt == "Workshop")
|
||||||
|
TOOLTIP = _meta;
|
||||||
|
|
||||||
if(txt == "Sample projects") { #region
|
draw_sprite_stretched_ext(THEME.node_active, 0, _boxx, yy, grid_width, grid_heigh, COLORS._main_accent, 1);
|
||||||
var _tw = string_width(_project.tag);
|
if(mouse_press(mb_left, sFOCUS)) {
|
||||||
var _th = string_height(_project.tag);
|
LOAD_PATH(_project.path, true);
|
||||||
|
PROJECT.thumbnail = array_safe_get_fast(_project.spr_path, 0);
|
||||||
|
|
||||||
draw_set_color(COLORS.dialog_splash_badge);
|
if(txt == "Workshop") {
|
||||||
var _rr = THEME_VALUE.selection_corner_radius;
|
PROJECT.meta.file_id = _meta.file_id;
|
||||||
draw_roundrect_ext(tx - _tw / 2 - ui(6), ty - ui(2), tx + _tw / 2 + ui(6), ty + _th, _rr, _rr, 0);
|
PROJECT.meta.steam = FILE_STEAM_TYPE.steamOpen;
|
||||||
draw_set_color(_project.tag == "Getting started"? COLORS._main_text_accent : COLORS._main_text_sub);
|
}
|
||||||
draw_text(tx, ty - ui(1), _project.tag);
|
instance_destroy();
|
||||||
|
}
|
||||||
ty += line_get_height(, ui(4));
|
}
|
||||||
} #endregion
|
|
||||||
|
var spr = _project.getSpr();
|
||||||
|
if(spr) {
|
||||||
|
var gw = grid_width - ui(8);
|
||||||
|
var gh = grid_heigh - ui(8);
|
||||||
|
|
||||||
draw_set_text(f_p1, fa_center, fa_top, COLORS._main_text);
|
var sw = sprite_get_width(spr);
|
||||||
name_height = max(name_height, string_height_ext(_project.name, -1, grid_width) + ui(8));
|
var sh = sprite_get_height(spr);
|
||||||
draw_text_ext_add(tx, ty - ui(2), _project.name, -1, grid_width);
|
|
||||||
|
var s = min(gw / sw, gh / sh);
|
||||||
|
|
||||||
|
var ox = (sprite_get_xoffset(spr) - sw / 2) * s;
|
||||||
|
var oy = (sprite_get_yoffset(spr) - sh / 2) * s;
|
||||||
|
|
||||||
|
var _sx = _boxx + grid_width / 2 + ox;
|
||||||
|
var _sy = yy + grid_heigh / 2 + oy;
|
||||||
|
|
||||||
|
var _spw = sw * s;
|
||||||
|
var _sph = sh * s;
|
||||||
|
|
||||||
|
if(txt == "Workshop") {
|
||||||
|
clip_surf = surface_verify(clip_surf, _spw, _sph);
|
||||||
|
|
||||||
|
surface_set_target(clip_surf);
|
||||||
|
DRAW_CLEAR
|
||||||
|
|
||||||
|
draw_sprite_uniform(spr, 0, 0, 0, s);
|
||||||
|
gpu_set_blendmode_ext(bm_dest_colour, bm_zero);
|
||||||
|
draw_sprite_stretched(THEME.ui_panel_bg, 4, 0, 0, _spw, _sph);
|
||||||
|
BLEND_NORMAL
|
||||||
|
surface_reset_target();
|
||||||
|
|
||||||
|
draw_surface(clip_surf, _sx, _sy);
|
||||||
|
} else {
|
||||||
|
draw_sprite_uniform(spr, 0, _sx, _sy, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var hght = grid_heigh + name_height + grid_line;
|
var tx = _boxx + grid_width / 2;
|
||||||
if(txt == "Sample projects") hght += line_get_height(f_p2, ui(4));
|
var ty = yy + grid_heigh + ui(4);
|
||||||
|
var _name = _project.name;
|
||||||
|
if(string_digits(string_char_at(_name, 1)) != "")
|
||||||
|
_name = string_copy(_name, string_pos(" ", _name), string_length(_name) - string_pos(" ", _name) + 1);
|
||||||
|
|
||||||
|
draw_set_text(f_p2, fa_center, fa_top, COLORS._main_text);
|
||||||
|
name_height = max(name_height, string_height_ext(_name, -1, grid_width) + ui(8));
|
||||||
|
draw_text_ext_add(tx, ty - ui(2), _name, -1, grid_width);
|
||||||
|
|
||||||
|
if(++_cur_col >= col || i == node_count - 1) {
|
||||||
|
if(name_height) {
|
||||||
|
var hght = grid_heigh + name_height + grid_line;
|
||||||
|
hh += hght;
|
||||||
|
yy += hght;
|
||||||
|
}
|
||||||
|
|
||||||
|
name_height = 0;
|
||||||
|
_cur_col = 0;
|
||||||
|
}
|
||||||
|
|
||||||
hh += hght;
|
|
||||||
yy += hght;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(_group_label) {
|
||||||
|
var len = array_length(group_labels);
|
||||||
|
if(len) {
|
||||||
|
gpu_set_blendmode(bm_subtract);
|
||||||
|
draw_set_color(c_white);
|
||||||
|
draw_rectangle(0, 0, ww, ui(36), false);
|
||||||
|
gpu_set_blendmode(bm_normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
var pd = grid_space / 2;
|
||||||
|
|
||||||
|
for( var i = 0; i < len; i++ ) {
|
||||||
|
var lb = group_labels[i];
|
||||||
|
var _yy = max(lb.y, i == len - 1? ui(8) : min(ui(8), group_labels[i + 1].y - ui(32)));
|
||||||
|
|
||||||
|
BLEND_OVERRIDE
|
||||||
|
draw_sprite_stretched_ext(THEME.group_label, 0, pd, _yy, ww - pd * 2, ui(24), c_white, 0.3);
|
||||||
|
BLEND_NORMAL
|
||||||
|
|
||||||
|
draw_set_text(f_p2, fa_left, fa_center, CDEF.main_ltgrey);
|
||||||
|
draw_text_add(pd + ui(16), _yy + ui(12), lb.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return hh + ui(20);
|
return hh + ui(20);
|
||||||
}); #endregion
|
}); #endregion
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -260,7 +301,7 @@ event_inherited();
|
||||||
contest_viewing = noone;
|
contest_viewing = noone;
|
||||||
|
|
||||||
sp_contest = new scrollPane(x1 - x0 - ui(12), y1 - y0 - 2, function(_y, _m) {
|
sp_contest = new scrollPane(x1 - x0 - ui(12), y1 - y0 - 2, function(_y, _m) {
|
||||||
draw_clear_alpha(COLORS.panel_bg_clear_inner, 0);
|
draw_clear_alpha(COLORS.panel_bg_clear, 0);
|
||||||
var hh = 0;
|
var hh = 0;
|
||||||
|
|
||||||
if(contest_viewing == noone) {
|
if(contest_viewing == noone) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ if !ready exit;
|
||||||
var expand = PREFERENCES.splash_expand_recent;
|
var expand = PREFERENCES.splash_expand_recent;
|
||||||
|
|
||||||
switch(pages[project_page]) {
|
switch(pages[project_page]) {
|
||||||
case "Sample projects" :
|
case "Welcome Files" :
|
||||||
case "Workshop" :
|
case "Workshop" :
|
||||||
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) {
|
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) {
|
||||||
PREFERENCES.splash_expand_recent = !PREFERENCES.splash_expand_recent;
|
PREFERENCES.splash_expand_recent = !PREFERENCES.splash_expand_recent;
|
||||||
|
@ -91,7 +91,7 @@ if !ready exit;
|
||||||
var amo = 0;
|
var amo = 0;
|
||||||
|
|
||||||
switch(txt) {
|
switch(txt) {
|
||||||
case "Sample projects" : amo = ds_list_size(SAMPLE_PROJECTS); break;
|
case "Welcome Files" : amo = ds_list_size(SAMPLE_PROJECTS); break;
|
||||||
case "Workshop" : amo = ds_list_size(STEAM_PROJECTS); break;
|
case "Workshop" : amo = ds_list_size(STEAM_PROJECTS); break;
|
||||||
case "Contests" : dtxt = ""; break;
|
case "Contests" : dtxt = ""; break;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ if !ready exit;
|
||||||
draw_sprite_bbox(THEME.ui_panel_tab, 3, tab_cover);
|
draw_sprite_bbox(THEME.ui_panel_tab, 3, tab_cover);
|
||||||
|
|
||||||
switch(pages[project_page]) {
|
switch(pages[project_page]) {
|
||||||
case "Sample projects" :
|
case "Welcome Files" :
|
||||||
sp_sample.setFocusHover(sFOCUS, sHOVER);
|
sp_sample.setFocusHover(sFOCUS, sHOVER);
|
||||||
sp_sample.draw(x0 + ui(6), y0);
|
sp_sample.draw(x0 + ui(6), y0);
|
||||||
|
|
||||||
|
|
|
@ -60,24 +60,23 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
||||||
var _anim = getInputData(12);
|
var _anim = getInputData(12);
|
||||||
var _cnt_hover = false;
|
var _cnt_hover = false;
|
||||||
|
|
||||||
draw_sprite_stretched(THEME.button_def, 0, _x, _y, _w, _h);
|
draw_sprite_stretched_ext(THEME.ui_panel_bg, 1, _x, _y, _w, _h, COLORS.node_composite_bg_blend, 1);
|
||||||
|
|
||||||
if(_hover && frame_renderer.parent != noone && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h)) {
|
if(_hover && frame_renderer.parent != noone && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h)) {
|
||||||
frame_renderer.parent.scroll_lock = true;
|
frame_renderer.parent.scroll_lock = true;
|
||||||
_cnt_hover = _hover;
|
_cnt_hover = _hover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _pd = ui(2);
|
||||||
var _aw = ui(32);
|
var _aw = ui(32);
|
||||||
var _ww = _w - ui(4) - _aw;
|
var _ww = _w - _pd - _aw;
|
||||||
var _hh = _h - ui(4) - ui(4);
|
var _hh = _h - _pd - _pd;
|
||||||
|
|
||||||
var _x0 = _x + ui(4);
|
var _x0 = _x + _pd;
|
||||||
var _y0 = _y + ui(4);
|
var _y0 = _y + _pd;
|
||||||
var _x1 = _x0 + _ww;
|
var _x1 = _x0 + _ww;
|
||||||
var _y1 = _y0 + _hh;
|
var _y1 = _y0 + _hh;
|
||||||
|
|
||||||
draw_sprite_stretched(THEME.ui_panel_bg, 1, _x0, _y0, _ww, _hh);
|
|
||||||
|
|
||||||
frame_renderer_x_max = 0;
|
frame_renderer_x_max = 0;
|
||||||
frame_renderer_content = surface_verify(frame_renderer_content, _ww, _hh);
|
frame_renderer_content = surface_verify(frame_renderer_content, _ww, _hh);
|
||||||
surface_set_shader(frame_renderer_content);
|
surface_set_shader(frame_renderer_content);
|
||||||
|
@ -87,7 +86,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
||||||
var _fr_h = _hh - 8;
|
var _fr_h = _hh - 8;
|
||||||
var _fr_w = _fr_h;
|
var _fr_w = _fr_h;
|
||||||
|
|
||||||
var _fr_x = 8 - frame_renderer_x;
|
var _fr_x = 4 - frame_renderer_x;
|
||||||
var _fr_y = 4;
|
var _fr_y = 4;
|
||||||
|
|
||||||
var surfs = output_surface;
|
var surfs = output_surface;
|
||||||
|
@ -105,33 +104,40 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
||||||
var _sx = _fr_x;
|
var _sx = _fr_x;
|
||||||
var _sy = _fr_y + _fr_h / 2 - _sh * _ss / 2;
|
var _sy = _fr_y + _fr_h / 2 - _sh * _ss / 2;
|
||||||
|
|
||||||
|
var _ssw = _sw * _ss;
|
||||||
|
var _ssh = _sh * _ss;
|
||||||
|
|
||||||
draw_surface_ext(_surf, _sx, _sy, _ss, _ss, 0, c_white, 0.75);
|
draw_surface_ext(_surf, _sx, _sy, _ss, _ss, 0, c_white, 0.75);
|
||||||
|
draw_sprite_stretched_add(THEME.menu_button_mask, 1, _sx, _sy, _ssw, _ssh, i == preview_index? COLORS._main_accent : COLORS.panel_toolbar_outline, 1);
|
||||||
|
|
||||||
draw_set_color(i == preview_index? COLORS._main_accent : COLORS.panel_toolbar_outline);
|
if(_hover && point_in_rectangle(_m[0], _m[1], _x0, _y0, _x1, _y1)) {
|
||||||
draw_rectangle(_sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss, true);
|
var _del_x = _sx + _fr_w - 10;
|
||||||
|
var _del_y = _sy + 10;
|
||||||
var _del_x = _sx + _sw * _ss - 8;
|
var _del_a = noone;
|
||||||
var _del_y = _sy + 8;
|
|
||||||
var _del_a = 0;
|
|
||||||
|
|
||||||
if(_hover) {
|
|
||||||
if(point_in_circle(_msx, _msy, _del_x, _del_y, 8)) {
|
if(point_in_circle(_msx, _msy, _del_x, _del_y, 8)) {
|
||||||
_del_a = 1;
|
_del_a = 1;
|
||||||
|
|
||||||
if(mouse_press(mb_left, _focus))
|
if(mouse_press(mb_left, _focus))
|
||||||
_del = i;
|
_del = i;
|
||||||
} else if(point_in_rectangle(_msx, _msy, _sx, _sy, _sx + _sw * _ss, _sy + _sh * _ss)) {
|
} else if(point_in_rectangle(_msx, _msy, _sx, _sy, _sx + _ssw, _sy + _ssh)) {
|
||||||
|
_del_a = 0;
|
||||||
|
|
||||||
if(mouse_press(mb_left, _focus)) {
|
if(mouse_press(mb_left, _focus)) {
|
||||||
if(_anim) PROJECT.animator.setFrame(i);
|
if(_anim) PROJECT.animator.setFrame(i);
|
||||||
else preview_index = i;
|
else preview_index = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(_del_a != noone) {
|
||||||
|
draw_sprite_ext(THEME.cross_12, 0, _del_x, _del_y, 1, 1, 0, c_white, .5 + _del_a * .5);
|
||||||
|
draw_sprite_stretched_add(THEME.menu_button_mask, 1, _sx, _sy, _ssw, _ssh, c_white, .2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_sprite(THEME.close_16, _del_a, _del_x, _del_y);
|
var _xw = _ssw + 4;
|
||||||
|
_fr_x += _xw;
|
||||||
_fr_x += _sw * _ss + 8;
|
frame_renderer_x_max += _xw;
|
||||||
frame_renderer_x_max += _sw * _ss + 8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_del > noone) removeFrame(_del);
|
if(_del > noone) removeFrame(_del);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _group) constructor {
|
function Node_Canvas_Group(_x, _y, _group) : Node_Collection(_x, _y, _group) constructor {
|
||||||
name = "Canvas Group";
|
name = "Canvas Group";
|
||||||
color = COLORS.node_blend_canvas;
|
color = COLORS.node_blend_canvas;
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
||||||
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF )
|
inputs[| 0] = nodeValue("Dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, DEF_SURF )
|
||||||
.setDisplay(VALUE_DISPLAY.vector);
|
.setDisplay(VALUE_DISPLAY.vector);
|
||||||
|
|
||||||
|
custom_input_index = ds_list_size(inputs);
|
||||||
|
|
||||||
layers = {};
|
layers = {};
|
||||||
canvases = [];
|
canvases = [];
|
||||||
composite = noone;
|
composite = noone;
|
||||||
|
@ -61,9 +63,10 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
||||||
return _h;
|
return _h;
|
||||||
});
|
});
|
||||||
|
|
||||||
input_display_list = [ 0,
|
group_input_display_list = [ 0,
|
||||||
["Layers", false], layer_renderer,
|
["Layers", false], layer_renderer,
|
||||||
["Frames", false], frame_renderer,
|
["Frames", false], frame_renderer,
|
||||||
|
["Inputs", false],
|
||||||
];
|
];
|
||||||
|
|
||||||
static refreshNodes = function() {
|
static refreshNodes = function() {
|
||||||
|
@ -122,14 +125,12 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static onAddNode = function(node) {
|
static onAdd = function(node) {
|
||||||
node.modifiable = false;
|
node.modifiable = false;
|
||||||
node.modify_parent = self;
|
node.modify_parent = self;
|
||||||
|
|
||||||
if(is_instanceof(node, Node_Canvas))
|
if(is_instanceof(node, Node_Canvas)) array_push(canvases, node);
|
||||||
array_push(canvases, node);
|
else if(is_instanceof(node, Node_Composite)) composite = node;
|
||||||
else if(is_instanceof(node, Node_Composite))
|
|
||||||
composite = node;
|
|
||||||
|
|
||||||
refreshLayer();
|
refreshLayer();
|
||||||
}
|
}
|
||||||
|
@ -156,7 +157,7 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
||||||
|
|
||||||
composite.dummy_input.setFrom(_canvas.outputs[| 0]);
|
composite.dummy_input.setFrom(_canvas.outputs[| 0]);
|
||||||
|
|
||||||
addNode(_canvas);
|
add(_canvas);
|
||||||
return _canvas;
|
return _canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,14 +173,17 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
||||||
}
|
}
|
||||||
|
|
||||||
if(NODE_NEW_MANUAL) {
|
if(NODE_NEW_MANUAL) {
|
||||||
var _canvas = nodeBuild("Node_Canvas", x, y);
|
var _canvas = nodeBuild("Node_Canvas", x - 160, y);
|
||||||
_canvas.inputs[| 12].setValue(true);
|
_canvas.inputs[| 12].setValue(true);
|
||||||
|
|
||||||
var _compose = nodeBuild("Node_Composite", x + 160, y);
|
var _compose = nodeBuild("Node_Composite", x, y);
|
||||||
_compose.dummy_input.setFrom(_canvas.outputs[| 0]);
|
_compose.dummy_input.setFrom(_canvas.outputs[| 0]);
|
||||||
|
|
||||||
addNode(_canvas);
|
add(_canvas);
|
||||||
addNode(_compose);
|
add(_compose);
|
||||||
|
|
||||||
|
var _output = nodeBuild("Node_Group_Output", x + 160, y, self);
|
||||||
|
_output.inputs[| 0].setFrom(_compose.outputs[| 0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||||
|
@ -226,4 +230,6 @@ function Node_Canvas_Group(_x, _y, _group) : Node_Collection_Inline(_x, _y, _gro
|
||||||
refreshMember();
|
refreshMember();
|
||||||
refreshNodes();
|
refreshNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sortIO();
|
||||||
}
|
}
|
|
@ -187,6 +187,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
||||||
|
|
||||||
metadata = new MetaDataManager();
|
metadata = new MetaDataManager();
|
||||||
|
|
||||||
|
group_input_display_list = [];
|
||||||
|
group_output_display_list = [];
|
||||||
attributes.input_display_list = [];
|
attributes.input_display_list = [];
|
||||||
attributes.output_display_list = [];
|
attributes.output_display_list = [];
|
||||||
|
|
||||||
|
@ -393,7 +395,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
||||||
|
|
||||||
static exitGroup = function() {}
|
static exitGroup = function() {}
|
||||||
|
|
||||||
static add = function(_node) { #region
|
static onAdd = function(_node) {}
|
||||||
|
static add = function(_node) {
|
||||||
array_push(getNodeList(), _node);
|
array_push(getNodeList(), _node);
|
||||||
var list = _node.group == noone? PANEL_GRAPH.nodes_list : _node.group.getNodeList();
|
var list = _node.group == noone? PANEL_GRAPH.nodes_list : _node.group.getNodeList();
|
||||||
array_remove(list, _node);
|
array_remove(list, _node);
|
||||||
|
@ -403,9 +406,12 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
||||||
|
|
||||||
will_refresh = true;
|
will_refresh = true;
|
||||||
node_length = array_length(nodes);
|
node_length = array_length(nodes);
|
||||||
} #endregion
|
|
||||||
|
onAdd(_node);
|
||||||
|
}
|
||||||
|
|
||||||
static remove = function(_node) { #region
|
static onRemove = function(_node) {}
|
||||||
|
static remove = function(_node) {
|
||||||
var _hide = _node.destroy_when_upgroup;
|
var _hide = _node.destroy_when_upgroup;
|
||||||
|
|
||||||
if(!_hide) {
|
if(!_hide) {
|
||||||
|
@ -426,7 +432,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
||||||
|
|
||||||
will_refresh = true;
|
will_refresh = true;
|
||||||
node_length = array_length(nodes);
|
node_length = array_length(nodes);
|
||||||
} #endregion
|
onRemove(_node);
|
||||||
|
}
|
||||||
|
|
||||||
static clearCache = function() { #region
|
static clearCache = function() { #region
|
||||||
array_foreach(getNodeList(), function(node) { node.clearCache(); });
|
array_foreach(getNodeList(), function(node) { node.clearCache(); });
|
||||||
|
@ -486,27 +493,29 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
|
||||||
var _ilen = ds_list_size(inputs);
|
var _ilen = ds_list_size(inputs);
|
||||||
var _iarr = attributes.input_display_list;
|
var _iarr = attributes.input_display_list;
|
||||||
|
|
||||||
for( var i = 0; i < _ilen; i++ )
|
for( var i = custom_input_index; i < _ilen; i++ )
|
||||||
array_push_unique(_iarr, i);
|
array_push_unique(_iarr, i);
|
||||||
|
|
||||||
for( var i = array_length(_iarr) - 1; i >= 0; i-- ) {
|
for( var i = array_length(_iarr) - 1; i >= 0; i-- ) {
|
||||||
if(is_array(_iarr[i])) continue;
|
if(is_array(_iarr[i])) continue;
|
||||||
if(_iarr[i] >= _ilen) array_delete(_iarr, i, 1);
|
if(_iarr[i] >= _ilen) array_delete(_iarr, i, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
input_display_list = attributes.input_display_list;
|
input_display_list = array_merge(group_input_display_list, attributes.input_display_list);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
var _olen = ds_list_size(outputs);
|
var _olen = ds_list_size(outputs);
|
||||||
var _oarr = attributes.output_display_list;
|
var _oarr = attributes.output_display_list;
|
||||||
|
|
||||||
for( var i = 0; i < _olen; i++ )
|
for( var i = custom_output_index; i < _olen; i++ )
|
||||||
array_push_unique(_oarr, i);
|
array_push_unique(_oarr, i);
|
||||||
for( var i = array_length(_oarr) - 1; i >= 0; i-- ) {
|
for( var i = array_length(_oarr) - 1; i >= 0; i-- ) {
|
||||||
if(is_array(_oarr[i])) continue;
|
if(is_array(_oarr[i])) continue;
|
||||||
if(_oarr[i] >= _olen) array_delete(_oarr, i, 1);
|
if(_oarr[i] >= _olen) array_delete(_oarr, i, 1);
|
||||||
}
|
}
|
||||||
output_display_list = attributes.output_display_list;
|
|
||||||
|
output_display_list = array_merge(group_output_display_list, attributes.output_display_list);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,20 @@ function LOAD_SAMPLE() { #region
|
||||||
directory_verify(targ);
|
directory_verify(targ);
|
||||||
zip_unzip(zzip, targ);
|
zip_unzip(zzip, targ);
|
||||||
|
|
||||||
LOAD_FOLDER(SAMPLE_PROJECTS, "Getting started");
|
var _dir = [];
|
||||||
LOAD_FOLDER(SAMPLE_PROJECTS, "Sample Projects");
|
var path = $"{DIRECTORY}Welcome files/";
|
||||||
|
var file = file_find_first(path + "/*", fa_directory);
|
||||||
|
|
||||||
|
while(file != "") {
|
||||||
|
if(directory_exists(path + "/" + file))
|
||||||
|
array_push(_dir, file);
|
||||||
|
file = file_find_next();
|
||||||
|
}
|
||||||
|
file_find_close();
|
||||||
|
|
||||||
|
LOAD_FOLDER(SAMPLE_PROJECTS, "Getting started"); array_remove(_dir, "Getting started");
|
||||||
|
LOAD_FOLDER(SAMPLE_PROJECTS, "Sample Projects"); array_remove(_dir, "Sample Projects");
|
||||||
|
|
||||||
|
for (var i = 0, n = array_length(_dir); i < n; i++)
|
||||||
|
LOAD_FOLDER(SAMPLE_PROJECTS, _dir[i]);
|
||||||
} #endregion
|
} #endregion
|
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -12,14 +12,14 @@
|
||||||
"edgeFiltering":false,
|
"edgeFiltering":false,
|
||||||
"For3D":false,
|
"For3D":false,
|
||||||
"frames":[
|
"frames":[
|
||||||
{"$GMSpriteFrame":"","%Name":"1e97260f-8a9a-4556-91ed-7d59be5b095c","name":"1e97260f-8a9a-4556-91ed-7d59be5b095c","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
|
{"$GMSpriteFrame":"","%Name":"7d5fa79e-0d7e-48c6-9ec6-3814fa4daf83","name":"7d5fa79e-0d7e-48c6-9ec6-3814fa4daf83","resourceType":"GMSpriteFrame","resourceVersion":"2.0",},
|
||||||
],
|
],
|
||||||
"gridX":0,
|
"gridX":0,
|
||||||
"gridY":0,
|
"gridY":0,
|
||||||
"height":64,
|
"height":64,
|
||||||
"HTile":false,
|
"HTile":false,
|
||||||
"layers":[
|
"layers":[
|
||||||
{"$GMImageLayer":"","%Name":"4d76f170-b94f-4c41-81bf-c7a0647f4884","blendMode":0,"displayName":"default","isLocked":false,"name":"4d76f170-b94f-4c41-81bf-c7a0647f4884","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
|
{"$GMImageLayer":"","%Name":"f30e5273-f033-4b6f-a199-cc827c3072f5","blendMode":0,"displayName":"default","isLocked":false,"name":"f30e5273-f033-4b6f-a199-cc827c3072f5","opacity":100.0,"resourceType":"GMImageLayer","resourceVersion":"2.0","visible":true,},
|
||||||
],
|
],
|
||||||
"name":"s_node_interlace",
|
"name":"s_node_interlace",
|
||||||
"nineSlice":null,
|
"nineSlice":null,
|
||||||
|
@ -69,8 +69,8 @@
|
||||||
"tracks":[
|
"tracks":[
|
||||||
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
|
{"$GMSpriteFramesTrack":"","builtinName":0,"events":[],"inheritsTrackColour":true,"interpolation":1,"isCreationTrack":false,"keyframes":{"$KeyframeStore<SpriteFrameKeyframe>":"","Keyframes":[
|
||||||
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
|
{"$Keyframe<SpriteFrameKeyframe>":"","Channels":{
|
||||||
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"1e97260f-8a9a-4556-91ed-7d59be5b095c","path":"sprites/s_node_interlace/s_node_interlace.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
|
"0":{"$SpriteFrameKeyframe":"","Id":{"name":"7d5fa79e-0d7e-48c6-9ec6-3814fa4daf83","path":"sprites/s_node_interlace/s_node_interlace.yy",},"resourceType":"SpriteFrameKeyframe","resourceVersion":"2.0",},
|
||||||
},"Disabled":false,"id":"1aa16e81-d840-47ad-a004-ce3dba211fe8","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
|
},"Disabled":false,"id":"67e18d6b-8bd2-4f11-8401-aece83393f30","IsCreationKey":false,"Key":0.0,"Length":1.0,"resourceType":"Keyframe<SpriteFrameKeyframe>","resourceVersion":"2.0","Stretch":false,},
|
||||||
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
|
],"resourceType":"KeyframeStore<SpriteFrameKeyframe>","resourceVersion":"2.0",},"modifiers":[],"name":"frames","resourceType":"GMSpriteFramesTrack","resourceVersion":"2.0","spriteId":null,"trackColour":0,"tracks":[],"traits":0,},
|
||||||
],
|
],
|
||||||
"visibleRange":null,
|
"visibleRange":null,
|
||||||
|
|
Loading…
Reference in a new issue