Dynamic surface framework

This commit is contained in:
Tanasart 2023-09-08 21:09:09 +02:00
parent f2067f1eaf
commit 20527a2a63
29 changed files with 215 additions and 80 deletions

View file

@ -198,6 +198,7 @@
{"name":"biterator","order":2,"path":"folders/VCT/biterator.yy",},
{"name":"widget","order":3,"path":"folders/VCT/widget.yy",},
{"name":"widgets","order":5,"path":"folders/widgets.yy",},
{"name":"dynamic surface","order":10,"path":"folders/functions/surface/dynamic surface.yy",},
],
"ResourceOrderSettings": [
{"name":"s_node_corner","order":16,"path":"sprites/s_node_corner/s_node_corner.yy",},
@ -215,6 +216,7 @@
{"name":"__node_3d","order":8,"path":"scripts/__node_3d/__node_3d.yy",},
{"name":"node_csv_file_write","order":13,"path":"scripts/node_csv_file_write/node_csv_file_write.yy",},
{"name":"surface_functions","order":5,"path":"scripts/surface_functions/surface_functions.yy",},
{"name":"dynaSurf_iso","order":1,"path":"scripts/dynaSurf_iso/dynaSurf_iso.yy",},
{"name":"sh_fd_add_velocity_glsl","order":1,"path":"shaders/sh_fd_add_velocity_glsl/sh_fd_add_velocity_glsl.yy",},
{"name":"s_node_normal","order":30,"path":"sprites/s_node_normal/s_node_normal.yy",},
{"name":"node_pixel_sort","order":12,"path":"scripts/node_pixel_sort/node_pixel_sort.yy",},

View file

@ -235,6 +235,7 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"biterator","folderPath":"folders/VCT/biterator.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widget","folderPath":"folders/VCT/widget.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"widgets","folderPath":"folders/widgets.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"dynamic surface","folderPath":"folders/functions/surface/dynamic surface.yy",},
],
"IncludedFiles": [
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"ApolloHelp.html","ConfigValues":{"Itch":{"CopyToMask":"0",},},"CopyToMask":-1,"filePath":"datafiles",},
@ -675,18 +676,6 @@
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"gifski.h","CopyToMask":-1,"filePath":"datafiles/gifski/win/developer",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"gifski.exe","CopyToMask":-1,"filePath":"datafiles/gifski/win",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"GMD3D11.dll","CopyToMask":-1,"filePath":"datafiles",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"D3D11ShaderParser.exe","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"D3D12ShaderParser.exe","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"d3dcompiler_46.dll","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"FShaderCommon.shader","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"HLSL11_PShaderCommon.shader","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"HLSL11_VShaderCommon.shader","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"HLSL9_PShaderCommon.shader","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"HLSL9_VShaderCommon.shader","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"HLSLCompiler.exe","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"libEGL.dll","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"libGLESv2.dll","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"VShaderCommon.shader","CopyToMask":-1,"filePath":"datafiles/HLSL",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"convert.exe","CopyToMask":-1,"filePath":"datafiles/ImageMagick",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"LICENSE.txt","CopyToMask":-1,"filePath":"datafiles/ImageMagick",},
{"resourceType":"GMIncludedFile","resourceVersion":"1.0","name":"magick.exe","CopyToMask":-1,"filePath":"datafiles/ImageMagick",},
@ -747,6 +736,7 @@
{"id":{"name":"__node_3d","path":"scripts/__node_3d/__node_3d.yy",},},
{"id":{"name":"node_csv_file_write","path":"scripts/node_csv_file_write/node_csv_file_write.yy",},},
{"id":{"name":"surface_functions","path":"scripts/surface_functions/surface_functions.yy",},},
{"id":{"name":"dynaSurf_iso","path":"scripts/dynaSurf_iso/dynaSurf_iso.yy",},},
{"id":{"name":"sh_fd_add_velocity_glsl","path":"shaders/sh_fd_add_velocity_glsl/sh_fd_add_velocity_glsl.yy",},},
{"id":{"name":"s_node_normal","path":"sprites/s_node_normal/s_node_normal.yy",},},
{"id":{"name":"node_pixel_sort","path":"scripts/node_pixel_sort/node_pixel_sort.yy",},},
@ -1583,6 +1573,7 @@
{"id":{"name":"s_node_rigid_override","path":"sprites/s_node_rigid_override/s_node_rigid_override.yy",},},
{"id":{"name":"s_node_array_get","path":"sprites/s_node_array_get/s_node_array_get.yy",},},
{"id":{"name":"d3d_bbox","path":"scripts/d3d_bbox/d3d_bbox.yy",},},
{"id":{"name":"dynaSurf","path":"scripts/dynaSurf/dynaSurf.yy",},},
{"id":{"name":"o_dialog_save","path":"objects/o_dialog_save/o_dialog_save.yy",},},
{"id":{"name":"s_node_BW","path":"sprites/s_node_BW/s_node_BW.yy",},},
{"id":{"name":"s_node_strandSim_collide","path":"sprites/s_node_strandSim_collide/s_node_strandSim_collide.yy",},},

