Sample projects

This commit is contained in:
MakhamDev 2022-01-29 20:25:18 +07:00
parent 0e3f997708
commit d2efacc2a9
45 changed files with 518 additions and 1317 deletions

View file

@ -517,6 +517,7 @@
{"id":{"name":"f_p1","path":"fonts/f_p1/f_p1.yy",},"order":1,},
{"id":{"name":"s_button_left","path":"sprites/s_button_left/s_button_left.yy",},"order":5,},
{"id":{"name":"curve_bezier_function","path":"scripts/curve_bezier_function/curve_bezier_function.yy",},"order":0,},
{"id":{"name":"draw_line_dashed","path":"scripts/draw_line_dashed/draw_line_dashed.yy",},"order":7,},
{"id":{"name":"s_node_glow","path":"sprites/s_node_glow/s_node_glow.yy",},"order":46,},
{"id":{"name":"regex","path":"scripts/regex/regex.yy",},"order":0,},
{"id":{"name":"node_invert","path":"scripts/node_invert/node_invert.yy",},"order":41,},
@ -588,7 +589,6 @@
],
"isDnDProject": false,
"isEcma": false,
"tutorialPath": "",
"configs": {
"name": "Default",
"children": [],
@ -723,13 +723,21 @@
{"CopyToMask":-1,"filePath":"datafiles/ImageMagick","resourceVersion":"1.0","name":"NOTICE.txt","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/ImageMagick","resourceVersion":"1.0","name":"policy.xml","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles","resourceVersion":"1.0","name":"Collections.zip","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Sample Projects","resourceVersion":"1.0","name":"0 introduction.pxc","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Sample Projects","resourceVersion":"1.0","name":"1 image import.pxc","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Sample Projects","resourceVersion":"1.0","name":"2 animation.pxc","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Sample Projects","resourceVersion":"1.0","name":"3 Group and collection.pxc","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"0 introduction.pxc","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"1 image import.pxc","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"3 Group and collection.pxc","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"5 Particle and effectors.pxc","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"4 Looping operation.pxc","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"2 animation.pxc","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"5 Particle and effectors.png","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"2 animation.png","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"1 image import.png","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"0 introduction.png","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"3 Group and collection.png","resourceType":"GMIncludedFile",},
{"CopyToMask":-1,"filePath":"datafiles/Getting started","resourceVersion":"1.0","name":"4 Looping operation.png","resourceType":"GMIncludedFile",},
],
"MetaData": {
"IDEVersion": "2.3.7.606",
"IDEVersion": "2022.1.0.609",
},
"resourceVersion": "1.4",
"name": "Pixels Composer",

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
{ "nodes": [ { "group": -1.0, "x": -352.0, "id": 308341973.0, "inputs": [ { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, [ 64.0, 64.0 ], 0.0, 0.0 ] ], "anim": 0.0, "visible": 1.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 1.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, [ 32.0, 32.0, 16.0, 16.0, 0.0 ], 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 3.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.5, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, [ 0.0, 0.0 ], 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 16777215.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 } ], "attri": { }, "type": "Node_Shape", "y": 0.0, "name": "Shape" }, { "group": -1.0, "x": -448.0, "id": 660826364.0, "inputs": [ { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 16777215.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, "You combine multiple nodes in to one using group", 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 2.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.75, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 } ], "attri": { }, "type": "Node_Display_Text", "y": -128.0, "name": "Display text" }, { "group": -1.0, "x": -448.0, "id": 676613630.0, "inputs": [ { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 16777215.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, "Sample project 3: Group and collection ", 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 1.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.5, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 } ], "attri": { }, "type": "Node_Display_Text", "y": -192.0, "name": "Display text" }, { "group": -1.0, "x": -448.0, "id": 593948373.0, "inputs": [ { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 16777215.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, "Welcome to Pixel Composer", 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.0, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 }, { "from node": -1.0, "on end": 0.0, "data": [ ], "raw value": [ [ 0.0, 0.75, 0.0, 0.0 ] ], "anim": 0.0, "visible": 0.0, "from index": -1.0 } ], "attri": { }, "type": "Node_Display_Text", "y": -224.0, "name": "Display text" } ], "version": 82.0, "animator": { "framerate": 15.0, "frames_total": 12.0 } }

View file

