ui improvements

This commit is contained in:
Tanasart 2024-03-27 17:51:14 +07:00
parent 73c597f205
commit 0a7b9bcee0
80 changed files with 777 additions and 680 deletions

View file

@ -95,6 +95,8 @@
{"name":"window","order":27,"path":"folders/functions/window.yy",},
{"name":"main","order":1,"path":"folders/main.yy",},
{"name":"components","order":2,"path":"folders/main/components.yy",},
{"name":"misc","order":14,"path":"folders/misc.yy",},
{"name":"fx","order":1,"path":"folders/misc/fx.yy",},
{"name":"nodes","order":3,"path":"folders/nodes.yy",},
{"name":"data","order":1,"path":"folders/nodes/data.yy",},
{"name":"3D","order":20,"path":"folders/nodes/data/3D.yy",},
@ -876,6 +878,7 @@
{"name":"s_node_stripe","order":16,"path":"sprites/s_node_stripe/s_node_stripe.yy",},
{"name":"s_node_lua_global","order":19,"path":"sprites/s_node_lua_global/s_node_lua_global.yy",},
{"name":"node_pb_draw_diamond","order":10,"path":"scripts/node_pb_draw_diamond/node_pb_draw_diamond.yy",},
{"name":"fx_controller","order":1,"path":"scripts/fx_controller/fx_controller.yy",},
{"name":"sh_mk_tile55_edge_l","order":6,"path":"shaders/sh_mk_tile55_edge_l/sh_mk_tile55_edge_l.yy",},
{"name":"s_node_3d_point_affector","order":21,"path":"sprites/s_node_3d_point_affector/s_node_3d_point_affector.yy",},
{"name":"polygon_points","order":2,"path":"scripts/polygon_points/polygon_points.yy",},

View file