View file

@ -143,7 +143,7 @@ function __Node_3D_Extrude(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
surface_set_shader(ts, sh_3d_extrude_filler);
DRAW_CLEAR
shader_set_f("dimension", ww, hh);
draw_surface(_ins, 0, 0);
draw_surface_safe(_ins, 0, 0);
surface_reset_shader();
_ins = ts;
@ -152,7 +152,7 @@ function __Node_3D_Extrude(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
surface_set_shader(ds, sh_3d_extrude_filler_depth);
DRAW_CLEAR
shader_set_f("dimension", ww, hh);
draw_surface(_hei, 0, 0);
draw_surface_safe(_hei, 0, 0);
surface_reset_shader();
_hei = ds;
}
@ -485,7 +485,7 @@ function __Node_3D_Extrude(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
var ts = surface_create(ww, hh);
surface_set_shader(ts, sh_3d_extrude_corner);
shader_set_f("dimension", ww, hh);
draw_surface(_ins, 0, 0);
draw_surface_safe(_ins, 0, 0);
surface_reset_shader();
textures[_array_index] = ts;
} else

View file

@ -0,0 +1,26 @@
function dynaSurf() constructor {
surfaces = [];
static getWidth = function() { return 1; }
static getHeight = function() { return 1; }
static draw = function(_x = 0, _y = 0, _sx = 1, _sy = 1, _ang = 0, _col = c_white, _alp = 1) {}
static drawStretch = function(_x = 0, _y = 0, _w = 1, _h = 1, _ang = 0, _col = c_white, _alp = 1) {
var _sx = _w / getWidth();
var _sy = _h / getHeight();
draw(_x, _y, _sx, _sy, _ang, _col, _alp);
}
static drawTile = function(_x = 0, _y = 0, _xs = 1, _ys = 1, _col = c_white, _alp = 1) {}
static drawPart = function(_l, _t, _w, _h, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alp = 1) {}
static onFree = function() {}
static free = function() {
for( var i = 0, n = array_length(surfaces); i < n; i++ )
surface_free_safe(surfaces[i]);
onFree();
}
static clone = function() {}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "dynaSurf",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "dynamic surface",
"path": "folders/functions/surface/dynamic surface.yy",
},
}

View file

@ -0,0 +1,35 @@
function dynaSurf_iso_4() : dynaSurf() constructor {
surfaces = array_create(4, noone);
static getSurface = function(_rot) {
var ind = 0;
if(abs(angle_difference( 0, _rot)) <= 45) ind = 0;
else if(abs(angle_difference( 90, _rot)) <= 45) ind = 1;
else if(abs(angle_difference(180, _rot)) <= 45) ind = 2;
else if(abs(angle_difference(270, _rot)) <= 45) ind = 3;
return surfaces[ind];
}
static draw = function(_x = 0, _y = 0, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alp = 1) {
var _surf = getSurface(_rot);
draw_surface_ext_safe(_surf, _x, _y, _xs, _ys, 0, _col, _alp);
}
static drawTile = function(_x = 0, _y = 0, _xs = 1, _ys = 1, _col = c_white, _alp = 1) {
var _surf = surfaces[0];
draw_surface_tiled_ext_safe(_surf, _x, _y, _xs, _ys, _col, _alp);
}
static drawPart = function(_l, _t, _w, _h, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alp = 1) {
var _surf = getSurface(_rot);
draw_surface_part_ext_safe(_surf, _l, _t, _w, _h, _x, _y, _xs, _ys, 0, _col, _alp);
}
static clone = function() {
var _new = new dynaSurf_iso_4();
_new.surfaces = surfaces;
return _new;
}
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "dynaSurf_iso",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "dynamic surface",
"path": "folders/functions/surface/dynamic surface.yy",
},
}