@ -290,12 +290,26 @@ event_inherited();
else
draw_sprite_stretched_ext(s_node_bg, 0, _boxx, yy, grid_size, grid_size, merge_color(c_white, c_ui_orange_light, 0.5), 1);
if(variable_struct_exists(_node, "spr") && sprite_exists(_node.spr))
draw_sprite(_node.spr, current_time * PREF_MAP[? "collection_preview_speed"] / 3000, _boxx + grid_size / 2, yy + grid_size / 2);
if(variable_struct_exists(_node, "spr") && sprite_exists(_node.spr)) {
var _si = current_time * PREF_MAP[? "collection_preview_speed"] / 3000;
var _sw = sprite_get_width(_node.spr);
var _sh = sprite_get_height(_node.spr);
var _ss = 32 / max(_sw, _sh);
var _sox = sprite_get_xoffset(_node.spr);
var _soy = sprite_get_yoffset(_node.spr);
var _sx = _boxx + grid_size / 2;
var _sy = yy + grid_size / 2;
_sx += _sw * _ss / 2 - _sox * _ss;
_sy += _sh * _ss / 2 - _soy * _ss;
draw_sprite_ext(_node.spr, _si, _sx, _sy, _ss, _ss, 0, c_white, 1);
}
draw_set_text(f_p1, fa_center, fa_top, c_white);
var txt = _node.name;
if(_param != "") txt += " (" + _param + ")";
//if(_param != "") txt += " (" + _param + ")";
name_height = max(name_height, string_height_ext(txt, -1, grid_size) + 8);
draw_text_ext(_boxx + grid_size / 2, yy + grid_size + 4, txt, -1, grid_width);

View file

@ -8,7 +8,7 @@ event_inherited();
note = "";
var link = "https://gist.githubusercontent.com/Ttanasart-pt/e7ab670299ce6b00cfd632646f3ac9a8/raw/0.8.2";
var link = "https://gist.githubusercontent.com/Ttanasart-pt/e7ab670299ce6b00cfd632646f3ac9a8/raw/0.9.0";
node_get = http_get(link);
sp_note = new scrollPane(dialog_w - 80, dialog_h - 88, function(_y, _m) {

View file

@ -84,12 +84,23 @@ event_inherited();
if(_node.spr)
draw_sprite(_node.spr, 0, _boxx + grid_width / 2, yy + grid_heigh / 2);
var tx = _boxx + grid_width / 2;
var ty = yy + grid_heigh + 6;
draw_set_text(f_p2, fa_center, fa_top, c_ui_blue_dkgrey);
var _tw = string_width(_node.tag);
var _th = string_height(_node.tag);
draw_set_color(c_ui_blue_mdblack);
draw_roundrect_ext(tx - _tw / 2 - 6, ty - 2, tx + _tw / 2 + 6, ty + _th, 8, 8, 0);
draw_set_color(_node.tag == "Getting started"? c_ui_orange_light : c_ui_blue_grey);
draw_text(tx, ty, _node.tag);
draw_set_text(f_p1, fa_center, fa_top, c_white);
name_height = max(name_height, string_height_ext(_node.name, -1, grid_width) + 8);
draw_text_ext(_boxx + grid_width / 2, yy + grid_heigh + 4, _node.name, -1, grid_width);
draw_text_ext(tx, ty + 20, _node.name, -1, grid_width);
}
}
var hght = grid_heigh + grid_space + name_height;
var hght = grid_heigh + grid_space + name_height + 20;
hh += hght;
yy += hght;
}

View file

@ -5,6 +5,6 @@
if(PANEL_GRAPH.dropFile(file_dropping)) {
renderAll();
} else
load_file_path(file_dropping);
load_file_path(file_dropping, true);
file_dropping = "";
#endregion

View file

