Widget sprites

This commit is contained in:
MakhamDev 2022-01-17 08:19:01 +07:00
parent 200ff704c1
commit b93e5d0ad2
19 changed files with 106 additions and 33 deletions

View file

@ -389,6 +389,7 @@
{"id":{"name":"node_animate_curve","path":"scripts/node_animate_curve/node_animate_curve.yy",},"order":0,},
{"id":{"name":"s_node_state","path":"sprites/s_node_state/s_node_state.yy",},"order":7,},
{"id":{"name":"curve_bounce_function","path":"scripts/curve_bounce_function/curve_bounce_function.yy",},"order":1,},
{"id":{"name":"s_anchor_scale_hori","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},"order":9,},
{"id":{"name":"gif_reader","path":"scripts/gif_reader/gif_reader.yy",},"order":4,},
{"id":{"name":"s_loading","path":"sprites/s_loading/s_loading.yy",},"order":37,},
{"id":{"name":"node_group_input","path":"scripts/node_group_input/node_group_input.yy",},"order":1,},

View file

@ -40,7 +40,6 @@ event_inherited();
}
function setColor() {
if(key_selecting == noone) return;
show_debug_message("set")
key_selecting.value = current_color;
}
function setGradient(grad, data) {

View file

@ -41,8 +41,6 @@
if(keyboard_check_direct(vk_shift)) HOTKEY_MOD |= MOD_KEY.shift;
if(keyboard_check_direct(vk_alt)) HOTKEY_MOD |= MOD_KEY.alt;
//show_debug_message(HOTKEY_MOD)
if(ds_map_exists(HOTKEYS, "")) {
var l = HOTKEYS[? ""];
for(var i = 0; i < ds_list_size(l); i++) {

View file

@ -29,5 +29,4 @@ function read_ase(path) {
}
file_bin_close(file);
show_debug_message(load_str);
}

View file

@ -376,7 +376,6 @@ function gif_std_enum_getIndex() {
static reading = function(_gif) {
var _b = self.readBlock();
blocks[@ block_index++] = _b;
show_debug_message("reading block " + string(block_index));
if (_b == format_gif_Block_BEOF)
return true;
return false;

View file

@ -5,7 +5,6 @@ function loadPalette(path) {
var _t = file_text_open_read(path);
var _index = 0;
var ext = filename_ext(path);
show_debug_message(ext)
while(!file_text_eof(_t)) {
var _w = file_text_readln(_t);
if(_w != "") {

View file

@ -23,7 +23,7 @@ function Node_Blur_Radial(_x, _y) : Node_Processor(_x, _y) constructor {
var px = _x + pos[0] * _s;
var py = _y + pos[1] * _s;
inputs[| 1].drawOverlay(_active, px, py, _s, _mx, _my, 0, 64);
inputs[| 1].drawOverlay(_active, px, py, _s, _mx, _my, 0, 64, s_anchor_scale_hori);
inputs[| 2].drawOverlay(_active, _x, _y, _s, _mx, _my);
}

View file

@ -29,7 +29,7 @@ function Node_Dilate(_x, _y) : Node_Processor(_x, _y) constructor {
var py = _y + pos[1] * _s;
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my);
inputs[| 3].drawOverlay(_active, px, py, _s, _mx, _my);
inputs[| 3].drawOverlay(_active, px, py, _s, _mx, _my, 0, 1, s_anchor_scale_hori);
}
function process_data(_outSurf, _data, _output_index) {

View file

@ -56,7 +56,6 @@ function animValue(_val, _node) constructor {
if(_time > _time_last) {
switch(node.on_end) {
case KEYFRAME_END.loop :
show_debug_message(_time - _time_last);
_time = _time_first + safe_mod(_time - _time_last, _time_dura + 1);
break;
case KEYFRAME_END.ping :
@ -206,9 +205,6 @@ function animValue(_val, _node) constructor {
else if(scale && _key[| 0] <= 1)
_time = round(_key[| 0] * ANIMATOR.frames_total);
if(node.display_type == VALUE_DISPLAY.gradient)
show_debug_message(_time);
var ease_in = ds_list_get(_key, 2);
var ease_out = ds_list_get(_key, 3);
var _val;

View file

@ -85,7 +85,6 @@ function Node_Line(_x, _y) : Node(_x, _y) constructor {
outputs[| 0].setValue(_outSurf);
} else
surface_size_to(_outSurf, surface_valid(_dim[0]), surface_valid(_dim[1]));
show_debug_message(surface_valid(_dim[0]))
surface_set_target(_outSurf);
if(_bg) draw_clear_alpha(0, 1);

View file

@ -17,6 +17,10 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
.setDisplay(VALUE_DISPLAY.enum_scroll, [ "Node", "Array" ])
.setVisible(false);
inputs[| 2] = nodeValue(2, "Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0.2)
.setDisplay(VALUE_DISPLAY.slider, [0, 1, 0.01])
.setVisible(false);
static createOutput = function() {
var o = nodeValue(ds_list_size(outputs), "Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, surface_create(1, 1));
ds_list_add(outputs, o);
@ -55,6 +59,7 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
}
shader_set(sh_seperate_shape_index);
shader_set_uniform_f(shader_get_uniform(sh_seperate_shape_index, "tolerance"), inputs[| 2].getValue());
surface_set_target(temp_surf[1]);
draw_surface_safe(_inSurf, 0, 0);
surface_reset_target();
@ -64,7 +69,6 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
shader_set_uniform_f_array(uniform_it_dim, [ ww, hh ]);
shader_reset();
t = get_timer();
var res_index = 0, iteration = ww + hh;
for(var i = 0; i <= iteration; i++) {
var bg = i % 2;
@ -81,9 +85,7 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
res_index = bg;
}
//show_debug_message("iteration time : " + string(get_timer() - t));
t = get_timer();
var _pixel_surface = surface_create(PREF_MAP[? "shape_separation_max"], 1);
surface_set_target(_pixel_surface);
draw_clear_alpha(0, 0);
@ -96,8 +98,6 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
BLEND_NORMAL
surface_reset_target();
//show_debug_message("count time : " + string(get_timer() - t));
var px = surface_getpixel(_pixel_surface, 0, 0);
if(px > 0) {
@ -126,7 +126,6 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
surface_buffer = buffer_create(ww * hh * 4, buffer_fixed, 2);
buffer_get_surface(surface_buffer, temp_surf[res_index], 0);
t = get_timer();
for(var i = 0; i < px; i++) {
if(_out_type == 0) {
if(i >= ds_list_size(outputs)) {
@ -188,7 +187,5 @@ function Node_Seperate_Shape(_x, _y) : Node(_x, _y) constructor {
outputs[| 2].setValue(_boundary);
}
}
//show_debug_message("separate time : " + string(get_timer() - t));
}
}

View file

@ -29,7 +29,7 @@ function Node_Twirl(_x, _y) : Node_Processor(_x, _y) constructor {
var py = _y + pos[1] * _s;
inputs[| 1].drawOverlay(_active, _x, _y, _s, _mx, _my);
inputs[| 3].drawOverlay(_active, px, py, _s, _mx, _my);
inputs[| 3].drawOverlay(_active, px, py, _s, _mx, _my, 0, 1, s_anchor_scale_hori);
}
function process_data(_outSurf, _data, _output_index) {

View file

@ -448,9 +448,9 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
return false;
}
static setValue = function(val = 0, record = true) {
static setValue = function(val = 0, record = true, time = -999) {
var _o = value.getValue();
value.setValue(val, record);
value.setValue(val, record, time);
var _n = value.getValue();
var updated = false;
@ -612,6 +612,8 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
case VALUE_DISPLAY._default : #region
var _angle = argument_count > 6? argument[6] : 0;
var _scale = argument_count > 7? argument[7] : 1;
var spr = argument_count > 8? argument[8] : s_anchor_selector;
var index = 0;
var __ax = lengthdir_x(_val * _scale, _angle);
var __ay = lengthdir_y(_val * _scale, _angle);
@ -619,10 +621,8 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
var _ax = _x + __ax * _s;
var _ay = _y + __ay * _s;
draw_sprite(s_anchor_selector, 0, _ax, _ay);
if(drag_type) {
draw_sprite(s_anchor_selector, 1, _ax, _ay);
index = 1;
var dist = point_distance(_mx, _my, _x, _y) / _s / _scale;
if(keyboard_check(vk_control))
dist = round(dist);
@ -638,8 +638,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
if(point_in_circle(_mx, _my, _ax, _ay, 8)) {
hover = 1;
draw_sprite(s_anchor_selector, 1, _ax, _ay);
index = 1;
if(_active && mouse_check_button_pressed(mb_left)) {
drag_type = 1;
drag_mx = _mx;
@ -648,6 +647,8 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
drag_sy = _ay;
}
}
draw_sprite(spr, index, _ax, _ay);
break;
#endregion
case VALUE_DISPLAY.rotation : #region
@ -655,7 +656,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
var _ax = _x + lengthdir_x(_rad, _val);
var _ay = _y + lengthdir_y(_rad, _val);
draw_sprite(s_anchor_selector, 0, _ax, _ay);
draw_sprite_ext(s_anchor_rotate, 0, _ax, _ay, 1, 1, _val - 90, c_white, 1);
if(drag_type) {
draw_set_color(c_ui_orange);
@ -663,7 +664,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
draw_circle(_x, _y, _rad, true);
draw_set_alpha(1);
draw_sprite(s_anchor_selector, 1, _ax, _ay);
draw_sprite_ext(s_anchor_rotate, 1, _ax, _ay, 1, 1, _val - 90, c_white, 1);
var angle = point_direction(_x, _y, _mx, _my);
if(keyboard_check(vk_control))
angle = round(angle / 15) * 15;
@ -684,7 +685,7 @@ function NodeValue(_index, _name, _node, _connect, _type, _value, _tag = VALUE_T
draw_set_alpha(1);
hover = 1;
draw_sprite(s_anchor_selector, 1, _ax, _ay);
draw_sprite_ext(s_anchor_rotate, 1, _ax, _ay, 1, 1, _val - 90, c_white, 1);
if(_active && mouse_check_button_pressed(mb_left)) {
drag_type = 1;
drag_mx = _mx;

View file

@ -4,10 +4,12 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform float tolerance;
void main() {
vec4 col = texture2D( gm_BaseTexture, v_vTexcoord );
if(length(col.rgb * col.a) > 0.2)
if(length(col.rgb * col.a) > tolerance)
gl_FragColor = vec4(v_vTexcoord.x, v_vTexcoord.y, v_vTexcoord.x, v_vTexcoord.y);
else
gl_FragColor = vec4(0.);

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B

View file

@ -0,0 +1,83 @@
{
"bboxMode": 0,
"collisionKind": 1,
"type": 0,
"origin": 4,
"preMultiplyAlpha": false,
"edgeFiltering": false,
"collisionTolerance": 0,
"swfPrecision": 2.525,
"bbox_left": 0,
"bbox_right": 31,
"bbox_top": 4,
"bbox_bottom": 19,
"HTile": false,
"VTile": false,
"For3D": false,
"width": 32,
"height": 24,
"textureGroupId": {
"name": "Default",
"path": "texturegroups/Default",
},
"swatchColours": null,
"gridX": 0,
"gridY": 0,
"frames": [
{"compositeImage":{"FrameId":{"name":"7bfe8464-c766-4402-b543-bd8564753b28","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},"LayerId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},"images":[
{"FrameId":{"name":"7bfe8464-c766-4402-b543-bd8564753b28","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},"LayerId":{"name":"0aec146d-a22f-4514-9114-25d77cf4af01","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
],"parent":{"name":"s_anchor_scale_hori","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},"resourceVersion":"1.0","name":"7bfe8464-c766-4402-b543-bd8564753b28","tags":[],"resourceType":"GMSpriteFrame",},
{"compositeImage":{"FrameId":{"name":"29bf928c-20f3-42f8-8c58-9b49b787c566","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},"LayerId":null,"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},"images":[
{"FrameId":{"name":"29bf928c-20f3-42f8-8c58-9b49b787c566","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},"LayerId":{"name":"0aec146d-a22f-4514-9114-25d77cf4af01","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},"resourceVersion":"1.0","name":"","tags":[],"resourceType":"GMSpriteBitmap",},
],"parent":{"name":"s_anchor_scale_hori","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},"resourceVersion":"1.0","name":"29bf928c-20f3-42f8-8c58-9b49b787c566","tags":[],"resourceType":"GMSpriteFrame",},
],
"sequence": {
"spriteId": {"name":"s_anchor_scale_hori","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},
"timeUnits": 1,
"playback": 1,
"playbackSpeed": 30.0,
"playbackSpeedType": 0,
"autoRecord": true,
"volume": 1.0,
"length": 2.0,
"events": {"Keyframes":[],"resourceVersion":"1.0","resourceType":"KeyframeStore<MessageEventKeyframe>",},
"moments": {"Keyframes":[],"resourceVersion":"1.0","resourceType":"KeyframeStore<MomentsEventKeyframe>",},
"tracks": [
{"name":"frames","spriteId":null,"keyframes":{"Keyframes":[
{"id":"eb0d0430-459f-4519-bc20-f492a7e8365b","Key":0.0,"Length":1.0,"Stretch":false,"Disabled":false,"IsCreationKey":false,"Channels":{"0":{"Id":{"name":"7bfe8464-c766-4402-b543-bd8564753b28","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},"resourceVersion":"1.0","resourceType":"SpriteFrameKeyframe",},},"resourceVersion":"1.0","resourceType":"Keyframe<SpriteFrameKeyframe>",},
{"id":"6878a748-30cd-42f8-99c2-20b92dd0df32","Key":1.0,"Length":1.0,"Stretch":false,"Disabled":false,"IsCreationKey":false,"Channels":{"0":{"Id":{"name":"29bf928c-20f3-42f8-8c58-9b49b787c566","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.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": null,
"lockOrigin": false,
"showBackdrop": true,
"showBackdropImage": false,
"backdropImagePath": "",
"backdropImageOpacity": 0.5,
"backdropWidth": 1366,
"backdropHeight": 768,
"backdropXOffset": 0.0,
"backdropYOffset": 0.0,
"xorigin": 16,
"yorigin": 12,
"eventToFunction": {},
"eventStubScript": null,
"parent": {"name":"s_anchor_scale_hori","path":"sprites/s_anchor_scale_hori/s_anchor_scale_hori.yy",},
"resourceVersion": "1.3",
"name": "s_anchor_scale_hori",
"tags": [],
"resourceType": "GMSequence",
},
"layers": [
{"visible":true,"isLocked":false,"blendMode":0,"opacity":100.0,"displayName":"default","resourceVersion":"1.0","name":"0aec146d-a22f-4514-9114-25d77cf4af01","tags":[],"resourceType":"GMImageLayer",},
],
"nineSlice": null,
"parent": {
"name": "preview",
"path": "folders/sprites/preview.yy",
},
"resourceVersion": "1.0",
"name": "s_anchor_scale_hori",
"tags": [],
"resourceType": "GMSprite",
}