View file

@ -303,10 +303,10 @@ function Node_3D_Camera(_x, _y, _group = noone) : Node_3D_Object(_x, _y, _group)
BLEND_ALPHA
if(_dbg) {
draw_surface(_bgSurf, 0, 0);
draw_surface_safe(_bgSurf, 0, 0);
surface_free(_bgSurf);
}
draw_surface(_render, 0, 0);
draw_surface_safe(_render, 0, 0);
BLEND_MULTIPLY
draw_surface_safe(deferData.ssao);

View file

@ -41,11 +41,11 @@ function Node_Blinker(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
//temp_surface[0] = surface_verify(temp_surface[0], surface_get_width(_outSurf), surface_get_height(_outSurf));
//surface_set_shader(temp_surface[0], sh_blink_extract);
// draw_surface(_surf);
// draw_surface_safe(_surf);
//surface_reset_shader();
//surface_set_shader(_outSurf, sh_blink_replace);
// draw_surface(temp_surface[0]);
// draw_surface_safe(temp_surface[0]);
//surface_reset_shader();
//return _outSurf;

View file

@ -442,7 +442,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
surface_set_target(canvas_surface);
BLEND_ALPHA
draw_surface(selection_surface, pos_x, pos_y);
draw_surface_safe(selection_surface, pos_x, pos_y);
BLEND_NORMAL
surface_reset_target();
@ -488,7 +488,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
surface_set_target(canvas_surface);
BLEND_ALPHA
draw_surface(selection_surface, pos_x, pos_y);
draw_surface_safe(selection_surface, pos_x, pos_y);
BLEND_NORMAL
surface_reset_target();
@ -529,17 +529,17 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
surface_set_target(selection_surface);
DRAW_CLEAR
draw_surface(canvas_surface, -sel_x0, -sel_y0);
draw_surface_safe(canvas_surface, -sel_x0, -sel_y0);
BLEND_MULTIPLY
draw_surface(selection_mask, 0, 0);
draw_surface_safe(selection_mask, 0, 0);
BLEND_NORMAL
surface_reset_target();
storeAction();
surface_set_target(canvas_surface);
gpu_set_blendmode(bm_subtract);
draw_surface(selection_surface, sel_x0, sel_y0);
draw_surface_safe(selection_surface, sel_x0, sel_y0);
gpu_set_blendmode(bm_normal);
surface_reset_target();
@ -691,7 +691,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
draw_set_color(_col);
if(isUsingTool("Selection")) {
if(is_selected)
draw_surface(selection_surface, selection_position[0], selection_position[1]);
draw_surface_safe(selection_surface, selection_position[0], selection_position[1]);
else if(is_selecting) {
var sel_x0 = min(selection_sx, mouse_cur_x);
var sel_y0 = min(selection_sy, mouse_cur_y);
@ -729,7 +729,7 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
draw_set_color(c_white);
draw_rectangle_dashed(pos_x, pos_y, pos_x + sel_w, pos_y + sel_h, true, 4);
draw_surface_ext(selection_surface, pos_x, pos_y, _s, _s, 0, c_white, 1);
draw_surface_ext_safe(selection_surface, pos_x, pos_y, _s, _s, 0, c_white, 1);
}
} else {
gpu_set_colorwriteenable(tool_attribute.channel[0], tool_attribute.channel[1], tool_attribute.channel[2], tool_attribute.channel[3]);
@ -739,12 +739,12 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
surface_set_target(_preview_draw_surface);
DRAW_CLEAR
draw_surface_ext(preview_draw_surface, _x, _y, _s, _s, 0, c_white, 1);
draw_surface_ext_safe(preview_draw_surface, _x, _y, _s, _s, 0, c_white, 1);
surface_reset_target();
shader_set(sh_brush_outline);
shader_set_f("dimension", surface_get_width(_preview_draw_surface), surface_get_height(_preview_draw_surface));
draw_surface_ext(_preview_draw_surface, 0, 0, 1, 1, 0, c_white, 1);
draw_surface_ext_safe(_preview_draw_surface, 0, 0, 1, 1, 0, c_white, 1);
shader_reset();
}
#endregion

View file

@ -76,7 +76,7 @@ function Node_Crop_Content(_x, _y, _group = noone) : Node(_x, _y, _group) constr
surface_set_target(temp_surface[0]);
DRAW_CLEAR
BLEND_OVERRIDE;
draw_surface(s, 0, 0);
draw_surface_safe(s, 0, 0);
BLEND_NORMAL;
surface_reset_target();

View file

@ -320,7 +320,7 @@ function Node_Image_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group) constru
surface_set_target(_s);
draw_clear_alpha(c_black, 0);
BLEND_OVERRIDE;
draw_surface_part(_inSurf, _spr_pos[0], _spr_pos[1], _dim[0], _dim[1], _pad[2], _pad[1]);
draw_surface_part_ext_safe(_inSurf, _spr_pos[0], _spr_pos[1], _dim[0], _dim[1], _pad[2], _pad[1]);
BLEND_NORMAL;
surface_reset_target();