@ -12,7 +12,7 @@
file_text_close(f);
#endregion
display_reset(8, 1);
//display_reset(8, 1);
#region window
depth = 0;
@ -68,7 +68,7 @@ display_reset(8, 1);
file_dnd_allowdirs = true;
file_dnd_allowmulti = true;
function load_file_path(path) {
function load_file_path(path, _new = false) {
if(string_pos("\n", path) == 1) path = string_replace(path, "\n", "");
var is_multi = string_pos("\n", path) != 0 || directory_exists(path);
@ -92,6 +92,7 @@ display_reset(8, 1);
break;
case ".json" :
case ".pxc" :
if(_new) NEW();
LOAD_PATH(path);
break;
}

View file

@ -1,5 +1,6 @@
{
"option_gameguid": "e9b3db08-0894-4037-ab08-a13723151e39",
"option_gameid": "0",
"option_game_speed": 60,
"option_mips_for_3d_textures": false,
"option_draw_colour": 4294967295,
@ -7,9 +8,13 @@
"option_steam_app_id": "0",
"option_sci_usesci": true,
"option_author": "",
"option_collision_compatibility": true,
"option_lastchanged": "02 July 2021 15:58:28",
"option_spine_licence": false,
"resourceVersion": "1.2",
"option_template_image": "${base_options_dir}/main/template_image.png",
"option_template_icon": "${base_options_dir}/main/template_icon.png",
"option_template_description": null,
"resourceVersion": "1.3",
"name": "Main",
"tags": [],
"resourceType": "GMMainOptions",

View file

@ -34,7 +34,6 @@ function APPEND(_path) {
var _node = nodeLoad(_node_list[| i], true);
if(_node) ds_list_add(appended_list, _node);
}
ds_map_destroy(_map);
file_text_close(file);
for(var i = 0; i < ds_list_size(appended_list); i++) {
@ -91,6 +90,7 @@ function APPEND(_path) {
log_message("FILE", "append file " + _path);
PANEL_MENU.showNoti("Collection loaded", s_noti_icon_file_load);
ds_map_destroy(_map);
return node_create;
}

View file

@ -1,3 +1,8 @@
enum LINE_STYLE {
solid,
dashed
}
function draw_line_curve(x0, y0, x1, y1, thick = 1) {
var xc = (x0 + x1) / 2;
var sample = max(8, ceil((abs(x0 - x1) + abs(y0 - y1)) / 4));
@ -30,12 +35,13 @@ function draw_line_curve(x0, y0, x1, y1, thick = 1) {
//buffer_delete(buff);
}
function draw_line_curve_color(x0, y0, x1, y1, thick = 1, col1, col2) {
function draw_line_curve_color(x0, y0, x1, y1, thick, col1, col2, type = LINE_STYLE.solid) {
var xc = (x0 + x1) / 2;
var sample = max(8, ceil((abs(x0 - x1) + abs(y0 - y1)) / 4));
var c = draw_get_color();
var ox, oy, nx, ny, t, it, oc, nc;
var dash_distance = 2;
for( var i = 0; i <= sample; i++ ) {
t = i / sample;
@ -46,7 +52,15 @@ function draw_line_curve_color(x0, y0, x1, y1, thick = 1, col1, col2) {
nc = merge_color(col1, col2, t);
if(i) {
switch(type) {
case LINE_STYLE.solid :
draw_line_width_color(ox, oy, nx, ny, thick, oc, nc);
break;
case LINE_STYLE.dashed :
if(floor(i / dash_distance) % 2)
draw_line_width_color(ox, oy, nx, ny, thick, oc, nc);
break;
}
}
ox = nx;

View file

@ -0,0 +1,26 @@
function draw_line_dashed(x0, y0, x1, y1, th, c0, c1, dash_distance = 8) {
var dis = point_distance(x0, y0, x1, y1);
var dir = point_direction(x0, y0, x1, y1);
var part = ceil(dis / dash_distance);
var dx = lengthdir_x(1, dir);
var dy = lengthdir_y(1, dir);
var ox, oy, nx, ny, oc, nc;
var dd = 0;
for( var i = 0; i <= part; i++ ) {
dd = min(dis, i * dash_distance);
nx = x0 + dx * dd;
ny = y0 + dy * dd;
nc = merge_color(c0, c1, i / part);
if(i && i % 2) {
draw_line_width_color(ox, oy, nx, ny, th, oc, nc);
}
oc = nc;
ox = nx;
oy = ny;
}
}

View file

@ -0,0 +1,12 @@
{
"isDnD": false,
"isCompatibility": false,
"parent": {
"name": "draw",
"path": "folders/functions/draw.yy",
},
"resourceVersion": "1.0",
"name": "draw_line_dashed",
"tags": [],
"resourceType": "GMScript",
}

View file

@ -4,3 +4,4 @@ function draw_line_round(x1, y1, x2, y2, w) {
draw_circle(x1, y1, w/2, false);
draw_circle(x2, y2, w/2, false);
}

View file

@ -4,6 +4,12 @@ function ds_map_try_get(map, key, def) {
}
function ds_map_override(original, newmap) {
if(is_undefined(original)) return;
if(!ds_exists(original, ds_type_map)) return;
if(is_undefined(newmap)) return;
if(!ds_exists(newmap, ds_type_map)) return;
var k = ds_map_find_first(newmap);
repeat(ds_map_size(newmap)) {

View file

@ -15,7 +15,7 @@
globalvar VERSION, SAVEFILE_VERSION, VERSION_STRING;
VERSION = 90;
SAVEFILE_VERSION = 82;
SAVEFILE_VERSION = 90;
VERSION_STRING = "0.9.0";
globalvar NODES, ANIMATOR, NODE_MAP, APPEND_MAP, HOTKEYS, HOTKEY_CONTEXT;

View file

@ -63,7 +63,6 @@ function LOAD_PATH(path, readonly = false) {
ANIMATOR.frames_total = _anim_map[? "frames_total"];
ANIMATOR.framerate = _anim_map[? "framerate"];
}
ds_map_destroy(_map);
ds_queue_clear(CONNECTION_CONFLICT);
@ -116,5 +115,7 @@ function LOAD_PATH(path, readonly = false) {
log_message("FILE", "load at " + path);
PANEL_MENU.showNoti("File loaded", s_noti_icon_file_load);
ds_map_destroy(_map);
return true;
}

View file

@ -21,7 +21,7 @@ function Node_Array_Get(_x, _y) : Node(_x, _y) constructor {
inputs[| 2] = nodeValue(2, "Overflow", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, ["Clamp", "Loop", "Ping Pong"]);
outputs[| 0] = nodeValue(0, "Size", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0);
outputs[| 0] = nodeValue(0, "Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.any, 0);
static update = function() {
var _arr = inputs[| 0].getValue();

View file

@ -5,7 +5,6 @@ function Node_create_Canvas(_x, _y) {
}
function Node_Canvas(_x, _y) : Node(_x, _y) constructor {
display_reset(0, 1);
name = "Canvas";
color = c_ui_orange;
@ -23,7 +22,7 @@ function Node_Canvas(_x, _y) : Node(_x, _y) constructor {
inputs[| 4] = nodeValue(4, "Fill type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_scroll, ["4 connect", "8 connect", "Entire canvas"]);
inputs[| 5] = nodeValue(5, "Draw preview overlay", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false);
inputs[| 5] = nodeValue(5, "Draw preview overlay", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
inputs[| 6] = nodeValue(6, "Brush", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, -1);

View file

@ -26,8 +26,19 @@ function Node_Collection(_x, _y) : Node(_x, _y) constructor {
ds_list_add(list, _node);
recordAction(ACTION_TYPE.group_removed, self, _node);
switch(instanceof(_node)) {
case "Node_Group_Input" :
case "Node_Group_Output" :
case "Node_Iterator_Input" :
case "Node_Iterator_Output" :
case "Node_Iterator_Index" :
nodeDelete(_node);
break;
default :
_node.group = group;
}
}
static stepBegin = function() {
for(var i = 0; i < ds_list_size(nodes); i++) {
@ -36,7 +47,7 @@ function Node_Collection(_x, _y) : Node(_x, _y) constructor {
var out_surf = false;
for( var i = 0; i < ds_list_size(outputs); i++ ) {
for( var i = 0; i < ds_list_size(outputs); i++) {
if(outputs[| i].type == VALUE_TYPE.surface)
out_surf = true;
}

View file

@ -300,10 +300,17 @@ function Node(_x, _y) constructor {
if(PANEL_GRAPH.junction_hovering == jun)
th *= 2;
var ty = LINE_STYLE.solid;
if(jun.type == VALUE_TYPE.node)
ty = LINE_STYLE.dashed;
if(PREF_MAP[? "curve_connection_line"]) {
draw_line_curve_color(jx, jy, frx, fry, th, c0, c1);
draw_line_curve_color(jx, jy, frx, fry, th, c0, c1, ty);
} else {
if(ty == LINE_STYLE.solid)
draw_line_width_color(jx, jy, frx, fry, th, c0, c1);
else
draw_line_dashed(jx, jy, frx, fry, th, c0, c1, 12);
}
}
}

View file

@ -32,8 +32,185 @@ function Node_Display_Text(_x, _y) : Node(_x, _y) constructor {
inputs[| 3] = nodeValue(3, "Alpha", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.75)
.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01])
inputs[| 4] = nodeValue(4, "Line width", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1000000);
input_display_list = [1,
["Styling", false], 2, 0, 3];
["Styling", false], 2, 0, 3, 4];
_prev_text = "";
font = f_p1;
_lines = [];
static draw_text_style = function(_x, _y, txt, _s) {
var _tx = _x;
var index = 1;
var _len = string_length(txt);
var _ch = "";
var _tw, _th;
var _ch_h = string_height("l") * _s;
var _mode = 0;
var _cmd = "";
var width = 0;
var _cc = draw_get_color();
while(index <= _len) {
_ch = string_char_at(txt, index);
index++;
switch(_ch) {
case "<" :
_mode = 1;
continue;
case ">" :
var _c = string_splice(_cmd, " ");
if(array_length(_c) > 1) {
switch(_c[0]) {
case "bt" :
var _bch = "";
for( var i = 1; i < array_length(_c); i++ ) {
if(i > 1) _bch += " ";
_bch += _c[i];
}
_tw = string_width(_bch) * _s;
_th = string_height(_bch) * _s;
draw_set_color(c_ui_blue_dkblack);
draw_roundrect_ext(_tx - 4, _y - 4, _tx + _tw + 4, _y + _th + 4, 8, 8, 0);
draw_set_color(c_ui_blue_grey);
draw_roundrect_ext(_tx - 4, _y - 4, _tx + _tw + 4, _y + _th + 4, 8, 8, 1);
draw_set_color(_cc);
draw_text_transformed(_tx, _y, _bch, _s, _s, 0);
_tx += _tw;
width += string_width(_bch);
break;
case "spr" :
var _spr_t = _c[1];
var _spr = asset_get_index(_spr_t);
if(!sprite_exists(_spr)) break;
var _spr_i = array_length(_c) > 2? real(_c[2]) : 0;
var _spr_s = array_length(_c) > 3? _s * real(_c[3]) : _s;
_tw = sprite_get_width(_spr);
_th = sprite_get_height(_spr) * _spr_s;
var _ow = sprite_get_xoffset(_spr) * _spr_s;
var _oh = sprite_get_yoffset(_spr) * _spr_s;
draw_sprite_ext(_spr, _spr_i, _tx + _ow, _y + _ch_h / 2 - _th / 2 + _oh, _spr_s, _spr_s, 0, c_white, 1);
_tx += _tw * _spr_s;
width += _tw;
break;
}
}
_mode = 0;
_cmd = "";
continue;
}
switch(_mode) {
case 0 :
_tw = string_width(_ch);
_th = string_height(_ch);
draw_text_transformed(_tx, _y, _ch, _s, _s, 0);
_tx += _tw * _s;
width += _tw;
break;
case 1 :
_cmd += _ch;
break;
}
}
return width;
}
static string_raw = function(txt) {
var index = 1;
var _len = string_length(txt);
var _ch = "";
var _mode = 0;
var ss = "";
var ch_str = "";
while(index <= _len) {
_ch = string_char_at(txt, index);
index++;
switch(_ch) {
case "<" :
_mode = 1; continue;
case ">" :
var _c = string_splice(ch_str, " ");
if(array_length(_c) > 1) {
switch(_c[0]) {
case "bt" :
var _bch = "";
for( var i = 1; i < array_length(_c); i++ ) {
if(i > 1) _bch += " ";
_bch += _c[i];
}
ss += _bch;
break;
}
}
ch_str = "";
_mode = 0;
continue;
}
switch(_mode) {
case 0 : ss += _ch; break;
case 1 : ch_str += _ch; break;
}
}
return ss;
}
static line_update = function(txt, line_width = 999999) {
_prev_text = txt;
_lines = [];
var ch, i = 1, ss = "", _txt = _prev_text;
var len = string_length(_prev_text);
draw_set_font(font);
while(string_length(_txt) > 0) {
var sp = string_pos(" ", _txt);
if(sp == 0) sp = string_length(_txt);
var _ps = string_copy(_txt, 1, sp);
_txt = string_copy(_txt, sp + 1, string_length(_txt) - sp);
if(string_width(string_raw(ss + _ps)) >= line_width) {
array_push(_lines, ss);
ss = _ps;
} else if(string_length(_txt) <= 0) {
array_push(_lines, ss + _ps);
ss = "";
} else {
ss += _ps;
}
}
if(ss != "")
array_push(_lines, ss);
}
static onValueUpdate = function(index) {
if(index == 1 || index == 4)
line_update(inputs[| 1].getValue(), inputs[| 4].getValue());
}
static drawNodeBase = function(xx, yy, _s) {
var color = inputs[| 0].getValue();
@ -41,21 +218,39 @@ function Node_Display_Text(_x, _y) : Node(_x, _y) constructor {
if(txt == "") txt = "..."
var sty = inputs[| 2].getValue();
var alp = inputs[| 3].getValue();
var font = f_p1;
var wid = inputs[| 4].getValue();
font = f_p1;
switch(sty) {
case 0 : font = f_h3; break;
case 1 : font = f_h5; break;
case 2 : font = f_p1; break;
}
var ww = 0;
var hh = 0;
var tx = xx + 4;
var ty = yy + 4;
if(_prev_text != txt)
line_update(txt, wid);
draw_set_alpha(alp);
draw_set_text(font, fa_left, fa_top, color);
draw_text_transformed(xx + 4, yy + 4, txt, _s, _s, 0);
for( var i = 0; i < array_length(_lines); i++ ) {
var _line = _lines[i];
var _h = string_height(_line);
var _w = draw_text_style(tx, ty, _line, _s);
ww = max(ww, _w);
hh += _h;
ty += _h;
}
draw_set_alpha(1);
draw_scale = _s;
w = string_width(txt) + 8;
h = string_height(txt) + 8;
w = ww + 8;
h = hh + 8;
}
static drawNode = function(_x, _y, _mx, _my, _s) {

View file

@ -5,7 +5,6 @@ function Node_create_Line(_x, _y) {
}
function Node_Line(_x, _y) : Node(_x, _y) constructor {
display_reset(0, 1);
name = "Line";

View file

@ -22,7 +22,9 @@ function Node_Particle_Effector(_x, _y) : Node(_x, _y) constructor {
h = 32 + 24;
min_h = h;
inputs[| 0] = nodeValue(0, "Particle data", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, -1 );
inputs[| 0] = nodeValue(0, "Particle data", self, JUNCTION_CONNECT.input, VALUE_TYPE.object, -1 )
.setVisible(true, true);
inputs[| 1] = nodeValue(1, "Output dimension", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, def_surf_size2, VALUE_TAG.dimension_2d )
.setDisplay(VALUE_DISPLAY.vector);
@ -196,6 +198,7 @@ function Node_Particle_Effector(_x, _y) : Node(_x, _y) constructor {
}
static update = function() {
outputs[| 0].setValue(inputs[| 0].getValue());
var jun = outputs[| 0];
for(var j = 0; j < ds_list_size(jun.value_to); j++) {
if(jun.value_to[| j].value_from == jun) {

View file

@ -44,6 +44,9 @@ function Node_Mesh_Warp(_x, _y) : Node(_x, _y) constructor {
for(var i = 0; i < ds_list_size(data.tris); i++) {
data.tris[| i].drawPoints(_x, _y, _s);
}
for(var i = 0; i < ds_list_size(data.links); i++) {
data.links[| i].draw(_x, _y, _s);
}
var hover = -1;
for(var i = control_index; i < ds_list_size(inputs); i++) {
@ -121,6 +124,11 @@ function Node_Mesh_Warp(_x, _y) : Node(_x, _y) constructor {
p1.x -= dx / 2;
p1.y -= dy / 2;
}
static draw = function(_x, _y, _s) {
draw_set_color(c_red);
draw_line(_x + p0.x * _s, _y + p0.y * _s, _x + p1.x * _s, _y + p1.y * _s);
}
}
function triangle(_p0, _p1, _p2) constructor {

View file

@ -30,6 +30,7 @@ function Panel_Animation(_panel) : PanelContent(_panel) constructor {
timeline_scubbing = false;
timeline_scub_st = 0;
timeline_scale = 20;
_scrub_frame = -1;
timeline_shift = 0;
timeline_dragging = false;
@ -798,10 +799,13 @@ function Panel_Animation(_panel) : PanelContent(_panel) constructor {
ANIMATOR.real_frame = clamp((mx - bar_x) / timeline_scale + timeline_shift, 0, ANIMATOR.frames_total);
timeline_show_time = ANIMATOR.current_frame;
if(mouse_check_button_released(mb_left)) {
timeline_scubbing = false;
ANIMATOR.is_scrubing = false;
if(timeline_show_time != _scrub_frame) {
_scrub_frame = timeline_show_time;
ANIMATOR.is_scrubing = true;
}
if(mouse_check_button_released(mb_left))
timeline_scubbing = false;
}
if(timeline_dragging) {
timeline_shift = clamp(timeline_drag_sx + mx - timeline_drag_mx, -max(bar_total_w - bar_w, 0), 0);
@ -834,7 +838,7 @@ function Panel_Animation(_panel) : PanelContent(_panel) constructor {
if(key_holding == noone) {
timeline_scubbing = true;
timeline_scub_st = ANIMATOR.current_frame;
ANIMATOR.is_scrubing = true;
_scrub_frame = timeline_scub_st;
}
}
}

View file

@ -3,13 +3,12 @@
SAMPLE_PROJECTS = ds_list_create();
#endregion
function LOAD_SAMPLE() {
ds_list_clear(SAMPLE_PROJECTS);
var _l = get_program_directory() + "Sample Projects";
var file = file_find_first(_l + "/*", fa_directory);
function LOAD_FOLDER(list, folder) {
var path = get_program_directory() + folder;
var file = file_find_first(path + "/*", fa_directory);
while(file != "") {
if(filename_ext(file) == ".json" || filename_ext(file) == ".pxc") {
var full_path = _l + "\\" + file;
var full_path = path + "\\" + file;
var f = new FileObject(string_replace(filename_name(file), filename_ext(file), ""), full_path);
var icon_path = string_replace(full_path, filename_ext(full_path), ".png");
@ -18,9 +17,18 @@ function LOAD_SAMPLE() {
sprite_set_offset(f.spr, sprite_get_width(f.spr) / 2, sprite_get_height(f.spr) / 2);
}
ds_list_add(SAMPLE_PROJECTS, f);
f.tag = folder;
ds_list_add(list, f);
}
file = file_find_next();
}
file_find_close();
}
function LOAD_SAMPLE() {
ds_list_clear(SAMPLE_PROJECTS);
LOAD_FOLDER(SAMPLE_PROJECTS, "Getting started");
LOAD_FOLDER(SAMPLE_PROJECTS, "Sample Projects");
}

View file

@ -15,6 +15,8 @@ function textArea(_input, _onModify) constructor {
_prev_text = "";
_last_value = "";
_prev_width = 0;
cursor = 0;
cursor_pos_x = 0;
@ -33,7 +35,7 @@ function textArea(_input, _onModify) constructor {
static move_cursor = function(delta) {
var ll = string_length(_input_text);
cursor = clamp(cursor + delta, 0, ll + 1);
cursor = clamp(cursor + delta, 0, ll);
}
static cut_line = function() {
@ -60,12 +62,15 @@ function textArea(_input, _onModify) constructor {
ss += _ps;
}
}
if(ss != "")
array_push(_input_text_line, ss);
}
static editText = function() {
#region text editor
if(keyboard_check_released(ord("V")) && keyboard_check(vk_control)) {
_input_text = clipboard_get_text();
keyboard_string = clipboard_get_text();
cut_line();
}
@ -74,7 +79,8 @@ function textArea(_input, _onModify) constructor {
cursor_select = 0;
cursor = string_length(_input_text);
}
} else {
}
if(keyboard_check_pressed(vk_escape) || keyboard_check_pressed(vk_enter)) {
} else if(keyboard_check_pressed(vk_backspace)) {
if(cursor_select == -1) {
@ -140,7 +146,6 @@ function textArea(_input, _onModify) constructor {
cursor_select = -1;
}
}
keyboard_string = "";
keyboard_lastkey = -1;
@ -161,6 +166,11 @@ function textArea(_input, _onModify) constructor {
}
static display_text = function(_x, _y, _text, _w, _mx = -1, _my = -1) {
if(_w != _prev_width) {
_prev_width = _w;
cut_line();
}
var _xx = _x, _ch, _chw;
var target = -999;
@ -207,6 +217,8 @@ function textArea(_input, _onModify) constructor {
ch_x += _ch_w;
ch_cxo = ch_cxn;
}
if(target == -999)
target = string_length(_prev_text);
break;
}
char_run += _l;
@ -247,6 +259,13 @@ function textArea(_input, _onModify) constructor {
cursor_select = -1;
move_cursor(-1);
if(keyboard_check(vk_control)) {
while(cursor > 0) {
var ch = string_char_at(_prev_text, cursor);
if(ch == " ") break
cursor--;
}
}
}
if(keyboard_check_pressed(vk_right)) {
if(keyboard_check(vk_shift)) {
@ -256,37 +275,54 @@ function textArea(_input, _onModify) constructor {
cursor_select = -1;
move_cursor(1);
if(keyboard_check(vk_control)) {
while(cursor < string_length(_prev_text)) {
var ch = string_char_at(_prev_text, cursor);
if(ch == " ") break
cursor++;
}
}
}
if(keyboard_check_pressed(vk_up)) {
var _target;
if(cursor_line == 0)
cursor = 0;
_target = 0;
else {
var _l = cursor_line - 1;
var _str = _input_text_line[_l];
var _run = tx;
var _char = 0;
for( var i = 0; i < _l - 1; i++ ) {
for( var i = 0; i < _l; i++ ) {
_char += string_length(_input_text_line[i]);
}
for( var i = 0; i < string_length(_str); i++ ) {
var _chr = string_char_at(_str, i + 1);
for( var i = 1; i <= string_length(_str); i++ ) {
var _chr = string_char_at(_str, i);
_run += string_width(_chr);
if(_run > cursor_pos_x_to) {
_char += i;
break;
}
if(_run > cursor_pos_x_to) break;
_char++;
}
cursor = _char;
_target = _char;
}
if(keyboard_check(vk_shift)) {
if(cursor_select == -1)
cursor_select = cursor;
} else
cursor_select = -1;
cursor = _target;
}
if(keyboard_check_pressed(vk_down)) {
var _target;
if(cursor_line == array_length(_input_text_line) - 1)
cursor = string_length(_prev_text);
_target = string_length(_prev_text);
else {
var _l = cursor_line + 1;
var _str = _input_text_line[_l];
@ -297,17 +333,23 @@ function textArea(_input, _onModify) constructor {
_char += string_length(_input_text_line[i]);
}
for( var i = 0; i < string_length(_str); i++ ) {
var _chr = string_char_at(_str, i + 1);
for( var i = 1; i <= string_length(_str); i++ ) {
var _chr = string_char_at(_str, i);
_run += string_width(_chr);
if(_run > cursor_pos_x_to) {
_char += i;
break;
}
if(_run > cursor_pos_x_to) break;
_char++;
}
cursor = _char;
_target = _char;
}
if(keyboard_check(vk_shift)) {
if(cursor_select == -1)
cursor_select = cursor;
} else
cursor_select = -1;
cursor = _target;
}
#endregion
@ -331,21 +373,21 @@ function textArea(_input, _onModify) constructor {
_l = string_length(_str);
if(cursor_select != -1) {
draw_set_color(c_ui_blue_grey);
draw_set_color(c_ui_blue_dkgrey);
if(char_run <= ch_sel_min && char_run + _l > ch_sel_min) {
var x1 = tx + string_width(string_copy(_str, 1, ch_sel_min - char_run));
var x2 = tx + string_width(string_copy(_str, 1, ch_sel_max - char_run));
draw_rectangle(x1, ch_y, x2, ch_y + c_h, 0);
draw_roundrect_ext(x1, ch_y, x2, ch_y + c_h, 8, 8, 0);
} else if(char_run >= ch_sel_min && char_run + _l < ch_sel_max) {
var x2 = tx + string_width(_str);
draw_rectangle(tx, ch_y, x2, ch_y + c_h, 0);
} else if(char_run > ch_sel_min && char_run <= ch_sel_max && char_run + _l > ch_sel_max) {
draw_roundrect_ext(tx, ch_y, x2, ch_y + c_h, 8, 8, 0);
} else if(char_run > ch_sel_min && char_run <= ch_sel_max && char_run + _l >= ch_sel_max) {
var x2 = tx + string_width(string_copy(_str, 1, ch_sel_max - char_run));
draw_rectangle(tx, ch_y, x2, ch_y + c_h, 0);
draw_roundrect_ext(tx, ch_y, x2, ch_y + c_h, 8, 8, 0);
}
}

View file

@ -347,10 +347,10 @@ function textBox(_input, _onModify) constructor {
cursor_pos = cursor_pos == 0? cursor_pos_to : lerp_float(cursor_pos, cursor_pos_to, 3);
if(cursor_select > -1) {
draw_set_color(c_ui_blue_grey);
draw_set_color(c_ui_blue_dkgrey);
var x1 = tx + string_width(string_copy(_input_text, 1, cursor_select));
draw_rectangle(cursor_pos, c_y0, x1, c_y1, 0);
draw_roundrect_ext(cursor_pos, c_y0, x1, c_y1, 8, 8, 0);
}
var _mx = -1;

View file

@ -44,7 +44,7 @@
{"id":"f2610417-a463-4805-8dae-e4d61f67e62f","Key":0.0,"Length":1.0,"Stretch":false,"Disabled":false,"IsCreationKey":false,"Channels":{"0":{"Id":{"name":"7eb9e04b-43ee-4426-ae7e-e3f372b5434d","path":"sprites/s_animation_setting/s_animation_setting.yy",},"resourceVersion":"1.0","resourceType":"SpriteFrameKeyframe",},},"resourceVersion":"1.0","resourceType":"Keyframe<SpriteFrameKeyframe>",},
],"resourceVersion":"1.0","resourceType":"KeyframeStore<SpriteFrameKeyframe>",},"trackColour":0,"inheritsTrackColour":true,"builtinName":0,"traits":0,"interpolation":1,"tracks":[],"events":[],"isCreationTrack":false,"resourceVersion":"1.0","tags":[],"resourceType":"GMSpriteFramesTrack","modifiers":[],},
],
"visibleRange": {"x":0.0,"y":0.0,},
"visibleRange": null,
"lockOrigin": false,
"showBackdrop": true,
"showBackdropImage": false,

View file

@ -44,7 +44,7 @@
{"id":"55cb8a81-be84-42a4-98ba-462d8e9d4329","Key":0.0,"Length":1.0,"Stretch":false,"Disabled":false,"IsCreationKey":false,"Channels":{"0":{"Id":{"name":"153fea53-f7c3-4be3-a874-0530070d7f8c","path":"sprites/s_node_2d_light/s_node_2d_light.yy",},"resourceVersion":"1.0","resourceType":"SpriteFrameKeyframe",},},"resourceVersion":"1.0","resourceType":"Keyframe<SpriteFrameKeyframe>",},
],"resourceVersion":"1.0","resourceType":"KeyframeStore<SpriteFrameKeyframe>",},"trackColour":0,"inheritsTrackColour":true,"builtinName":0,"traits":0,"interpolation":1,"tracks":[],"events":[],"isCreationTrack":false,"resourceVersion":"1.0","tags":[],"resourceType":"GMSpriteFramesTrack","modifiers":[],},
],
"visibleRange": {"x":0.0,"y":0.0,},
"visibleRange": null,
"lockOrigin": false,
"showBackdrop": true,
"showBackdropImage": false,