@ -118,6 +118,8 @@
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"window","folderPath":"folders/functions/window.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"main","folderPath":"folders/main.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"components","folderPath":"folders/main/components.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"misc","folderPath":"folders/misc.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"fx","folderPath":"folders/misc/fx.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"nodes","folderPath":"folders/nodes.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"data","folderPath":"folders/nodes/data.yy",},
{"resourceType":"GMFolder","resourceVersion":"1.0","name":"__base__","folderPath":"folders/nodes/data/__base__.yy",},
@ -1150,6 +1152,7 @@
{"id":{"name":"s_node_stripe","path":"sprites/s_node_stripe/s_node_stripe.yy",},},
{"id":{"name":"s_node_lua_global","path":"sprites/s_node_lua_global/s_node_lua_global.yy",},},
{"id":{"name":"node_pb_draw_diamond","path":"scripts/node_pb_draw_diamond/node_pb_draw_diamond.yy",},},
{"id":{"name":"fx_controller","path":"scripts/fx_controller/fx_controller.yy",},},
{"id":{"name":"sh_mk_tile55_edge_l","path":"shaders/sh_mk_tile55_edge_l/sh_mk_tile55_edge_l.yy",},},
{"id":{"name":"s_node_3d_point_affector","path":"sprites/s_node_3d_point_affector/s_node_3d_point_affector.yy",},},
{"id":{"name":"polygon_points","path":"scripts/polygon_points/polygon_points.yy",},},
@ -2509,6 +2512,7 @@
{"id":{"name":"sh_ui_rotator","path":"shaders/sh_ui_rotator/sh_ui_rotator.yy",},},
{"id":{"name":"steam_ugc_functions","path":"scripts/steam_ugc_functions/steam_ugc_functions.yy",},},
{"id":{"name":"s_node_armature_path","path":"sprites/s_node_armature_path/s_node_armature_path.yy",},},
{"id":{"name":"fx_particle_spawner","path":"objects/fx_particle_spawner/fx_particle_spawner.yy",},},
{"id":{"name":"sh_noise_fold","path":"shaders/sh_noise_fold/sh_noise_fold.yy",},},
{"id":{"name":"s_node_gradient_palette","path":"sprites/s_node_gradient_palette/s_node_gradient_palette.yy",},},
{"id":{"name":"FirebaseREST_asyncCall_Firestore","path":"scripts/FirebaseREST_asyncCall_Firestore/FirebaseREST_asyncCall_Firestore.yy",},},

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -157,13 +157,16 @@
if(!active) return;
if(HOVER != self.id) return;
if(mouse_press(mb_any)) {
if(mouse_press(mb_any) && FOCUS != self.id) {
setFocus(self.id, "Dialog");
with(_p_dialog)
other.depth = min(other.depth, depth - 1);
with(_p_dialog) other.depth = min(other.depth, depth - 1);
}
}
function onFocusBegin() {}
function onFocusEnd() {}
function resetPosition() {
if(!active) return;
if(anchor == ANCHOR.none) {
@ -187,16 +190,15 @@
function checkMouse() {
if(!active) return;
if(!destroy_on_click_out) return;
if(!DIALOG_CLICK) return;
if(mouse_press(mb_any)) {
if(!checkClosable()) return;
if(!isTop()) return;
for( var i = 0, n = array_length(children); i < n; i++ )
if(instance_exists(children[i])) return;
if(checkClosable() && destroy_on_click_out)
if(!point_in(mouse_mx, mouse_my)) {
instance_destroy(self);
onDestroy();

View file

@ -0,0 +1,9 @@
/// @description Insert description here
randomize();
parts = array_create_ext(8, function(i) { return [ x + random_range(-radius, radius), y + random_range(-radius, radius) ]; });
speeds = array_create_ext(8, function(i) { return [ random_range(-8, 8), random_range(-8, 0) ]; });
life = 20;
size = 2;
seed = seed_random();
depth = -19999;

View file

@ -0,0 +1,15 @@
/// @description Insert description here
draw_set_color(COLORS._main_accent);
var r = max(1, life / 20 * size);
random_set_seed(seed);
for( var i = 0, n = array_length(parts); i < n; i++ ) {
draw_circle(parts[i][0], parts[i][1], r, false);
parts[i][0] += speeds[i][0];
parts[i][1] += speeds[i][1];
speeds[i][1] += 1;
}
if(--life <= 0) instance_destroy();

View file

@ -0,0 +1,34 @@
{
"resourceType": "GMObject",
"resourceVersion": "1.0",
"name": "fx_particle_spawner",
"eventList": [
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":64,"eventType":8,"isDnD":false,},
],
"managed": true,
"overriddenProperties": [],
"parent": {
"name": "fx",
"path": "folders/misc/fx.yy",
},
"parentObjectId": null,
"persistent": false,
"physicsAngularDamping": 0.1,
"physicsDensity": 0.5,
"physicsFriction": 0.2,
"physicsGroup": 1,
"physicsKinematic": false,
"physicsLinearDamping": 0.1,
"physicsObject": false,
"physicsRestitution": 0.1,
"physicsSensor": false,
"physicsShape": 1,
"physicsShapePoints": [],
"physicsStartAwake": true,
"properties": [],
"solid": false,
"spriteId": null,
"spriteMaskId": null,
"visible": true,
}

View file

@ -18,7 +18,7 @@ event_inherited();
destroy_on_click_out = true;
sl_position = new slider(0, 100, 0.1, function(val) {
sl_position = slider(0, 100, 0.1, function(val) {
if(!interactable) return;
if(key_selecting == noone) return;
setKeyPosition(key_selecting, val / 100);

View file

@ -17,38 +17,19 @@ event_inherited();
display_list[sep_editing][0] = str;
sep_editing = -1;
refreshDisplay();
node.sortIO();
} );
tb_edit.align = fa_left;
tb_edit.font = f_p2;
node = noone;
node = noone;
display_list = [];
type = 1;
function setNode(node) {
function setNode(node, type) {
self.node = node;
self.display_list = node.input_display_list;
}
function refreshDisplay() {
var sep = [];
var _ord = 0;
for( var i = 0, n = array_length(display_list); i < n; i++ ) {
var ls = display_list[i];
if(is_array(ls)) array_push(sep, [ _ord, ls[0] ]);
else {
var _inp = node.inputs[| ls];
_inp.from.attributes.input_priority = _ord;
_ord++;
}
}
node.attributes.separator = sep;
node.sortIO();
display_list = node.input_display_list;
PROJECT.modified = true;
self.type = type;
self.display_list = type == JUNCTION_CONNECT.input? node.attributes.input_display_list : node.attributes.output_display_list;
}
#endregion
@ -56,86 +37,76 @@ event_inherited();
sc_group = new scrollPane(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding), function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 0);
if(node == noone) return 0;
var _h = 0;
var hg = ui(32);
var hg = ui(28);
var con_w = sc_group.surface_w;
var inpt = 0;
var hovr = 0;
var padd = ui(4);
var _drag = -1;
var _ly = _y;
for( var i = 0, n = array_length(display_list); i < n; i++ ) {
var disp = display_list[i];
if(sHOVER && point_in_rectangle(_m[0], _m[1], 0 + padd, _y + padd, hg - padd, _y + hg - padd)) {
draw_sprite_stretched_ext(THEME.group_label, 0, padd, _y + padd, hg - padd * 2, hg - padd * 2, COLORS._main_icon, 1);
if(mouse_press(mb_left, sFOCUS))
_drag = i;
} else
draw_sprite_stretched_ext(THEME.group_label, 0, padd, _y + padd, hg - padd * 2, hg - padd * 2, COLORS._main_icon_light, 1);
draw_sprite_ui(THEME.hamburger, 0, hg / 2, _y + hg / 2, 0.5, 0.5,, COLORS._main_icon_light);
var _y0 = _y;
var _y1 = _y + hg + padd;
if(dragging != noone && _m[1] > _y + ui(28)) {
hovr = i + 1;
_ly = _y + (is_array(disp)? hg : ui(28)) + ui(4);
}
if(dragging == noone) {
var aa = 0.5;
if(sHOVER && point_in_rectangle(_m[0], _m[1], 0 + padd, _y + padd, hg - padd, _y + hg - padd)) {
aa = 1;
if(mouse_press(mb_left, sFOCUS)) dragging = display_list[i];
}
draw_sprite_ui(THEME.hamburger_s, 0, hg / 2, _y + hg / 2,,,, COLORS._main_icon_light, aa);
}
if((i == n - 1 && _m[1] > _y0) || (_m[1] > _y0 && _m[1] <= _y1) || (i == 0 && _m[1] < _y1))
hovr = i;
if(is_array(disp)) {
var ed_x = hg + ui(4);
if(sHOVER && point_in_rectangle(_m[0], _m[1], ed_x, _y, con_w, _y + hg)) {
draw_sprite_stretched_ext(THEME.group_label, 0, ed_x, _y, con_w - ed_x, hg, COLORS._main_icon, 1);
draw_sprite_stretched_ext(THEME.button, 1, ed_x, _y, con_w - ed_x, hg, COLORS._main_icon_light, 1);
if(mouse_press(mb_left, sFOCUS)) {
if(sep_editing == -1 && mouse_press(mb_left, sFOCUS)) {
sep_editing = i;
tb_edit._current_text = disp[0];
tb_edit.activate();
}
} else
draw_sprite_stretched_ext(THEME.group_label, 0, ed_x, _y, con_w - ed_x, hg, COLORS._main_icon_light, 1);
draw_sprite_stretched_ext(THEME.button, 0, ed_x, _y, con_w - ed_x, hg, COLORS._main_icon_light, 1);
if(sep_editing == i) {
var sep = node.attributes.separator;
WIDGET_CURRENT = tb_edit;
tb_edit.setFocusHover(sFOCUS, sHOVER);
tb_edit.draw(ed_x + ui(4), _y + ui(4), con_w - (ed_x + ui(8)), hg - ui(8), disp[0], mouse_ui);
if(keyboard_check_pressed(vk_enter))
sep_editing = -1;
tb_edit.draw(ed_x, _y, con_w - ed_x, hg, disp[0], _m);
} else {
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
draw_text(ed_x + ui(8), _y + hg / 2 - 1, disp[0]);
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text);
draw_text_add(ed_x + ui(8), _y + hg / 2 - 1, disp[0]);
}
_y += hg + ui(4);
_h += hg + ui(4);
} else {
var ind = node.inputs[| disp];
draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text_sub);
draw_text(hg + ui(8), _y + ui(14), ind.name);
inpt++;
_y += ui(28) + ui(4);
_h += ui(28) + ui(4);
draw_set_text(f_p2, fa_left, fa_center, ind.color_display);
draw_text_add(hg + ui(8), _y + hg / 2 - 1, ind.name);
}
}
if(_drag > -1) {
dragging = display_list[_drag];
array_delete(display_list, _drag, 1);
}
if(dragging != noone && _ly > -1) {
draw_set_color(COLORS._main_icon);
draw_line_round(ui(4), _ly, con_w - ui(4), _ly, 4);
}
if(dragging != noone && mouse_release(mb_left)) {
if(dragging == disp) {
draw_sprite_ui(THEME.hamburger_s, 0, hg / 2, _y + hg / 2,,,, COLORS._main_accent, 1);
draw_sprite_stretched_ext(THEME.button_hide, 3, 0, _y0, con_w, hg, COLORS._main_icon, 1);
}
_y += hg + padd;
_h += hg + padd;
}
if(dragging != noone) {
array_remove(display_list, dragging);
array_insert(display_list, hovr, dragging);
refreshDisplay();
dragging = noone;
if(mouse_release(mb_left)) {
node.sortIO();
dragging = noone;
}
}
return _h;

View file

@ -7,7 +7,7 @@ if !ready exit;
DIALOG_DRAW_FOCUS
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
draw_text(dialog_x + ui(24), dialog_y + ui(20), __txtx("dialog_group_order_title", "Input order"));
draw_text(dialog_x + ui(24), dialog_y + ui(20), __txtx("dialog_group_order_title", "IO order"));
#endregion
#region preset
@ -23,11 +23,11 @@ if !ready exit;
var bx = dialog_x + dialog_w - ui(32 + 16);
var by = dialog_y + ui(16);
var _txt = __txtx("dialog_group_order_add", "Add separator");
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, _txt, THEME.add, 1, COLORS._main_value_positive) == 2) {
var sep = node.attributes.separator;
array_push(sep, [ ds_list_size(node.inputs) - node.custom_input_index, "" ]);
node.sortIO();
display_list = node.input_display_list;
if(type == JUNCTION_CONNECT.input) {
var _txt = __txtx("dialog_group_order_add", "Add separator");
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), mouse_ui, sFOCUS, sHOVER, _txt, THEME.add_16, 1, COLORS._main_value_positive) == 2) {
array_push(node.attributes.input_display_list, [ "Separator", false ]);
node.sortIO();
}
}
#endregion

View file

@ -6,31 +6,17 @@ event_inherited();
dialog_h = ui(400);
destroy_on_click_out = true;
dragging = noone;
dragging = noone;
drag_disp = noone;
drag_insert = 0;
drag_shift = 0;
node = noone;
display_list = [];
function setNode(node) {
self.node = node;
self.display_list = node.output_display_list;
}
function refreshDisplay() {
var _ord = 0;
for( var i = 0, n = array_length(display_list); i < n; i++ ) {
var ls = display_list[i];
var _inp = node.outputs[| ls];
_inp.from.attributes.input_priority = _ord;
_ord++;
}
node.sortIO();
display_list = node.output_display_list;
PROJECT.modified = true;
self.display_list = node.attributes.output_display_list;
}
#endregion
@ -38,56 +24,53 @@ event_inherited();
sc_group = new scrollPane(dialog_w - ui(padding + padding), dialog_h - ui(title_height + padding), function(_y, _m) {
draw_clear_alpha(COLORS.panel_bg_clear, 0);
if(node == noone) return 0;
var _h = 0;
var hg = ui(32);
var hg = ui(28);
var con_w = sc_group.surface_w;
var inpt = 0;
var hovr = 0;
var padd = ui(4);
var _drag = -1;
var _ly = _y;
for( var i = 0, n = array_length(display_list); i < n; i++ ) {
var disp = display_list[i];
if(sHOVER && point_in_rectangle(_m[0], _m[1], 0 + padd, _y + padd, hg - padd, _y + hg - padd)) {
draw_sprite_stretched_ext(THEME.group_label, 0, padd, _y + padd, hg - padd * 2, hg - padd * 2, COLORS._main_icon, 1);
if(mouse_press(mb_left, sFOCUS))
_drag = i;
} else
draw_sprite_stretched_ext(THEME.group_label, 0, padd, _y + padd, hg - padd * 2, hg - padd * 2, COLORS._main_icon_light, 1);
draw_sprite_ui(THEME.hamburger, 0, hg / 2, _y + hg / 2, 0.5, 0.5,, COLORS._main_icon_light);
var _y0 = _y;
var _y1 = _y + hg + padd;
if(dragging != noone && _m[1] > _y + ui(28)) {
hovr = i + 1;
_ly = _y + (is_array(disp)? hg : ui(28)) + ui(4);
if(dragging == noone) {
var aa = 0.5;
if(sHOVER && point_in_rectangle(_m[0], _m[1], 0 + padd, _y + padd, hg - padd, _y + hg - padd)) {
aa = 1;
if(mouse_press(mb_left, sFOCUS)) dragging = display_list[i];
}
draw_sprite_ui(THEME.hamburger_s, 0, hg / 2, _y + hg / 2,,,, COLORS._main_icon_light, aa);
}
var ind = node.outputs[| disp];
draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text_sub);
draw_text(hg + ui(8), _y + ui(14), ind.name);
inpt++;
_y += ui(28) + ui(4);
_h += ui(28) + ui(4);
}
if(_drag > -1) {
dragging = display_list[_drag];
array_delete(display_list, _drag, 1);
}
if(dragging != noone && _ly > -1) {
draw_set_color(COLORS._main_icon_dark);
draw_line_round(ui(4), _ly, con_w - ui(4), _ly, 4);
}
if(dragging != noone && mouse_release(mb_left)) {
if((i == n - 1 && _m[1] > _y0) || (_m[1] > _y0 && _m[1] <= _y1) || (i == 0 && _m[1] < _y1))
hovr = i;
var ind = node.inputs[| disp];
draw_set_text(f_p2, fa_left, fa_center, COLORS._main_text_sub);
draw_text_add(hg + ui(8), _y + hg / 2 - 1, ind.name);
if(dragging == disp) {
draw_sprite_ui(THEME.hamburger_s, 0, hg / 2, _y + hg / 2,,,, COLORS._main_accent, 1);
draw_sprite_stretched_ext(THEME.button_hide, 3, 0, _y0, con_w, hg, COLORS._main_icon, 1);
}
_y += hg + padd;
_h += hg + padd;
}
if(dragging != noone) {
array_remove(display_list, dragging);
array_insert(display_list, hovr, dragging);
refreshDisplay();
dragging = noone;
if(mouse_release(mb_left)) {
node.sortIO();
dragging = noone;
}
}
return _h;

View file

@ -7,7 +7,7 @@ if !ready exit;
DIALOG_DRAW_FOCUS
draw_set_text(f_p0, fa_left, fa_top, COLORS._main_text);
draw_text(dialog_x + ui(24), dialog_y + ui(20), __txtx("dialog_group_order_title", "Input order"));
draw_text(dialog_x + ui(24), dialog_y + ui(20), __txtx("dialog_group_output_order_title", "Output order"));
#endregion
#region preset

View file

@ -75,4 +75,7 @@ event_inherited();
function remove() { #region
instance_destroy();
} #endregion
function onFocusBegin() { if(content) content.onFocusBegin(); }
function onFocusEnd() { if(content) content.onFocusEnd(); }
#endregion

View file

@ -134,7 +134,7 @@ event_inherited();
ds_list_add(pref_global, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_double_click_delay", "Double click delay"),
"double_click_delay",
new slider(0, 1, 0.01, function(val) {
slider(0, 1, 0.01, function(val) {
PREFERENCES.double_click_delay = val;
PREF_SAVE();
})
@ -152,7 +152,7 @@ event_inherited();
ds_list_add(pref_global, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_keyboard_hold_start", "Keyboard hold start"),
"keyboard_repeat_start",
new slider(0, 1, 0.01, function(val) {
slider(0, 1, 0.01, function(val) {
PREFERENCES.keyboard_repeat_start = val;
PREF_SAVE();
})
@ -161,7 +161,7 @@ event_inherited();
ds_list_add(pref_global, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_keyboard_repeat_delay", "Keyboard repeat delay"),
"keyboard_repeat_speed",
new slider(0, 1, 0.01, function(val) {
slider(0, 1, 0.01, function(val) {
PREFERENCES.keyboard_repeat_speed = val;
PREF_SAVE();
})
@ -277,7 +277,7 @@ event_inherited();
PREFERENCES._display_scaling = PREFERENCES.display_scaling;
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item(
__txtx("pref_gui_scaling", "GUI scaling*"),
new slider(0.5, 2, 0.01, function(val) {
slider(0.5, 2, 0.01, function(val) {
PREFERENCES._display_scaling = val;
should_restart = true;
}, function() {
@ -480,6 +480,27 @@ event_inherited();
})
));
if(IS_PATREON) {
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_widget_textbox_shake", "Textbox shake"),
"textbox_shake",
new textBox(TEXTBOX_INPUT.number, function(str) {
PREFERENCES.textbox_shake = real(str);
PREF_SAVE();
})
).patreon());
ds_list_add(pref_appr, new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_widget_textbox_particles", "Textbox particles"),
"textbox_particle",
new textBox(TEXTBOX_INPUT.number, function(str) {
PREFERENCES.textbox_particle = round(real(str));
PREF_SAVE();
})
).patreon());
}
#endregion
#region theme
@ -957,6 +978,20 @@ event_inherited();
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(24), yy + th / 2, name);
if(_pref.is_patreon) {
var spr_x = ui(20);
var spr_y = yy + ui(4);
BLEND_SUBTRACT
gpu_set_colorwriteenable(0, 0, 0, 1);
draw_sprite_ext(s_patreon_supporter, 0, spr_x, spr_y, -1, 1, 0, c_white, 1);
gpu_set_colorwriteenable(1, 1, 1, 1);
BLEND_NORMAL
draw_sprite_ext(s_patreon_supporter, 1, spr_x, spr_y, -1, 1, 0, COLORS._main_accent, 1);
}
_pref.editWidget.setFocusHover(sFOCUS, sHOVER && sp_pref.hover);
var widget_w = ui(260);

View file

@ -20,7 +20,7 @@ var _mdx = window_mouse_get_delta_x();
var _mdy = window_mouse_get_delta_y();
var _dx = abs(_mdx) > abs(_mdy)? _mdx : -_mdy;
if(key_mod_press(CTRL)) _s *= 10;
if(key_mod_press(CTRL) && !tb.slide_snap) _s *= 10;
if(key_mod_press(ALT)) _s /= 10;
cur_val += _dx * _s;
@ -29,7 +29,9 @@ if(tb.slide_range != noone)
cur_val = clamp(cur_val, tb.curr_range[0], tb.curr_range[1]);
var _val = value_snap(cur_val, _s);
if(tb.slide_int) _val = round(_val);
if(key_mod_press(CTRL) && tb.slide_snap) _val = value_snap(cur_val, tb.slide_snap);
if(tb.slide_int) _val = round(_val);
if(abs(_val) < _s * 4) _val = 0;

View file

@ -5,6 +5,10 @@ function __Panel_Linear_Setting_Item(name, editWidget, data, onEdit = noone, get
self.onEdit = onEdit;
self.getDefault = getDefault;
self.is_patreon = false;
static patreon = function() { is_patreon = true; return self; }
} #endregion
function __Panel_Linear_Setting_Item_Preference(name, key, editWidget, _data = noone) : __Panel_Linear_Setting_Item(name, editWidget, _data) constructor { #region

View file

@ -22,7 +22,8 @@ function __APPEND_MAP(_map, context = PANEL_GRAPH.getCurrentContext()) { #region
if(struct_has(_map, "version")) {
var _v = _map.version;
PROJECT.version = _v;
LOADING_VERSION = _v;
if(PREFERENCES.notify_load_version && floor(_v) != floor(SAVE_VERSION)) {
var warn = $"File version mismatch : loading file version {_v} to Pixel Composer {SAVE_VERSION}";
log_warning("FILE", warn)

View file

@ -127,8 +127,8 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
} #endregion
static drawParam = function(params) { #region
font = params.font;
for(var i = 0; i < 4; i++) tb[i].font = params.font;
setParam(params);
for(var i = 0; i < 4; i++) tb[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m);
} #endregion

View file

@ -57,7 +57,7 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
} #endregion
static drawParam = function(params) { #region
font = params.font;
setParam(params);
return draw(params.x, params.y, params.w, params.h, params.m);
} #endregion

View file

@ -41,7 +41,7 @@ function buttonGroup(_data, _onClick) : widget() constructor {
}
static drawParam = function(params) {
font = params.font;
setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
}

View file

@ -10,7 +10,7 @@ function checkBoxGroup(sprs, _onClick) : widget() constructor {
}
static drawParam = function(params) {
font = params.font;
setParam(params);
return draw(params.x, params.y, params.data, params.m, params.s);
}

View file

@ -22,25 +22,25 @@ function colorSelector(onApply = noone) constructor {
color_surface = surface_create_valid(ui(256), ui(256));
tb_hue = new slider(0, 255, 1, function(_val) {
tb_hue = slider(0, 255, 1, function(_val) {
if(!interactable) return;
hue = clamp(_val, 0, 255);
setHSV();
});
tb_sat = new slider(0, 255, 1, function(_val) {
tb_sat = slider(0, 255, 1, function(_val) {
if(!interactable) return;
sat = clamp(_val, 0, 255);
setHSV();
});
tb_val= new slider(0, 255, 1, function(_val) {
tb_val= slider(0, 255, 1, function(_val) {
if(!interactable) return;
val = clamp(_val, 0, 255);
setHSV();
});
tb_red = new slider(0, 255, 1, function(_val) {
tb_red = slider(0, 255, 1, function(_val) {
if(!interactable) return;
var r = clamp(_val, 0, 255);
var g = color_get_green(current_color);
@ -51,7 +51,7 @@ function colorSelector(onApply = noone) constructor {
resetHSV();
});
tb_green = new slider(0, 255, 1, function(_val) {
tb_green = slider(0, 255, 1, function(_val) {
if(!interactable) return;
var r = color_get_red(current_color);
var g = clamp(_val, 0, 255);
@ -62,7 +62,7 @@ function colorSelector(onApply = noone) constructor {
resetHSV();
});
tb_blue = new slider(0, 255, 1, function(_val) {
tb_blue = slider(0, 255, 1, function(_val) {
if(!interactable) return;
var r = color_get_red(current_color);
var g = color_get_green(current_color);
@ -73,7 +73,7 @@ function colorSelector(onApply = noone) constructor {
resetHSV();
});
tb_alpha = new slider(0, 255, 1, function(_val) {
tb_alpha = slider(0, 255, 1, function(_val) {
if(!interactable) return;
var alp = clamp(_val, 0, 255);

View file

@ -57,16 +57,16 @@ function controlPointBox(_onModify) : widget() constructor {
}
static drawParam = function(params) { #region
font = params.font;
tbCx.font = params.font;
tbCy.font = params.font;
tbFx.font = params.font;
tbFy.font = params.font;
tbW.font = params.font;
tbH.font = params.font;
rot.font = params.font;
sW.font = params.font;
scMode.font = params.font;
setParam(params);
tbCx.setParam(params);
tbCy.setParam(params);
tbFx.setParam(params);
tbFy.setParam(params);
tbW.setParam(params);
tbH.setParam(params);
rot.setParam(params);
sW.setParam(params);setParam(params);
scMode.setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
} #endregion

View file

@ -52,8 +52,8 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor {
}
static drawParam = function(params) {
font = params.font;
for(var i = 0; i < 4; i++) tb[i].font = params.font;
setParam(params);
for(var i = 0; i < 4; i++) tb[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}

View file

@ -102,6 +102,10 @@ function draw_text_int(x, y, str) { #region
draw_text(round(x), round(y), str);
} #endregion
function draw_text_highlight() { #region
} #endregion
function __draw_text_ext_transformed(_x, _y, _text, _sep, _w, sx, sy, rotation, forceCut = false) { #region
INLINE
_x = round(_x);
@ -229,4 +233,4 @@ function __string_height_ext(text, sep, w, _break = LOCALE.config.per_character_
}
return hh;
} #endregion
} #endregion

View file

@ -25,7 +25,7 @@ function fontScrollBox(_onModify) : widget() constructor {
}
static drawParam = function(params) {
font = params.font;
setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
}

View file

@ -0,0 +1,5 @@
function spawn_particle(_x, _y, _rad = 4) {
INLINE
var _param = { radius: _rad };
return instance_create(_x, _y, fx_particle_spawner, _param);
}

View file

@ -0,0 +1,11 @@
{
"resourceType": "GMScript",
"resourceVersion": "1.0",
"name": "fx_controller",
"isCompatibility": false,
"isDnD": false,
"parent": {
"name": "fx",
"path": "folders/misc/fx.yy",
},
}

View file

@ -1,9 +1,10 @@
#region save
globalvar LOADING, APPENDING, CLONING;
globalvar LOADING, APPENDING, CLONING, LOADING_VERSION;
globalvar CONNECTION_CONFLICT;
globalvar MESSAGE;
LOADING = false;
LOADING_VERSION = 0;
CLONING = false;
APPENDING = false;
MESSAGE = noone;
@ -28,10 +29,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER, LATEST_VERSION;
LATEST_VERSION = 11600;
VERSION = 11680;
SAVE_VERSION = 11680;
VERSION_STRING = "1.16.8";
BUILD_NUMBER = 11680;
VERSION = 11690;
SAVE_VERSION = 11690;
VERSION_STRING = "1.16.9";
BUILD_NUMBER = 11690;
globalvar APPEND_MAP;
APPEND_MAP = ds_map_create();

View file

@ -248,11 +248,7 @@ function gradientObject(color = c_black) constructor { #region
static deserialize = function(str) { #region
var s;
if(is_string(str))
s = json_try_parse(str);
else if(is_struct(str))
s = str;
else if(is_array(str)) {
if(is_array(str)) {
keys = [];
for( var i = 0, n = array_length(str); i < n; i++ )
keys[i] = new gradientKey(str[i].time, str[i].value);
@ -260,12 +256,17 @@ function gradientObject(color = c_black) constructor { #region
return self;
}
if(is_string(str)) s = json_try_parse(str);
else if(is_struct(str)) s = str;
else return self;
type = struct_try_get(s, "type");
keys = array_create(array_length(s.keys));
for( var i = 0, n = array_length(s.keys); i < n; i++ ) {
var _time = real(s.keys[i].time);
var _value = real(s.keys[i].value);
_value = PROJECT.version < 11640 && !is_int64(_value)? cola(_value) : int64(_value);
_value = LOADING_VERSION < 11640 && !is_int64(_value)? cola(_value) : int64(_value);
keys[i] = new gradientKey(_time, _value);
}

View file

@ -1,23 +1,25 @@
global.glsl_reserved = ds_map_create();
global.glsl_constant = ds_map_create();
#region global
global.glsl_reserved = ds_map_create();
global.glsl_constant = ds_map_create();
var reserved = ["int", "float", "float2", "float3", "float4", "float3x3", "float4x4", "Texture2D", "SamplerState", "uniform",
"gl_position", "gm_Matrices", "gl_FragColor", "gm_BaseTexture",
"and", "break", "do", "else", "end", "false",
"for", "function", "if", "in", "local", "nil", "not",
"or", "repeat", "return", "then", "true", "until", "while"];
var hlsl_reserved = ["int", "float", "float2", "float3", "float4", "float3x3", "float4x4", "Texture2D", "SamplerState", "uniform",
"gl_position", "gm_Matrices", "gl_FragColor", "gm_BaseTexture",
"and", "break", "do", "else", "end", "false",
"for", "function", "if", "in", "local", "nil", "not",
"or", "repeat", "return", "then", "true", "until", "while"];
for( var i = 0, n = array_length(reserved); i < n; i++ )
global.glsl_reserved[? reserved[i]] = 1;
for( var i = 0, n = array_length(hlsl_reserved); i < n; i++ )
global.glsl_reserved[? hlsl_reserved[i]] = 1;
var constant = ["MATRIX_VIEW", "MATRIX_PROJECTION", "MATRIX_WORLD", "MATRIX_WORLD_VIEW", "MATRIX_WORLD_VIEW_PROJECTION" ];
var constant = ["MATRIX_VIEW", "MATRIX_PROJECTION", "MATRIX_WORLD", "MATRIX_WORLD_VIEW", "MATRIX_WORLD_VIEW_PROJECTION" ];
for( var i = 0, n = array_length(constant); i < n; i++ )
global.glsl_constant[? constant[i]] = 1;
for( var i = 0, n = array_length(constant); i < n; i++ )
global.glsl_constant[? constant[i]] = 1;
global.HLSL_BREAK_TOKEN = [" ", "(", ")", "[", "]", "{", "}", ".", ",", ";", "+", "-", "*", "/", "^", "=", "//"];
global.HLSL_BREAK_TOKEN = [" ", "(", ")", "[", "]", "{", "}", ".", ",", ";", "+", "-", "*", "/", "^", "=", "//"];
#endregion
function hlsl_token_splice(str) {
function hlsl_token_splice(str) { #region
var st = [];
var ss = str;
var sp, cc, del;
@ -50,35 +52,38 @@ function hlsl_token_splice(str) {
} until(sp == 0);
return st;
}
} #endregion
function draw_code_hlsl(_x, _y, str) {
function draw_code_hlsl(_x, _y, str) { #region
var tx = _x;
var ty = _y;
var words = hlsl_token_splice(str);
var comment = false;
for( var j = 0; j < array_length(words); j++ ) {
var word = words[j];
var wordNoS = string_trim(word);
if(wordNoS == "//") comment = true;
if(wordNoS == "//") __code_draw_comment = true;
draw_set_color(COLORS._main_text);
if(comment)
if(__code_draw_comment)
draw_set_color(COLORS.lua_highlight_comment);
else if(word == "(" || word == ")" || word == "[" || word == "]" || word == "{" || word == "}")
draw_set_color(COLORS.lua_highlight_bracklet);
else if(ds_map_exists(global.glsl_reserved, word))
draw_set_color(COLORS.lua_highlight_keyword);
else if(wordNoS == string_decimal(wordNoS) || ds_map_exists(global.glsl_constant, word))
draw_set_color(COLORS.lua_highlight_number);
else if(j < array_length(words) - 1) {
else if(j < array_length(words) - 1)
if(words[j + 1] == "(") draw_set_color(COLORS.lua_highlight_function);
}
else
draw_set_color(COLORS._main_text);
draw_text_add(tx, ty, word);
tx += string_width(word);
}
}
} #endregion

View file

@ -99,7 +99,10 @@ function LOAD_AT(path, readonly = false, override = false) { #region
if(struct_has(_load_content, "version")) {
var _v = _load_content.version;
PROJECT.version = _v;
LOADING_VERSION = _v;
if(PREFERENCES.notify_load_version && floor(_v) != floor(SAVE_VERSION)) {
var warn = $"File version mismatch : loading file version {_v} to Pixel Composer {SAVE_VERSION}";
log_warning("LOAD", warn);

View file

@ -77,9 +77,9 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct
}
static drawParam = function(params) {
font = params.font;
setParam(params);
for(var i = 0; i < inputs; i++)
tb[i].font = params.font;
tb[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}

View file

@ -158,7 +158,8 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
metadata = new MetaDataManager();
attributes.separator = [];
attributes.input_display_list = [];
attributes.output_display_list = [];
attributes.w = 128;
attributes.h = 128;
@ -189,17 +190,11 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
tool_node = noone;
draw_input_overlay = true;
array_push(attributeEditors, ["Edit Input Display", function() { return attributes.separator; },
button(function() {
var dia = dialogCall(o_dialog_group_input_order);
dia.setNode(self);
}) ]);
array_push(attributeEditors, ["Edit Input Display", function() { return 0; },
button(function() { dialogCall(o_dialog_group_input_order).setNode(self, JUNCTION_CONNECT.input); }) ]);
array_push(attributeEditors, ["Edit Output Display", function() { return attributes.separator; },
button(function() {
var dia = dialogCall(o_dialog_group_output_order);
dia.setNode(self);
}) ]);
array_push(attributeEditors, ["Edit Output Display", function() { return 0; },
button(function() { dialogCall(o_dialog_group_input_order).setNode(self, JUNCTION_CONNECT.output); }) ]);
insp1UpdateTooltip = __txtx("panel_inspector_execute", "Execute node contents");
insp1UpdateIcon = [ THEME.sequence_control, 1, COLORS._main_value_positive ];
@ -456,92 +451,14 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
draw_dummy = false;
} #endregion
static getListFreeOrder = function(list) { #region
var _or = 0;
var _ors = [];
for( var i = 0, n = ds_list_size(nodes); i < n; i++ ) {
var _n = nodes[| i];
if(!struct_has(_n.attributes, "input_priority")) continue;
array_push(_ors, _n.attributes.input_priority);
}
array_sort(_ors, true);
for( var i = 0, n = array_length(_ors); i < n; i++ )
if(_or == _ors[i]) _or++;
return _or;
} #endregion
static getInputFreeOrder = function() { return getListFreeOrder(inputs); }
static getOutputFreeOrder = function() { return getListFreeOrder(outputs); }
static sortIO = function() { #region
var sep = attributes.separator;
var siz = ds_list_size(inputs);
var ar = ds_priority_create();
var _ors = {};
var _dup = false;
for( var i = 0; i < ds_list_size(inputs); i++ )
array_push_unique(attributes.input_display_list, i);
input_display_list = attributes.input_display_list;
array_sort(sep, function(a0, a1) { return a0[0] - a1[0]; });
for( var i = custom_input_index; i < siz; i++ ) {
var _in = inputs[| i];
var _or = _in.from.attributes.input_priority;
if(struct_has(_ors, _or)) _dup = true;
_ors[$ _or] = 1;
ds_priority_add(ar, _in, _or);
}
for( var i = siz - 1; i >= custom_input_index; i-- )
ds_list_delete(inputs, i);
if(array_empty(input_display_list_def)) {
input_display_list = [];
for( var i = 0; i < custom_input_index; i++ )
array_push(input_display_list, i);
} else {
input_display_list = array_clone(input_display_list_def);
}
for( var i = custom_input_index; i < siz; i++ ) {
var _jin = ds_priority_delete_min(ar);
_jin.index = i;
ds_list_add(inputs, _jin);
array_push(input_display_list, i);
}
for( var i = array_length(sep) - 1; i >= 0; i-- )
array_insert(input_display_list, array_length(input_display_list_def) + sep[i][0], [ sep[i][1], false, i ]);
ds_priority_destroy(ar);
output_display_list = [];
var siz = ds_list_size(outputs);
var ar = ds_priority_create();
var _dup = false;
for( var i = custom_output_index; i < siz; i++ ) {
var _out = outputs[| i];
var _or = _out.from.attributes.input_priority;
ds_priority_add(ar, _out, _or);
}
for( var i = siz - 1; i >= custom_output_index; i-- )
ds_list_delete(outputs, i);
for( var i = 0; i < siz; i++ )
array_push(output_display_list, i);
for( var i = custom_output_index; i < siz; i++ ) {
var _jout = ds_priority_delete_min(ar);
_jout.index = i;
ds_list_add(outputs, _jout);
}
ds_priority_destroy(ar);
for( var i = 0; i < ds_list_size(outputs); i++ )
array_push_unique(attributes.output_display_list, i);
output_display_list = attributes.output_display_list;
setHeight();
} #endregion
@ -668,16 +585,4 @@ function Node_Collection(_x, _y, _group = noone) : Node(_x, _y, _group) construc
applyDeserialize();
} #endregion
static attributeSerialize = function() { #region
var att = variable_clone(attributes);
att.separator = json_stringify(attributes.separator);
return att;
} #endregion
static attributeDeserialize = function(attr) { #region
struct_override(attributes, attr);
if(struct_has(attr, "separator"))
attributes.separator = json_parse(attr.separator);
} #endregion
}

View file

@ -1659,7 +1659,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
var _node = nodeBuild(_type, x, y, target);
CLONING = false;
PROJECT.version = SAVE_VERSION;
LOADING_VERSION = SAVE_VERSION;
if(!_node) return;

View file

@ -9,22 +9,69 @@ function Node_De_Corner(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 2] = nodeValue("Tolerance", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 0)
.setDisplay(VALUE_DISPLAY.slider);
inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2)
inputs[| 4] = nodeValue("Type", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Double", "Diagonal" ]);
inputs[| 5] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider);
__init_mask_modifier(5); // inputs 7, 8,
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 1,
["Effect", false], 0, 2,
input_display_list = [ 1,
["Surfaces", true], 0, 5, 6, 7, 8,
["Effect", false], 4, 2, 3,
]
attribute_surface_depth();
temp_surface = [ noone, noone ];
static step = function() { #region
__step_mask_modifier();
} #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
surface_set_shader(_outSurf, sh_de_corner);
shader_set_f("dimension", [ surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]) ]);
shader_set_f("tolerance", _data[2]);
var surf = _data[0];
var _tol = _data[2];
var _itr = _data[3];
var _str = _data[4];
draw_surface_safe(_data[0], 0, 0);
var _sw = surface_get_width_safe(surf);
var _sh = surface_get_height_safe(surf);
for( var i = 0; i < 2; i++ ) temp_surface[i] = surface_verify(temp_surface[i], _sw, _sh);
var _bg = 0;
surface_set_shader(temp_surface[1]);
draw_surface_safe(surf);
surface_reset_shader();
repeat(_itr) {
surface_set_shader(temp_surface[_bg], sh_de_corner);
shader_set_f("dimension", _sw, _sh);
shader_set_f("tolerance", _tol);
shader_set_i("strict", _str);
draw_surface_safe(temp_surface[!_bg]);
surface_reset_shader();
_bg = !_bg;
}
surface_set_shader(_outSurf);
draw_surface_safe(temp_surface[!_bg]);
surface_reset_shader();
__process_mask_modifier(_data);
_outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]);
return _outSurf;
} #endregion
}

View file

@ -9,22 +9,68 @@ function Node_De_Stray(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
inputs[| 2] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
active_index = 2;
inputs[| 3] = nodeValue("Iteration", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 2)
inputs[| 4] = nodeValue("Strictness", self, JUNCTION_CONNECT.input, VALUE_TYPE.integer, 0)
.setDisplay(VALUE_DISPLAY.enum_button, [ "Low", "High", "Stray-only" ]);
inputs[| 5] = nodeValue("Mask", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
inputs[| 6] = nodeValue("Mix", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1)
.setDisplay(VALUE_DISPLAY.slider);
__init_mask_modifier(5); // inputs 7, 8,
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
input_display_list = [ 2,
["Effect", false], 0, 1,
input_display_list = [ 2,
["Surfaces", true], 0, 5, 6, 7, 8,
["Effect", false], 4, 1, 3,
]
attribute_surface_depth();
temp_surface = [ noone, noone ];
static step = function() { #region
__step_mask_modifier();
} #endregion
static processData = function(_outSurf, _data, _output_index, _array_index) { #region
surface_set_shader(_outSurf, sh_de_stray);
shader_set_dim("dimension", _data[0]);
shader_set_f("tolerance", _data[1]);
var surf = _data[0];
var _tol = _data[1];
var _itr = _data[3];
var _str = _data[4];
draw_surface_safe(_data[0], 0, 0);
var _sw = surface_get_width_safe(surf);
var _sh = surface_get_height_safe(surf);
for( var i = 0; i < 2; i++ ) temp_surface[i] = surface_verify(temp_surface[i], _sw, _sh);
var _bg = 0;
surface_set_shader(temp_surface[1]);
draw_surface_safe(surf);
surface_reset_shader();
repeat(_itr) {
surface_set_shader(temp_surface[_bg], sh_de_stray);
shader_set_f("dimension", _sw, _sh);
shader_set_f("tolerance", _tol);
shader_set_i("strict", _str);
draw_surface_safe(temp_surface[!_bg]);
surface_reset_shader();
_bg = !_bg;
}
surface_set_shader(_outSurf);
draw_surface_safe(temp_surface[!_bg]);
surface_reset_shader();
__process_mask_modifier(_data);
_outSurf = mask_apply(_data[0], _outSurf, _data[5], _data[6]);
return _outSurf;
} #endregion
}

View file

@ -8,8 +8,6 @@ function Node_DynaSurf_In(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inParent = undefined;
attributes.input_priority = group == noone? 0 : group.getInputFreeOrder();
outputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.output, VALUE_TYPE.PCXnode, noone);
static createInput = function() { #region
@ -54,8 +52,6 @@ function Node_DynaSurf_In(_x, _y, _group = noone) : Node(_x, _y, _group) constru
static doApplyDeserialize = function() { #region
if(group == noone) return;
if(CLONING) attributes.input_priority = group.getInputFreeOrder();
group.sortIO();
} #endregion

View file

@ -7,9 +7,6 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
destroy_when_upgroup = true;
inParent = undefined;
attributes.input_priority = 0;
if(!CLONING && !LOADING && !APPENDING && group != noone) attributes.input_priority = group.getInputFreeOrder();
w = 96;
h = 32 + 24;
min_h = h;
@ -378,7 +375,6 @@ function Node_Group_Input(_x, _y, _group = noone) : Node(_x, _y, _group) constru
inParent.name = name;
getInputs();
if(PROJECT.version < 11520) attributes.input_priority = getInputData(5);
onValueUpdate();
group.sortIO();

View file

@ -6,9 +6,6 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
destroy_when_upgroup = true;
attributes.input_priority = 0;
if(!CLONING && !LOADING && !APPENDING && group != noone) attributes.input_priority = group.getOutputFreeOrder();
w = 96;
h = 32 + 24;
min_h = h;
@ -110,13 +107,11 @@ function Node_Group_Output(_x, _y, _group = noone) : Node(_x, _y, _group) constr
if(group == noone) return;
createOutput(false);
if(PROJECT.version < 11520) attributes.input_priority = getInputData(1);
group.sortIO();
} #endregion
static doApplyDeserialize = function() { #region
if(CLONING) attributes.input_priority = group.getOutputFreeOrder();
} #endregion
static onDestroy = function() { #region

View file

@ -623,7 +623,7 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
static deserialize = function(_data, scale = false) { #region
ds_list_clear(values);
if(prop.type == VALUE_TYPE.gradient && PROJECT.version < 1340 && !CLONING) { //backward compat: Gradient
if(prop.type == VALUE_TYPE.gradient && LOADING_VERSION < 1340 && !CLONING) { //backward compat: Gradient
var _val = [];
var value = _data[0][1];
@ -665,18 +665,22 @@ function valueAnimator(_val, _prop, _sep_axis = false) constructor {
if(prop.type == VALUE_TYPE.struct)
_val = json_try_parse(value);
else if(prop.type == VALUE_TYPE.path && prop.display_type == VALUE_DISPLAY.path_array) {
for(var j = 0; j < array_length(value); j++)
_val[j] = value[j];
} else if(prop.type == VALUE_TYPE.gradient) {
var grad = new gradientObject();
_val = grad.deserialize(value);
} else if(prop.type == VALUE_TYPE.color) {
if(is_array(_val)) {
for( var i = 0, n = array_length(_val); i < n; i++ )
_val[i] = PROJECT.version < 11640 && !is_int64(_val[i])? cola(_val[i]) : int64(_val[i]);
_val[i] = LOADING_VERSION < 11640 && !is_int64(_val[i])? cola(_val[i]) : int64(_val[i]);
} else
_val = PROJECT.version < 11640 && !is_int64(_val)? cola(_val) : int64(_val);
_val = LOADING_VERSION < 11640 && !is_int64(_val)? cola(_val) : int64(_val);
} else if(!sep_axis && typeArray(prop.display_type)) {
_val = [];

View file

@ -7,7 +7,7 @@ function Node_Number(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) co
draw_padding = 4;
display_output = 0;
wd_slider = new slider(0, 1, 0.01, function(val) { inputs[| 0].setValue(val); } );
wd_slider = slider(0, 1, 0.01, function(val) { inputs[| 0].setValue(val); } );
wd_slider.spr = THEME.node_slider;
slider_value = -1;

View file

@ -892,9 +892,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
extract_node = "Node_Number";
break; #endregion
case VALUE_DISPLAY.range : #region
editWidget = new rangeBox(_txt, function(index, val) {
return setValueInspector(val, index);
} );
editWidget = new rangeBox(_txt, function(index, val) { return setValueInspector(val, index); } );
if(type == VALUE_TYPE.integer) editWidget.setSlideSpeed(1 / 10);
@ -1316,9 +1314,8 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
break;
default :
mapWidget = new vectorBox(2, function(index, val) { return setValueDirect(val, index); });
mapWidget = new rangeBox(TEXTBOX_INPUT.number, function(index, val) { return setValueDirect(val, index); });
mapWidget.side_button = mapButton;
mapWidget.setMinMax();
break;
}

View file

@ -63,8 +63,8 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor {
} #endregion
static drawParam = function(params) {
font = params.font;
for(var i = 0; i < 4; i++) tb[i].font = params.font;
setParam(params);
for(var i = 0; i < 4; i++) tb[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}

View file

@ -18,7 +18,7 @@ function Panel_Collections_Setting() : Panel_Linear_Setting() constructor {
new __Panel_Linear_Setting_Item_Preference(
__txtx("coll_thumbnail_scale", "Thumbnail scale"),
"collection_scale",
new slider(0, 1, 0.01, function(val) { PREFERENCES.collection_scale = clamp(val, 0.1, 1); PREF_SAVE(); }),
slider(0, 1, 0.01, function(val) { PREFERENCES.collection_scale = clamp(val, 0.1, 1); PREF_SAVE(); }),
),
];

View file

@ -829,6 +829,9 @@ function Panel(_parent, _x, _y, _w, _h) constructor { #region
}
} #endregion
function onFocusBegin() { INLINE if(FOCUS.getContent()) FOCUS.getContent().onFocusBegin(); }
function onFocusEnd() { INLINE if(FOCUS.getContent()) FOCUS.getContent().onFocusEnd(); }
function remove(con = getContent()) { #region
var curr = getContent();
@ -947,13 +950,16 @@ function PanelContent() constructor { #region
} #endregion
function setFocus(target, fstring = noone) { #region
if(FOCUS != noone && is_struct(FOCUS) && FOCUS.getContent())
FOCUS.getContent().onFocusEnd();
if((instance_exists(FOCUS) && variable_instance_exists(FOCUS, "onFocusEnd")) ||
(is_struct(FOCUS) && struct_has(FOCUS, "onFocusEnd")))
FOCUS.onFocusEnd();
FOCUS = target;
if(fstring != noone)
FOCUS_STR = fstring;
if(FOCUS != noone && is_struct(FOCUS) && FOCUS.getContent())
FOCUS.getContent().onFocusBegin();
if((instance_exists(FOCUS) && variable_instance_exists(FOCUS, "onFocusBegin")) ||
(is_struct(FOCUS) && struct_has(FOCUS, "onFocusBegin")))
FOCUS.onFocusBegin();
} #endregion

View file

@ -34,7 +34,7 @@ function Panel_Graph_Connection_Setting() : Panel_Linear_Setting() constructor {
new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_connection_highlight_fade", "Fade connection"),
"connection_line_highlight_fade",
new slider(0, 1, 0.05, function(val) { PREFERENCES.connection_line_highlight_fade = val; }),
slider(0, 1, 0.05, function(val) { PREFERENCES.connection_line_highlight_fade = val; }),
),
new __Panel_Linear_Setting_Item_Preference(
__txtx("pref_connection_highlight_all", "Highlight all"),

View file

@ -27,7 +27,7 @@ function Panel_Graph_Grid_Setting() : Panel_Linear_Setting() constructor {
),
new __Panel_Linear_Setting_Item(
__txtx("project_graphGrid_opacity", "Grid opacity"),
new slider(0, 1, .05, function(str) {
slider(0, 1, .05, function(str) {
if(PANEL_GRAPH.project == noone || !PANEL_GRAPH.project.active) return;
PANEL_GRAPH.project.graphGrid.opacity = clamp(real(str), 0, 1);
}),

View file

@ -36,7 +36,7 @@ function Panel_Graph_View_Setting(display) : Panel_Linear_Setting() constructor
),
new __Panel_Linear_Setting_Item(
__txtx("graph_visibility_preview_scale", "Preview Scale"),
new slider(50, 100, 1, function(val) { display_parameter.preview_scale = val; }),
slider(50, 100, 1, function(val) { display_parameter.preview_scale = val; }),
function() { return display_parameter.preview_scale },
function(val) { display_parameter.preview_scale = val; },
100,

View file

@ -859,7 +859,7 @@ function Panel_Inspector() : PanelContent() constructor {
draw_set_font(f_p1);
var lx = w / 2 - string_width(inspecting.name) / 2 - ui(10);
var ly = ui(56 - 8);
if(buttonInstant(THEME.button_hide, lx, ly, ui(16), ui(16), [mx, my], pFOCUS, pHOVER, __txt("Lock"), THEME.lock, !locked, locked? COLORS._main_icon_light : COLORS._main_icon,, 0.5) == 2)
if(buttonInstant(THEME.button_hide, lx, ly, ui(16), ui(16), [mx, my], pFOCUS, pHOVER, __txt("Lock"), THEME.lock_12, !locked, locked? COLORS._main_icon_light : COLORS._main_icon) == 2)
locked = !locked;
if(buttonInstant(THEME.button_hide, bx, by, ui(32), ui(32), [mx, my], pFOCUS, pHOVER, __txt("Presets"), THEME.preset, 1) == 2)

View file

@ -1315,7 +1315,7 @@ function Panel_Preview() : PanelContent() constructor {
}
} #endregion
function drawToolBar(_node) { #region
function drawToolBar(_tool) { #region
var ty = h - toolbar_height;
//draw_sprite_stretched_ext(THEME.toolbar_shadow, 0, 0, ty - 12 + 4, w, 12, c_white, 0.5);
@ -1323,10 +1323,8 @@ function Panel_Preview() : PanelContent() constructor {
draw_sprite_stretched_ext(THEME.toolbar, 1, 0, 0, w, topbar_height, c_white, aa);
draw_sprite_stretched_ext(THEME.toolbar, 0, 0, ty, w, toolbar_height, c_white, aa);
if(!_node) return;
if(tool_current != noone) { #region tool settings
var settings = array_merge(_node.getToolSettings(), tool_current.settings);
if(_tool && tool_current != noone) { #region tool settings
var settings = array_merge(_tool.getToolSettings(), tool_current.settings);
tool_x = lerp_float(tool_x, tool_x_to, 5);
var tolx = tool_x + ui(16);
@ -1376,8 +1374,8 @@ function Panel_Preview() : PanelContent() constructor {
}
#endregion
} else { #region color sampler
var cx = ui(10);
var cy = ui(10);
var cx = ui(8);
var cy = ui(8);
var cw = ui(32);
var ch = topbar_height - ui(16);

View file

@ -22,7 +22,7 @@ function Panel_Preview_3D_Setting(panel) : Panel_Linear_Setting() constructor {
),
new __Panel_Linear_Setting_Item(
__txt("Light Intensity"),
new slider(0, 1, 0.01, function(val) {
slider(0, 1, 0.01, function(val) {
preview_panel.d3_scene_light0.intensity = val;
preview_panel.d3_scene_light1.intensity = val;
}),

View file

@ -33,7 +33,7 @@ function Panel_Preview_Grid_Setting() : Panel_Linear_Setting() constructor {
),
new __Panel_Linear_Setting_Item(
__txt("Grid opacity"),
new slider(0, 1, .05, function(str) { PROJECT.previewGrid.opacity = clamp(real(str), 0, 1); }),
slider(0, 1, .05, function(str) { PROJECT.previewGrid.opacity = clamp(real(str), 0, 1); }),
function() { return PROJECT.previewGrid.opacity; },
function(val) { PROJECT.previewGrid.opacity = val; },
0.5,

View file

@ -42,7 +42,7 @@ function Panel_Preview_Onion_Setting() : Panel_Linear_Setting() constructor {
),
new __Panel_Linear_Setting_Item(
__txt("Opacity"),
new slider(0, 1, .05, function(str) { PROJECT.onion_skin.alpha = clamp(real(str), 0, 1); }),
slider(0, 1, .05, function(str) { PROJECT.onion_skin.alpha = clamp(real(str), 0, 1); }),
function() { return PROJECT.onion_skin.alpha; },
function(val) { PROJECT.onion_skin.alpha = val; },
0.5

View file

@ -39,8 +39,8 @@ function pathAnchorBox(_onModify) : widget() constructor {
}
static drawParam = function(params) {
font = params.font;
for(var i = 0; i < 6; i++) tb[i].font = params.font;
setParam(params);
for(var i = 0; i < 6; i++) tb[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}

View file

@ -18,7 +18,7 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor {
}
static drawParam = function(params) {
font = params.font;
setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}

View file

@ -98,6 +98,9 @@
PREFERENCES.add_node_remember = true;
PREFERENCES.textbox_shake = 0;
PREFERENCES.textbox_particle = 0;
PREFERENCES_DEF = variable_clone(PREFERENCES);
#endregion

View file

@ -51,8 +51,8 @@ function quarternionBox(_onModify) : widget() constructor {
}
static drawParam = function(params) {
font = params.font;
for(var i = 0; i < 4; i++) tb[i].font = params.font;
setParam(params);
for(var i = 0; i < 4; i++) tb[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m);
}

View file

@ -21,7 +21,7 @@ function rangeBox(_type, _onModify) : widget() constructor {
return onModify(index, toNumber(val));
}
label = [ "min", "max" ];
labels = [ "min", "max" ];
onModifySingle[0] = function(val) { return onModifyIndex(0, toNumber(val)); }
onModifySingle[1] = function(val) { return onModifyIndex(1, toNumber(val)); }
@ -31,6 +31,7 @@ function rangeBox(_type, _onModify) : widget() constructor {
tb[i] = new textBox(_type, onModifySingle[i]);
tb[i].slidable = true;
tb[i].hide = true;
tb[i].label = labels[i];
}
static setSlideSpeed = function(speed) {
@ -53,8 +54,8 @@ function rangeBox(_type, _onModify) : widget() constructor {
}
static drawParam = function(params) {
font = params.font;
for(var i = 0; i < 2; i++) tb[i].font = params.font;
setParam(params);
for(var i = 0; i < 2; i++) tb[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m);
}
@ -69,6 +70,13 @@ function rangeBox(_type, _onModify) : widget() constructor {
var _icon_blend = linked? COLORS._main_accent : COLORS._main_icon;
var _bs = min(_h, ui(32));
if(side_button) {
side_button.setFocusHover(active, hover);
side_button.draw(_x + _w - _bs, _y + _h / 2 - _bs / 2, _bs, _bs, _m, THEME.button_hide);
_w -= _bs + ui(4);
}
var bx = _x;
var by = _y + _h / 2 - _bs / 2;

View file

@ -12,8 +12,8 @@ function rotator(_onModify, _step = -1) : widget() constructor {
spr_bg = THEME.rotator_bg;
spr_knob = THEME.rotator_knob;
tb_value = new textBox(TEXTBOX_INPUT.number, onModify).setSlidable(0.1, true);
tb_value.hide = true;
tb_value = new textBox(TEXTBOX_INPUT.number, onModify).setSlidable([ 0.1, 15 ], true);
tb_value.hide = true;
halign = fa_center;
@ -27,8 +27,8 @@ function rotator(_onModify, _step = -1) : widget() constructor {
} #endregion
static drawParam = function(params) { #region
font = params.font;
tb_value.font = params.font;
setParam(params);
tb_value.setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
} #endregion

View file

@ -9,10 +9,10 @@ function rotatorRandom(_onModify) : widget() constructor {
knob_hovering = noone;
mode = 0;
tb_min_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, val); } ).setSlidable(0.1, true); tb_min_0.hide = true;
tb_max_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(2, val); } ).setSlidable(0.1, true); tb_max_0.hide = true;
tb_min_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(3, val); } ).setSlidable(0.1, true); tb_min_1.hide = true;
tb_max_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(4, val); } ).setSlidable(0.1, true); tb_max_1.hide = true;
tb_min_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, val); } ).setSlidable([ 0.1, 15 ], true); tb_min_0.hide = true;
tb_max_0 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(2, val); } ).setSlidable([ 0.1, 15 ], true); tb_max_0.hide = true;
tb_min_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(3, val); } ).setSlidable([ 0.1, 15 ], true); tb_min_1.hide = true;
tb_max_1 = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(4, val); } ).setSlidable([ 0.1, 15 ], true); tb_max_1.hide = true;
tooltip = new tooltipSelector("Mode", [
__txtx("widget_rotator_random_range", "Range"),
@ -39,11 +39,11 @@ function rotatorRandom(_onModify) : widget() constructor {
} #endregion
static drawParam = function(params) { #region
font = params.font;
tb_min_0.font = params.font;
tb_max_0.font = params.font;
tb_min_1.font = params.font;
tb_max_1.font = params.font;
setParam(params);
tb_min_0.setParam(params);
tb_max_0.setParam(params);
tb_min_1.setParam(params);
tb_max_1.setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
} #endregion

View file

@ -8,8 +8,8 @@ function rotatorRange(_onModify) : widget() constructor {
knob_hovering = noone;
tb_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, val); } ).setSlidable(0.1, true); tb_min.hide = true;
tb_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, val); } ).setSlidable(0.1, true); tb_max.hide = true;
tb_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(0, val); } ).setSlidable([ 0.1, 15 ], true); tb_min.hide = true;
tb_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(1, val); } ).setSlidable([ 0.1, 15 ], true); tb_max.hide = true;
static setInteract = function(interactable = noone) { #region
self.interactable = interactable;
@ -23,9 +23,9 @@ function rotatorRange(_onModify) : widget() constructor {
} #endregion
static drawParam = function(params) { #region
font = params.font;
tb_min.font = params.font;
tb_max.font = params.font;
setParam(params);
tb_min.setParam(params);
tb_max.setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
} #endregion

View file

@ -43,7 +43,7 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
} #endregion
static drawParam = function(params) { #region
font = params.font;
setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
} #endregion

View file

@ -4,170 +4,8 @@ enum SLIDER_UPDATE {
none,
}
function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widget() constructor {
minn = _min; curr_minn = _min;
maxx = _max; curr_maxx = _max;
stepSize = _step;
current_value = 0;
slide_speed = 1 / 10;
side_button = noone;
onModify = _onModify;
onRelease = _onRelease;
onApply = function(val) {
if(onModify) onModify(val);
if(onRelease) onRelease();
}
update_stat = SLIDER_UPDATE.realtime;
spr = THEME.slider;
blend = c_white;
dragging = noone;
drag_sv = 0;
handle_w = ui(20);
tb_value = new textBox(TEXTBOX_INPUT.number, onApply);
font = noone;
static modifyValue = function(value) { #region
value = clamp(value, curr_minn, curr_maxx);
onModify(value);
} #endregion
static setSlideSpeed = function(speed) { #region
tb_value.setSlidable(speed);
} #endregion
static setInteract = function(interactable = noone) { #region
self.interactable = interactable;
tb_value.interactable = interactable;
} #endregion
static register = function(parent = noone) { #region
tb_value.register(parent);
} #endregion
static drawParam = function(params) { #region
font = params.font;
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
} #endregion
static draw = function(_x, _y, _w, _h, _data, _m, tb_w = 64, halign = fa_left, valign = fa_top) { #region
x = _x;
y = _y;
w = _w;
h = _h;
if(!is_real(_data)) return;
if(!dragging) current_value = _data;
if(side_button) {
side_button.setFocusHover(active, hover);
side_button.draw(_x + _w - ui(32), _y + _h / 2 - ui(32 / 2), ui(32), ui(32), _m, THEME.button_hide);
_w -= ui(40);
}
switch(halign) { #region
case fa_left: _x = _x; break;
case fa_center: _x = _x - _w / 2; break;
case fa_right: _x = _x - _w; break;
} #endregion
switch(valign) { #region
case fa_top: _y = _y; break;
case fa_center: _y = _y - _h / 2; break;
case fa_bottom: _y = _y - _h; break;
} #endregion
var _rang = abs(maxx - minn);
if(!dragging) {
curr_minn = (current_value >= minn)? minn : minn - ceil(abs(current_value - minn) / _rang) * _rang;
curr_maxx = (current_value <= maxx)? maxx : maxx + ceil(abs(current_value - maxx) / _rang) * _rang;
}
var sw = _w;
if(tb_w > 0) {
sw = _w - (tb_w + ui(16));
tb_value.font = font;
tb_value.setFocusHover(active, hover);
tb_value.draw(_x + sw + ui(16), _y, tb_w, _h, current_value, _m);
tb_value.setRange(curr_minn, curr_maxx);
}
draw_sprite_stretched_ext(spr, 0, _x - ui(4), _y + _h / 2 - ui(4), sw + ui(8), ui(8), blend, 1);
if(stepSize >= 1 && sw / ((curr_maxx - curr_minn) / stepSize) > ui(16)) {
for( var i = curr_minn; i <= curr_maxx; i += stepSize ) {
var _v = round(i / stepSize) * stepSize;
var _cx = _x + clamp((_v - curr_minn) / (curr_maxx - curr_minn), 0, 1) * sw;
draw_sprite_stretched_ext(spr, 4, _cx - ui(4), _y + _h / 2 - ui(4), ui(8), ui(8), COLORS.widget_slider_step, 1);
}
}
var _pg = clamp((current_value - curr_minn) / (curr_maxx - curr_minn), 0, 1) * sw;
var _kx = _x + _pg;
draw_sprite_stretched_ext(spr, 1, _kx - handle_w / 2, _y, handle_w, _h, blend, interactable * 0.75 + 0.25);
if(dragging) {
draw_sprite_stretched_ext(spr, 3, _kx - handle_w / 2, _y, handle_w, _h, COLORS._main_accent, 1);
var val = (dragging.drag_sx - dragging.drag_msx) / dragging.drag_sw * (curr_maxx - curr_minn) + curr_minn;
val = round(val / stepSize) * stepSize;
val = clamp(val, curr_minn, curr_maxx);
if(key_mod_press(CTRL))
val = round(val);
current_value = val;
if(update_stat == SLIDER_UPDATE.realtime && onModify != noone && onModify(val))
UNDO_HOLDING = true;
MOUSE_BLOCK = true;
if(mouse_check_button_pressed(mb_right)) {
onModify(drag_sv);
instance_destroy(dragging);
dragging = noone;
UNDO_HOLDING = false;
} else if(mouse_release(mb_left)) {
if(update_stat == SLIDER_UPDATE.release && onModify != noone)
onModify(val);
instance_destroy(dragging);
dragging = noone;
if(onRelease != noone) onRelease(val);
UNDO_HOLDING = false;
}
} else {
if(hover && (point_in_rectangle(_m[0], _m[1], _x, _y, _x + sw, _y + _h) || point_in_rectangle(_m[0], _m[1], _kx - handle_w / 2, _y, _kx + handle_w / 2, _y + _h))) {
draw_sprite_stretched_ext(spr, 2, _kx - handle_w / 2, _y, handle_w, _h, blend, 1);
if(mouse_press(mb_left, active)) {
dragging = instance_create(0, 0, slider_Slider);
dragging.drag_sx = _m[0];
dragging.drag_msx = _x;
dragging.drag_sw = sw;
drag_sv = current_value;
}
var amo = slide_speed;
if(key_mod_press(CTRL)) amo *= 10;
if(key_mod_press(ALT)) amo /= 10;
if(key_mod_press(SHIFT) && mouse_wheel_down()) modifyValue(_data + amo * SCROLL_SPEED);
if(key_mod_press(SHIFT) && mouse_wheel_up()) modifyValue(_data - amo * SCROLL_SPEED);
}
}
resetFocus();
return h;
} #endregion
function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) {
return new textBox( TEXTBOX_INPUT.number, _onModify )
.setSlidable(_step / 10, false, [ _min, _max ])
.setOnRelease(_onRelease);
}

View file

@ -29,9 +29,9 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor {
} #endregion
static drawParam = function(params) { #region
font = params.font;
tb_value_min.font = params.font;
tb_value_max.font = params.font;
setParam(params);
tb_value_min.setParam(params);
tb_value_max.setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
} #endregion

View file

@ -15,8 +15,9 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
auto_update = false;
_input_text_line = [];
_input_text_line = [];
_input_text_line_index = [];
_current_text = "";
_input_text = "";
_prev_text = "";
@ -565,7 +566,14 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
if(auto_update && (keyboard_check_pressed(vk_anykey) || modified))
apply();
if(modified) typing = 100;
if(modified) {
typing = 100;
if(IS_PATREON) {
shake_amount = PREFERENCES.textbox_shake;
repeat(PREFERENCES.textbox_particle) spawn_particle(rx + cursor_pos_x, ry + cursor_pos_y + random(16), 8);
}
}
if(keyboard_check_pressed(vk_left)) onKey(vk_left);
if(keyboard_check_pressed(vk_right)) onKey(vk_right);
@ -638,9 +646,16 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
cut_line();
}
__code_draw_comment = false;
for( var i = 0, n = array_length(_input_text_line); i < n; i++ ) {
_str = _input_text_line[i];
if(_input_text_line_index[i] != "") {
draw_set_color(color);
__code_draw_comment = false;
}
switch(format) {
case TEXT_AREA_FORMAT._default :
draw_text_add(ch_x, ch_y, _str);
@ -735,9 +750,7 @@ function textArea(_input, _onModify) : textInput(_input, _onModify) constructor
} #endregion
static drawParam = function(params) { #region
rx = params.rx;
ry = params.ry;
font = params.font;
setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
} #endregion

View file

@ -9,7 +9,7 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor {
open = false;
static drawParam = function(params) {
font = params.font;
setParam(params);
return draw(params.x, params.y, params.w, params.h, params.m, params.rx, params.ry);
}

View file

@ -4,6 +4,8 @@ enum TEXTBOX_INPUT {
}
function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
onRelease = noone;
align = _input == TEXTBOX_INPUT.number? fa_center : fa_left;
hide = false;
font = noone;
@ -22,6 +24,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
slide_delta = 0;
slide_int = false;
slide_speed = 1 / 10;
slide_snap = 0;
slide_range = noone;
curr_range = [ 0, 1 ];
@ -37,6 +40,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
cursor = 0;
cursor_pos = 0;
cursor_pos_y = 0;
cursor_pos_to = 0;
cursor_select = -1;
@ -57,6 +61,10 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
text_surface = surface_create(1, 1);
shake_amount = 0;
static setOnRelease = function(release) { onRelease = release; return self; }
static modifyValue = function(value) { #region
if(input == TEXTBOX_INPUT.number) {
if(use_range) value = clamp(value, range_min, range_max);
@ -67,7 +75,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
static setSlidable = function(slideStep = slide_speed, _slide_int = false, _slide_range = noone) { #region
slidable = true;
slide_speed = slideStep;
slide_speed = is_array(slideStep)? slideStep[0] : slideStep;
slide_snap = is_array(slideStep)? slideStep[1] : 0;
slide_int = _slide_int;
slide_range = _slide_range;
@ -152,7 +161,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
}
} #endregion
static apply = function() { #region
static apply = function(fn = onModify) { #region
var _input_text_current = _input_text;
disp_x_to = 0;
@ -163,8 +172,13 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
_input_text_current = _last_text;
current_value = _input_text_current;
if(is_callable(onModify))
return onModify(_input_text_current);
if(is_callable(fn)) {
var _modi = fn(_input_text_current);
if(_modi && IS_PATREON) shake_amount = PREFERENCES.textbox_shake / 4;
return _modi;
}
if(IS_PATREON) shake_amount = PREFERENCES.textbox_shake / 4;
return false;
} #endregion
@ -288,7 +302,14 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
if(KEYBOARD_PRESSED == vk_down || keyboard_check_pressed(vk_down)) { _input_text = string(toNumber(_input_text) - _inc); apply(); }
}
if(edited) typing = 100;
if(edited) {
typing = 100;
if(IS_PATREON) {
shake_amount = PREFERENCES.textbox_shake;
repeat(PREFERENCES.textbox_particle) spawn_particle(rx + cursor_pos, ry + cursor_pos_y + random(16), 8);
}
}
if(keyboard_check_pressed(vk_home)) {
if(key_mod_press(SHIFT)) {
@ -318,15 +339,14 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
_y += ui(1);
var cc = color;
if(sliding == 2)
cc = COLORS._main_accent
if(sliding == 2) cc = COLORS._main_accent
draw_set_text(font == noone? f_p0 : font, fa_left, fa_top, cc);
draw_text_add(_x + disp_x, _y, _text + suffix);
draw_set_alpha(1);
var _xx = _x + disp_x;
var _mm = _m;
var _xx = _x + disp_x;
var _mm = _m;
var target = -999;
if(!sliding && _mm >= 0) {
@ -361,7 +381,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
} #endregion
static drawParam = function(params) { #region
font = params.font;
setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.halign, params.valign);
} #endregion
@ -371,6 +392,10 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
w = _w;
h = _h;
_x += irandom_range(-shake_amount, shake_amount);
_y += irandom_range(-shake_amount, shake_amount);
if(shake_amount) shake_amount--;
switch(halign) {
case fa_left: _x = _x; break;
case fa_center: _x = _x - _w / 2; break;
@ -467,6 +492,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
if(key_mod_press(ALT)) _input_text = string_real(toNumber(_input_text) / 2);
else _input_text = string_real(toNumber(_input_text) * 2);
apply();
if(IS_PATREON) shake_amount = PREFERENCES.textbox_shake;
}
}
@ -511,7 +538,8 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
if(cursor_pos_to > _x + _w - ui(16))
disp_x_to -= _w - ui(16);
cursor_pos = cursor_pos == 0? cursor_pos_to : lerp_float(cursor_pos, cursor_pos_to, 2);
cursor_pos_y = c_y0;
cursor_pos = cursor_pos == 0? cursor_pos_to : lerp_float(cursor_pos, cursor_pos_to, 2);
if(cursor_select > -1) { //draw highlight
draw_set_color(COLORS.widget_text_highlight);
@ -611,8 +639,10 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
if(sliding == 2) {
textBox_slider.tb = self;
if(mouse_release(mb_left))
if(mouse_release(mb_left)) {
deactivate();
if(onRelease != noone) apply(onRelease);
}
}
if(mouse_release(mb_left)) {

View file

@ -1,7 +1,6 @@
function textInput(_input, _onModify) : widget() constructor {
input = _input;
onModify = _onModify;
side_button = noone;
selecting = false;
typing = false;

View file

@ -23,9 +23,9 @@ function toggleGroup(_data, _onClick) : widget() constructor {
}
static drawParam = function(params) {
font = params.font;
setParam(params);
for(var i = 0; i < array_length(data); i++)
buttons[i].font = params.font;
buttons[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
}

View file

@ -42,9 +42,9 @@ function transformBox(_onModify) : widget() constructor {
}
static drawParam = function(params) {
font = params.font;
rot.font = params.font;
for(var i = 0; i < 5; i++) tb[i].font = params.font;
setParam(params);
rot.setParam(params);
for(var i = 0; i < 5; i++) tb[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}

View file

@ -52,12 +52,6 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
tb[i].label = axis[i];
}
static setMinMax = function() { #region
linkable = false;
axis = [ "min", "max" ];
return self;
} #endregion
static setLinkInactiveColor = function(color) { #region
link_inactive_color = color;
return self;
@ -91,8 +85,8 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
} #endregion
static drawParam = function(params) { #region
font = params.font;
for(var i = 0; i < 4; i++) tb[i].font = params.font;
setParam(params);
for(var i = 0; i < 4; i++) tb[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m);
} #endregion

View file

@ -56,8 +56,8 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
} #endregion
static drawParam = function(params) { #region
font = params.font;
for(var i = 0; i < size; i++) tb[i].font = params.font;
setParam(params);
for(var i = 0; i < size; i++) tb[i].setParam(params);
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m);
} #endregion

View file

@ -5,6 +5,7 @@ function widget() constructor {
ihover = false;
parent = noone;
interactable = true;
side_button = noone;
lua_thread = noone;
lua_thread_key = "";
@ -36,6 +37,12 @@ function widget() constructor {
self.parent = parent;
}
static setParam = function(params) { #region
font = params.font;
rx = params.rx;
ry = params.ry;
} #endregion
static trigger = function() { }
static parentFocus = function() {

View file

@ -4,12 +4,53 @@
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 dimension;
uniform vec2 dimension;
uniform float tolerance;
uniform int strict;
float d(in vec4 c1, in vec4 c2) { return length(c1.rgb * c1.a - c2.rgb * c2.a) / sqrt(3.); }
bool s(in vec4 c1, in vec4 c2) { return d(c1, c2) <= tolerance; }
bool sameColor(in vec4 c1, in vec4 c2) { return length(c1 - c2) <= tolerance; }
float bright(in vec4 c) { return dot(c.rgb, vec3(0.2126, 0.7152, 0.0722)) * c.a; }
#region select closet color
vec4 sel2(in vec4 c, in vec4 c0, in vec4 c1) {
float d0 = d(c, c0);
float d1 = d(c, c1);
float mn = min(d0, d1);
if(mn == d0) return c0;
return c1;
}
vec4 sel3(in vec4 c, in vec4 c0, in vec4 c1, in vec4 c2) {
float d0 = d(c, c0);
float d1 = d(c, c1);
float d2 = d(c, c2);
float mn = min(min(d0, d1), d2);
if(mn == d0) return c0;
if(mn == d1) return c1;
return c2;
}
vec4 sel4(in vec4 c, in vec4 c0, in vec4 c1, in vec4 c2, in vec4 c3) {
float d0 = d(c, c0);
float d1 = d(c, c1);
float d2 = d(c, c2);
float d3 = d(c, c3);
float mn = min(min(d0, d1), min(d2, d3));
if(mn == d0) return c0;
if(mn == d1) return c1;
if(mn == d2) return c2;
return c3;
}
#endregion
vec4 sample(vec2 st) {
if(st.x < 0. || st.y < 0.) return vec4(0.);
if(st.x > 1. || st.y > 1.) return vec4(0.);
@ -17,52 +58,85 @@ vec4 sample(vec2 st) {
}
void main() {
/*
A B C
D E F
G H I
*/
vec4 E = texture2D( gm_BaseTexture, v_vTexcoord );
vec2 dim = 1. / dimension;
gl_FragColor = E;
if(E.a == 0.) return;
// 0 1 2
// 3 4 5
// 6 7 8
vec4 e = E;
vec4 a4 = texture2D( gm_BaseTexture, v_vTexcoord );
vec2 tx = 1. / dimension;
gl_FragColor = a4;
vec4 A = sample( v_vTexcoord + vec2(-dim.x, dim.y) );
vec4 B = sample( v_vTexcoord + vec2( 0., dim.y) );
vec4 C = sample( v_vTexcoord + vec2( dim.x, dim.y) );
if(a4.a == 0.) return;
vec4 a0 = sample( v_vTexcoord + vec2(-tx.x, -tx.y) );
vec4 a1 = sample( v_vTexcoord + vec2( 0., -tx.y) );
vec4 a2 = sample( v_vTexcoord + vec2( tx.x, -tx.y) );
vec4 D = sample( v_vTexcoord + vec2(-dim.x, .0) );
vec4 F = sample( v_vTexcoord + vec2( dim.x, .0) );
vec4 a3 = sample( v_vTexcoord + vec2(-tx.x, .0) );
vec4 a5 = sample( v_vTexcoord + vec2( tx.x, .0) );
vec4 G = sample( v_vTexcoord + vec2(-dim.x, -dim.y) );
vec4 H = sample( v_vTexcoord + vec2( 0., -dim.y) );
vec4 I = sample( v_vTexcoord + vec2( dim.x, -dim.y) );
vec4 a6 = sample( v_vTexcoord + vec2(-tx.x, tx.y) );
vec4 a7 = sample( v_vTexcoord + vec2( 0., tx.y) );
vec4 a8 = sample( v_vTexcoord + vec2( tx.x, tx.y) );
if(sameColor(F, H) && sameColor(E, B) && sameColor(E, D) && sameColor(E, A) && !sameColor(E, C) && !sameColor(E, F) && !sameColor(E, G) && !sameColor(E, H)) {
E = I.a == 0.? F : I;
if(bright(E) < bright(e))
gl_FragColor = E;
return;
}
if(sameColor(D, H) && sameColor(E, B) && sameColor(E, C) && sameColor(E, F) && !sameColor(E, A) && !sameColor(E, D) && !sameColor(E, H) && !sameColor(E, I)) {
E = G.a == 0.? D : G;
if(bright(E) < bright(e))
gl_FragColor = E;
return;
}
if(sameColor(F, B) && sameColor(E, D) && sameColor(E, G) && sameColor(E, H) && !sameColor(E, A) && !sameColor(E, B) && !sameColor(E, F) && !sameColor(E, I)) {
E = C.a == 0.? F : C;
if(bright(E) < bright(e))
gl_FragColor = E;
return;
}
if(sameColor(D, B) && sameColor(E, F) && sameColor(E, I) && sameColor(E, H) && !sameColor(E, C) && !sameColor(E, B) && !sameColor(E, D) && !sameColor(E, G)) {
E = A.a == 0.? D : A;
if(bright(E) < bright(e))
gl_FragColor = E;
return;
if(strict == 0) {
if(s(a4, a0) && s(a4, a1) && s(a4, a3) && !s(a4, a2) && !s(a4, a5) && !s(a4, a6) && !s(a4, a7) && !s(a4, a8)) { // A A 2
// A A 5
// 6 7 8
gl_FragColor = sel3(a4, sel2(a4, a2, a6), sel2(a4, a5, a7), a8);
return;
}
if(s(a4, a1) && s(a4, a2) && s(a4, a5) && !s(a4, a0) && !s(a4, a3) && !s(a4, a6) && !s(a4, a7) && !s(a4, a8)) { // 0 A A
// 3 A A
// 6 7 8
gl_FragColor = sel3(a4, sel2(a4, a0, a8), sel2(a4, a3, a7), a6);
return;
}
if(s(a4, a3) && s(a4, a6) && s(a4, a7) && !s(a4, a0) && !s(a4, a1) && !s(a4, a2) && !s(a4, a5) && !s(a4, a8)) { // 0 1 2
// A A 5
// A A 8
gl_FragColor = sel3(a4, sel2(a4, a0, a8), sel2(a4, a1, a5), a2);
return;
}
if(s(a4, a5) && s(a4, a7) && s(a4, a8) && !s(a4, a0) && !s(a4, a1) && !s(a4, a2) && !s(a4, a3) && !s(a4, a6)) { // 0 1 2
// 3 A A
// 6 A A
gl_FragColor = sel3(a4, sel2(a4, a2, a6), sel2(a4, a1, a3), a0);
return;
}
} else if(strict == 1) {
if(s(a5, a7) && s(a4, a1) && s(a4, a3) && s(a4, a0) && !s(a4, a2) && !s(a4, a5) && !s(a4, a6) && !s(a4, a7)) { // B B C
// B B A
// C A 8
gl_FragColor = sel3(a4, sel2(a4, a2, a6), sel2(a4, a5, a7), a8);
return;
}
if(s(a3, a7) && s(a4, a1) && s(a4, a2) && s(a4, a5) && !s(a4, a0) && !s(a4, a3) && !s(a4, a7) && !s(a4, a8)) { // C B B
// A B B
// 6 A C
gl_FragColor = sel3(a4, sel2(a4, a0, a8), sel2(a4, a3, a7), a6);
return;
}
if(s(a5, a1) && s(a4, a3) && s(a4, a6) && s(a4, a7) && !s(a4, a0) && !s(a4, a1) && !s(a4, a5) && !s(a4, a8)) { // C A 2
// B B A
// B B C
gl_FragColor = sel3(a4, sel2(a4, a0, a8), sel2(a4, a1, a5), a2);
return;
}
if(s(a3, a1) && s(a4, a5) && s(a4, a8) && s(a4, a7) && !s(a4, a2) && !s(a4, a1) && !s(a4, a3) && !s(a4, a6)) { // 0 A C
// A B B
// C B B
gl_FragColor = sel3(a4, sel2(a4, a2, a6), sel2(a4, a1, a3), a0);
return;
}
}
}

View file

@ -1,41 +1,86 @@
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 dimension;
uniform vec2 dimension;
uniform float tolerance;
uniform int strict;
bool sameColor(in vec4 c1, in vec4 c2) { return length(c1.rgb * c1.a - c2.rgb * c2.a) <= tolerance; }
int sameColorInt(in vec4 c1, in vec4 c2) { return sameColor(c1, c2)? 1 : 0; }
float d(in vec4 c1, in vec4 c2) { return length(c1.rgb * c1.a - c2.rgb * c2.a) / sqrt(3.); }
bool s(in vec4 c1, in vec4 c2) { return d(c1, c2) <= tolerance; }
#region select closet color
vec4 sel2(in vec4 c, in vec4 c0, in vec4 c1) {
float d0 = d(c, c0);
float d1 = d(c, c1);
float mn = min(d0, d1);
if(mn == d0) return c0;
return c1;
}
vec4 sel3(in vec4 c, in vec4 c0, in vec4 c1, in vec4 c2) {
float d0 = d(c, c0);
float d1 = d(c, c1);
float d2 = d(c, c2);
float mn = min(min(d0, d1), d2);
if(mn == d0) return c0;
if(mn == d1) return c1;
return c2;
}
vec4 sel4(in vec4 c, in vec4 c0, in vec4 c1, in vec4 c2, in vec4 c3) {
float d0 = d(c, c0);
float d1 = d(c, c1);
float d2 = d(c, c2);
float d3 = d(c, c3);
float mn = min(min(d0, d1), min(d2, d3));
if(mn == d0) return c0;
if(mn == d1) return c1;
if(mn == d2) return c2;
return c3;
}
#endregion
void main() {
vec2 tx = 1. / dimension;
vec4 a0 = texture2D( gm_BaseTexture, v_vTexcoord + vec2(-tx.x, -tx.y));
vec4 a1 = texture2D( gm_BaseTexture, v_vTexcoord + vec2( 0., -tx.y));
vec4 a2 = texture2D( gm_BaseTexture, v_vTexcoord + vec2( tx.x, -tx.y));
vec4 a3 = texture2D( gm_BaseTexture, v_vTexcoord + vec2(-tx.x, 0.));
vec4 a4 = texture2D( gm_BaseTexture, v_vTexcoord );
vec4 a5 = texture2D( gm_BaseTexture, v_vTexcoord + vec2( tx.x, 0.));
// 0 1 2
// 3 4 5
// 6 7 8
vec4 a6 = texture2D( gm_BaseTexture, v_vTexcoord + vec2(-tx.x, tx.y));
vec4 a7 = texture2D( gm_BaseTexture, v_vTexcoord + vec2( 0., tx.y));
vec4 a8 = texture2D( gm_BaseTexture, v_vTexcoord + vec2( tx.x, tx.y));
vec4 a0 = texture2D( gm_BaseTexture, v_vTexcoord + vec2(-tx.x, -tx.y));
vec4 a1 = texture2D( gm_BaseTexture, v_vTexcoord + vec2( 0., -tx.y));
vec4 a2 = texture2D( gm_BaseTexture, v_vTexcoord + vec2( tx.x, -tx.y));
vec4 a3 = texture2D( gm_BaseTexture, v_vTexcoord + vec2(-tx.x, 0.));
vec4 a4 = texture2D( gm_BaseTexture, v_vTexcoord );
vec4 a5 = texture2D( gm_BaseTexture, v_vTexcoord + vec2( tx.x, 0.));
vec4 a6 = texture2D( gm_BaseTexture, v_vTexcoord + vec2(-tx.x, tx.y));
vec4 a7 = texture2D( gm_BaseTexture, v_vTexcoord + vec2( 0., tx.y));
vec4 a8 = texture2D( gm_BaseTexture, v_vTexcoord + vec2( tx.x, tx.y));
gl_FragColor = a4;
if(sameColor(a1, a4)) return;
if(a4.a == 0.) return;
bool sideEqual = sameColor(a1, a3) && sameColor(a1, a5) && sameColor(a1, a7);
if(!sideEqual) return;
int cornerEqual = sameColorInt(a1, a0)
+ sameColorInt(a1, a2)
+ sameColorInt(a1, a6)
+ sameColorInt(a1, a8);
if(cornerEqual == 4)
gl_FragColor = a0;
if(strict == 0) {
if(a1.a > 0. && !s(a4, a1) && s(a1, a3) && s(a1, a5)) gl_FragColor = sel3(a4, a1, a3, a5);
if(a3.a > 0. && !s(a4, a3) && s(a3, a1) && s(a3, a7)) gl_FragColor = sel3(a4, a3, a1, a7);
if(a5.a > 0. && !s(a4, a5) && s(a5, a1) && s(a5, a7)) gl_FragColor = sel3(a4, a5, a1, a7);
if(a7.a > 0. && !s(a4, a7) && s(a7, a3) && s(a7, a5)) gl_FragColor = sel3(a4, a7, a3, a5);
} else if(strict == 1) {
if(a1.a > 0. && !s(a4, a1) && s(a1, a3) && s(a1, a5) && s(a1, a7))
gl_FragColor = sel4(a4, a1, a3, a5, a7);
} else if(strict == 2) {
if(a1.a > 0. && !s(a4, a1) && s(a1, a3) && s(a1, a5) && s(a1, a7)
&& s(a1, a0) && s(a1, a2) && s(a1, a6) && s(a1, a8)
) gl_FragColor = sel4(a4, a1, a3, a5, a7);
}
}