View file

@ -110,7 +110,7 @@ function Node_Pack_Sprites(_x, _y, _group = noone) : Node(_x, _y, _group) constr
var r = rect[i];
array_push(atlas, new SurfaceAtlas(r.surface, [ r.x + _spac, r.y + _spac ]));
draw_surface(r.surface, r.x + _spac, r.y + _spac);
draw_surface_safe(r.surface, r.x + _spac, r.y + _spac);
}
BLEND_NORMAL

View file

@ -42,7 +42,7 @@ function Node_Palette_Shift(_x, _y, _group = noone) : Node_Processor(_x, _y, _gr
shader_set_f("paletteAmount", array_length(_pal));
shader_set_f("shift", _shf);
draw_surface(_data[0], 0, 0);
draw_surface_safe(_data[0], 0, 0);
surface_reset_shader();
_outSurf = mask_apply(_data[0], _outSurf, _data[3], _data[4]);

View file

@ -87,7 +87,7 @@ function Node_PB_Box_Inset(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
shader_set_dim(, _pbox.mask);
shader_set_f("inset", _inst);
draw_surface(_pbox.mask, -_inst[2], -_inst[1]);
draw_surface_safe(_pbox.mask, -_inst[2], -_inst[1]);
surface_reset_shader();
} else if(_type == 1)
_nbox.mask = surface_stretch(_pbox.mask, _nbox.w, _nbox.h);
@ -100,7 +100,7 @@ function Node_PB_Box_Inset(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
shader_set_dim(, _pbox.content);
shader_set_f("inset", _inst);
draw_surface(_pbox.content, -_inst[2], -_inst[1]);
draw_surface_safe(_pbox.content, -_inst[2], -_inst[1]);
surface_reset_shader();
} else if(_type == 1)
_nbox.content = surface_stretch(_pbox.content, _nbox.w, _nbox.h);
@ -117,7 +117,7 @@ function Node_PB_Box_Inset(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
surface_set_target(_nbox.mask);
if(is_surface(_pbox.mask)) {
draw_clear_alpha(0, 0);
draw_surface(_pbox.mask, 0, 0);
draw_surface_safe(_pbox.mask, 0, 0);
} else
draw_clear(c_white);
@ -126,7 +126,7 @@ function Node_PB_Box_Inset(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
BLEND_SUBTRACT
if(is_surface(_msk.mask))
draw_surface(_msk.mask, _x, _y);
draw_surface_safe(_msk.mask, _x, _y);
else {
draw_set_color(c_white);
draw_rectangle(_x, _y, _x + _w - 1, _y + _h - 1, false);

View file

@ -76,7 +76,7 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
_nbox.mask = surface_verify(_nbox.mask, _nbox.w, _nbox.h);
surface_set_target(_nbox.mask);
DRAW_CLEAR
draw_surface(_pbox.mask, 0, 0);
draw_surface_safe(_pbox.mask, 0, 0);
surface_reset_target();
}
@ -84,7 +84,7 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
_nbox.content = surface_verify(_nbox.content, _nbox.w, _nbox.h);
surface_set_target(_nbox.content);
DRAW_CLEAR
draw_surface(_pbox.content, 0, 0);
draw_surface_safe(_pbox.content, 0, 0);
surface_reset_target();
}
} else if(_output_index == 1) {
@ -101,9 +101,9 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
surface_set_target(_nbox.mask);
DRAW_CLEAR
if(_mirr)
draw_surface_ext(_pbox.mask, _nbox.w + shf, 0, -1, 1, 0, c_white, 1);
draw_surface_ext_safe(_pbox.mask, _nbox.w + shf, 0, -1, 1, 0, c_white, 1);
else
draw_surface(_pbox.mask, -shf, 0);
draw_surface_safe(_pbox.mask, -shf, 0);
surface_reset_target();
}
@ -112,9 +112,9 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
surface_set_target(_nbox.content);
DRAW_CLEAR
if(_mirr)
draw_surface_ext(_pbox.content, _nbox.w + shf, 0, -1, 1, 0, c_white, 1);
draw_surface_ext_safe(_pbox.content, _nbox.w + shf, 0, -1, 1, 0, c_white, 1);
else
draw_surface(_pbox.content, -shf, 0);
draw_surface_safe(_pbox.content, -shf, 0);
surface_reset_target();
}
}
@ -139,7 +139,7 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
_nbox.mask = surface_verify(_nbox.mask, _nbox.w, _nbox.h);
surface_set_target(_nbox.mask);
DRAW_CLEAR
draw_surface(_pbox.mask, 0, 0);
draw_surface_safe(_pbox.mask, 0, 0);
surface_reset_target();
}
@ -147,7 +147,7 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
_nbox.content = surface_verify(_nbox.content, _nbox.w, _nbox.h);
surface_set_target(_nbox.content);
DRAW_CLEAR
draw_surface(_pbox.content, 0, 0);
draw_surface_safe(_pbox.content, 0, 0);
surface_reset_target();
}
} else if(_output_index == 1) {
@ -164,9 +164,9 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
surface_set_target(_nbox.mask);
DRAW_CLEAR
if(_mirr)
draw_surface_ext(_pbox.mask, 0, _nbox.h + shf, 1, -1, 0, c_white, 1);
draw_surface_ext_safe(_pbox.mask, 0, _nbox.h + shf, 1, -1, 0, c_white, 1);
else
draw_surface(_pbox.mask, -shf, 0);
draw_surface_safe(_pbox.mask, -shf, 0);
surface_reset_target();
}
@ -175,9 +175,9 @@ function Node_PB_Box_Split(_x, _y, _group = noone) : Node_PB_Box(_x, _y, _group)
surface_set_target(_nbox.content);
DRAW_CLEAR
if(_mirr)
draw_surface_ext(_pbox.content, 0, _nbox.h + shf, 1, -1, 0, c_white, 1);
draw_surface_ext_safe(_pbox.content, 0, _nbox.h + shf, 1, -1, 0, c_white, 1);
else
draw_surface(_pbox.content, -shf, 0);
draw_surface_safe(_pbox.content, -shf, 0);
surface_reset_target();
}
}

View file

@ -20,12 +20,12 @@ function Node_PB_Draw(_x, _y, _group = noone) : Node_PB(_x, _y, _group) construc
#macro PB_DRAW_CREATE_MASK _nbox.mask = surface_verify(_nbox.mask, _nbox.w, _nbox.h); \
surface_set_shader(_nbox.mask, sh_pb_to_mask); \
draw_surface(_nbox.content, -_pbox.x, -_pbox.y); \
draw_surface_safe(_nbox.content, -_pbox.x, -_pbox.y); \
surface_reset_shader();
#macro PB_DRAW_APPLY_MASK if(_mask) { \
BLEND_MULTIPLY \
if(is_surface(_pbox.mask)) \
draw_surface(_pbox.mask, 0, 0); \
draw_surface_safe(_pbox.mask, 0, 0); \
BLEND_NORMAL \
}

View file

@ -169,10 +169,10 @@ function Node_PB_Draw_Round_Rectangle(_x, _y, _group = noone) : Node_PB_Draw(_x,
BLEND_SUBTRACT
switch(c) {
case 0 : draw_surface_ext(_sub_surf, _x0, _y0, 1, 1, 0, c_white, 1); break;
case 1 : draw_surface_ext(_sub_surf, _x1 + 1, _y0, 1, 1, -90, c_white, 1); break;
case 2 : draw_surface_ext(_sub_surf, _x0, _y1 + 1, 1, 1, 90, c_white, 1); break;
case 3 : draw_surface_ext(_sub_surf, _x1 + 1, _y1 + 1, 1, 1, 180, c_white, 1); break;
case 0 : draw_surface_ext_safe(_sub_surf, _x0, _y0, 1, 1, 0, c_white, 1); break;
case 1 : draw_surface_ext_safe(_sub_surf, _x1 + 1, _y0, 1, 1, -90, c_white, 1); break;
case 2 : draw_surface_ext_safe(_sub_surf, _x0, _y1 + 1, 1, 1, 90, c_white, 1); break;
case 3 : draw_surface_ext_safe(_sub_surf, _x1 + 1, _y1 + 1, 1, 1, 180, c_white, 1); break;
}
BLEND_NORMAL

View file

@ -22,7 +22,7 @@ function Node_PB_Fx(_x, _y, _group = noone) : Node_PB(_x, _y, _group) constructo
\
_pbox.mask = surface_create(_pbox.w, _pbox.h); \
surface_set_shader(_pbox.mask, sh_pb_to_mask); \
draw_surface(_surf, 0, 0); \
draw_surface_safe(_surf, 0, 0); \
surface_reset_shader(); \
\
return _pbox; \

View file

@ -70,7 +70,7 @@ function Node_Random_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
var _sx = irandom_range(_dim[0] / 2 - _size / 2, _dim[0] / 2 + _size / 2);
var _sy = irandom_range(_dim[1] / 2 - _size / 2, _dim[1] / 2 + _size / 2);
draw_surface(_shape, _sx - _size / 2, _sy - _size / 2);
draw_surface_safe(_shape, _sx - _size / 2, _sy - _size / 2);
surface_free(_shape);
}
surface_reset_target();
@ -79,10 +79,10 @@ function Node_Random_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
surface_set_target(_surf);
DRAW_CLEAR
draw_surface_ext(_shap, 0, 0, 1, 1, 0, c_white, 1);
draw_surface_ext(_shap, _dim[0], 0, -1, 1, 0, c_white, 1);
draw_surface_ext(_shap, 0, _dim[1], 1, -1, 0, c_white, 1);
draw_surface_ext(_shap, _dim[0], _dim[1], -1, -1, 0, c_white, 1);
draw_surface_ext_safe(_shap, 0, 0, 1, 1, 0, c_white, 1);
draw_surface_ext_safe(_shap, _dim[0], 0, -1, 1, 0, c_white, 1);
draw_surface_ext_safe(_shap, 0, _dim[1], 1, -1, 0, c_white, 1);
draw_surface_ext_safe(_shap, _dim[0], _dim[1], -1, -1, 0, c_white, 1);
surface_reset_target();
surface_free(_shap);
@ -116,13 +116,13 @@ function Node_Random_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
if(random(1) < 0.5) {
shader_set(sh_rsh_rotate);
shader_set_f("dimension", _dim[0], _dim[1]);
draw_surface(_surf, 0, 0);
draw_surface_safe(_surf, 0, 0);
shader_reset();
} else
draw_surface(_surf, 0, 0);
draw_surface_safe(_surf, 0, 0);
BLEND_SUBTRACT
draw_surface(_subs, _sx - _size[0] / 2, _sy - _size[1] / 2);
draw_surface_safe(_subs, _sx - _size[0] / 2, _sy - _size[1] / 2);
BLEND_NORMAL
surface_reset_target();
surface_free(_subs);
@ -143,9 +143,9 @@ function Node_Random_Shape(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
shader_set_f("dimension", _dim[0], _dim[1]);
shader_set_i("type", choose(0, 0, 1, 1, 1));
draw_surface(_prog, 0, 0);
if(_side == 1) draw_surface_ext(_prog, 0, _dim[1], 1, -1, 0, c_white, 1);
if(_side == 2) draw_surface_ext(_prog, _dim[0], 0, -1, 1, 0, c_white, 1);
draw_surface_safe(_prog, 0, 0);
if(_side == 1) draw_surface_ext_safe(_prog, 0, _dim[1], 1, -1, 0, c_white, 1);
if(_side == 2) draw_surface_ext_safe(_prog, _dim[0], 0, -1, 1, 0, c_white, 1);
surface_reset_shader();
surface_free(_prog);

View file

@ -45,7 +45,7 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
surface_clear(temp_surface[0]);
surface_set_shader(temp_surface[1], sh_region_fill_init);
draw_surface(_surf, 0, 0);
draw_surface_safe(_surf, 0, 0);
surface_reset_shader();
var base = 0;
@ -54,7 +54,7 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
for( var i = 0; i < amo; i++ ) {
surface_set_shader(temp_surface[base], sh_region_fill_coordinate);
shader_set_f("dimension", _sw, _sh);
draw_surface(temp_surface[!base], 0, 0);
draw_surface_safe(temp_surface[!base], 0, 0);
surface_reset_shader();
@ -71,11 +71,11 @@ function Node_Region_Fill(_x, _y, _group = noone) : Node_Processor(_x, _y, _grou
shader_set_f("seed", _seed);
shader_set_f("colorAmount", array_length(_colr));
draw_surface(temp_surface[base], 0, 0);
draw_surface_safe(temp_surface[base], 0, 0);
surface_reset_shader();
} else {
surface_set_shader(_outSurf);
draw_surface(temp_surface[base], 0, 0);
draw_surface_safe(temp_surface[base], 0, 0);
surface_reset_shader();
}

View file

@ -13,7 +13,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor {
tooltip_spr = sprite_add(pth, 0, false, false, 0, 0);
else
tooltip_spr = noone;
new_node = false;
new_node = false;
if(struct_has(global.NODE_GUIDE, node)) {
var _n = global.NODE_GUIDEarn[$ node];

View file

@ -71,7 +71,7 @@ function Node_Sequence_Anim(_x, _y, _group = noone) : Node(_x, _y, _group) const
}
surface_reset_target();
draw_surface(sequence_surface, x0, y0 + ui(4));
draw_surface_safe(sequence_surface, x0, y0 + ui(4));
draw_sprite_ui(THEME.gear, 0, x1 + ui(16), _y + _h / 2,,,, COLORS._main_icon);

View file

@ -219,7 +219,7 @@ function Node_Warp(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
shader_set_f("p2", tl[0] / sw, tl[1] / sh);
shader_set_f("p3", bl[0] / sw, bl[1] / sh);
draw_surface(_data[0], 0, 0);
draw_surface_safe(_data[0], 0, 0);
surface_reset_shader();
}

View file

@ -218,7 +218,7 @@ function Node_Warp_Perspective(_x, _y, _group = noone) : Node_Processor(_x, _y,
shader_set_f("t3", Ttl[0] / sw, Ttl[1] / sh);
shader_set_f("t4", Tbl[0] / sw, Tbl[1] / sh);
draw_surface(_data[0], 0, 0);
draw_surface_safe(_data[0], 0, 0);
surface_reset_shader();
return _outSurf;

View file

@ -67,7 +67,7 @@ function Panel_Array_Sequence(node) : PanelContent() constructor {
if(mouse_wheel_up()) content_x_to = clamp(content_x_to + (_ns + ui(8)), -content_x_max, 0);
}
draw_surface(content_surface, padding, padding);
draw_surface_safe(content_surface, padding, padding);
var px = padding;
var py = padding + content_h + ui(16);
@ -171,7 +171,7 @@ function Panel_Array_Sequence(node) : PanelContent() constructor {
if(mouse_wheel_up()) sequence_x_to = clamp(sequence_x_to + (_ns + ui(8)), -sequence_x_max, 0);
}
draw_surface(sequence_surface, px, py);
draw_surface_safe(sequence_surface, px, py);
if(len_stretching) {
var frm = round((msx - sequence_x - _ns / 2) / _ns);

View file

@ -2,51 +2,80 @@
function draw_surface_safe(surface, _x = 0, _y = 0) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.draw(_x, _y);
return;
}
if(!is_surface(surface)) return;
__channel_pre(surface);
draw_surface(surface, _x, _y);
__channel_pos(surface);
}
function draw_surface_stretched_safe(surface, _x, _y, _w, _h) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.drawStretch(_x, _y, _w, _h);
return;
}
if(!is_surface(surface)) return;
__channel_pre(surface);
draw_surface_stretched(surface, _x, _y, _w, _h);
__channel_pos(surface);
}
function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.draw(_x, _y, _xs, _ys, _rot, _col, _alpha);
return;
}
if(!is_surface(surface)) return;
__channel_pre(surface);
draw_surface_ext(surface, _x, _y, _xs, _ys, _rot, _col, _alpha);
__channel_pos(surface);
}
function draw_surface_tiled_safe(surface, _x, _y) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.drawTile(_x, _y);
return;
}
if(!is_surface(surface)) return;
__channel_pre(surface);
draw_surface_tiled(surface, _x, _y);
__channel_pos(surface);
}
function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c_white, _alpha = 1) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.drawTile(_x, _y, _xs, _ys, _col, _alpha);
return;
}
if(!is_surface(surface)) return;
__channel_pre(surface);
draw_surface_tiled_ext(surface, _x, _y, _xs, _ys, _col, _alpha);
__channel_pos(surface);
}
function draw_surface_part_ext_safe(surface, _l, _t, _w, _h, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) {
gml_pragma("forceinline");
if(is_struct(surface) && is_instanceof(surface, dynaSurf)) {
surface.drawPart(_l, _t, _w, _h, _x, _y, _xs, _ys, _rot, _col, _alpha);
return;
}
if(!is_surface(surface)) return;
__channel_pre(surface);

View file

@ -382,8 +382,23 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
modified = true;
} else if(KEYBOARD_PRESSED == vk_backspace) {
if(cursor_select == -1) {
var str_before = string_copy(_input_text, 1, cursor - 1);
var str_after = string_copy(_input_text, cursor + 1, string_length(_input_text) - cursor);
var str_before, str_after;
if(key_mod_press(CTRL)) {
var _c = cursor - 1;
while(_c > 0) {
var ch = string_char_at(_input_text, _c);
if(breakCharacter(ch)) break;
_c--;
}
str_before = string_copy(_input_text, 1, _c);
str_after = string_copy(_input_text, cursor + 1, string_length(_input_text) - cursor);
cursor = _c + 1;
} else {
str_before = string_copy(_input_text, 1, cursor - 1);
str_after = string_copy(_input_text, cursor + 1, string_length(_input_text) - cursor);
}
_input_text = str_before + str_after;
cut_line();

View file

@ -144,8 +144,23 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi
if(keyboard_check_pressed(vk_escape) || keyboard_check_pressed(vk_enter)) {
} else if(KEYBOARD_PRESSED == vk_backspace) {
if(cursor_select == -1) {
var str_before = string_copy(_input_text, 1, cursor - 1);
var str_after = string_copy(_input_text, cursor + 1, string_length(_input_text) - cursor);
var str_before, str_after;
if(key_mod_press(CTRL)) {
var _c = cursor - 1;
while(_c > 0) {
var ch = string_char_at(_input_text, _c);
if(breakCharacter(ch)) break;
_c--;
}
str_before = string_copy(_input_text, 1, _c);
str_after = string_copy(_input_text, cursor + 1, string_length(_input_text) - cursor);
cursor = _c + 1;
} else {
str_before = string_copy(_input_text, 1, cursor - 1);
str_after = string_copy(_input_text, cursor + 1, string_length(_input_text) - cursor);
}
_input_text = str_before + str_after;
} else {