Fixing stuff

This commit is contained in:
Tanasart 2023-07-30 19:56:53 +02:00
parent 505056612a
commit 1b7c78634c
40 changed files with 306 additions and 204 deletions

View file

@ -112,6 +112,14 @@ if !ready exit;
],, gradient);
}
bx -= ui(32);
if(buttonInstant(THEME.button_hide, bx, by, ui(28), ui(28), mouse_ui, interactable && sFOCUS, sHOVER, __txtx("gradient_editor_reverse", "Reverse"), THEME.reverse) == 2) {
for( var i = 0, n = array_length(gradient.keys); i < n; i++ )
gradient.keys[i].time = 1 - gradient.keys[i].time;
gradient.keys = array_reverse(gradient.keys);
onApply(gradient);
}
bx -= ui(32);
#endregion
draw_sprite_stretched(THEME.textbox, 3, gr_x - ui(6), gr_y - ui(6), gr_w + ui(12), gr_h + ui(12));

View file

@ -2,8 +2,8 @@
event_inherited();
#region data
dialog_w = ui(320);
dialog_h = ui(180);
dialog_w = ui(400);
dialog_h = ui(220);
destroy_on_click_out = true;
#endregion
@ -23,4 +23,8 @@ event_inherited();
PREF_MAP[? "connection_line_corner"] = max(0, real(str));
})
tb_corner.slidable = true;
tb_aa = new textBox(TEXTBOX_INPUT.number, function(str) {
PREF_MAP[? "connection_line_aa"] = max(1, real(str));
})
#endregion

View file

@ -33,4 +33,11 @@ if !ready exit;
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
draw_text(dialog_x + ui(32), yy, __txtx("dialog_connection_radius", "Corner radius"));
tb_corner.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PREF_MAP[? "connection_line_corner"], mouse_ui,, fa_right, fa_center);
yy += ui(40);
tb_aa.setFocusHover(sFOCUS, sHOVER);
tb_aa.register();
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
draw_text(dialog_x + ui(32), yy, __txtx("pref_connection_aa", "Connection anti aliasing"));
tb_aa.draw(dialog_x + dialog_w - ui(24), yy, ww, TEXTBOX_HEIGHT, PREF_MAP[? "connection_line_aa"], mouse_ui,, fa_right, fa_center);
#endregion

View file

@ -249,6 +249,17 @@ event_inherited();
]);
ds_list_add(pref_appr, __txt("Graph"));
ds_list_add(pref_appr, [
__txtx("pref_connection_type", "Connection type"),
"curve_connection_line",
new buttonGroup([ THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection, THEME.icon_curve_connection ],
function(val) {
PREF_MAP[? "curve_connection_line"] = val;
PREF_SAVE();
})
]);
ds_list_add(pref_appr, [
__txtx("pref_connection_thickness", "Connection thickness"),
"connection_line_width",
@ -418,6 +429,7 @@ event_inherited();
for(var i = 0; i < ds_list_size(current_list); i++) {
var _pref = current_list[| i];
var th = TEXTBOX_HEIGHT;
if(is_string(_pref)) {
draw_set_text(f_p0b, fa_left, fa_top, COLORS._main_text_sub);
@ -444,30 +456,22 @@ event_inherited();
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text);
draw_text(ui(8), yy + th / 2, _pref[0]);
_pref[2].setFocusHover(sFOCUS, sHOVER && sp_pref.hover);
var widget_w = ui(240);
var widget_h = th;
if(instanceof(_pref[2]) == "textBox")
widget_w = _pref[2].input == TEXTBOX_INPUT.text? ui(400) : widget_w;
var widget_x = x1 - ui(4) - widget_w;
var widget_y = yy;
var params = new widgetParam(widget_x, widget_y, widget_w, widget_h, txt, {}, _m, _r[0], _r[1]);
if(instanceof(_pref[2]) == "checkBox")
params.halign = fa_center;
switch(instanceof(_pref[2])) {
case "textBox" :
var widget_w = _pref[2].input == TEXTBOX_INPUT.text? ui(400) : ui(88);
_pref[2].draw(x1 - ui(4), yy + th / 2, widget_w, th, txt, _m,, fa_right, fa_center);
break;
case "vectorBox" :
_pref[2].draw(x1 - ui(4 + 200), yy, ui(200), th, txt, _m);
break;
case "checkBox" :
_pref[2].draw(x1 - ui(48), yy + th / 2, txt, _m,, fa_center, fa_center);
break;
case "slider" :
_pref[2].draw(x1 - ui(4), yy + th / 2, ui(200), th, txt, _m, ui(88), fa_right, fa_center);
break;
case "scrollBox" :
var _w = ui(200);
var _h = th;
_pref[2].align = fa_left;
_pref[2].draw(x1 - ui(4) - _w, yy + th / 2 - _h / 2, _w, _h, txt, _m, _r[0], _r[1]);
break;
}
var th = _pref[2].drawParam(params);
yy += th + padd + ui(8);
hh += th + padd + ui(8);
ind++;
@ -514,13 +518,13 @@ event_inherited();
var modified = false;
draw_set_text(f_p0, fa_left, fa_top);
var th = string_height("l");
var yy = _y + ui(8);
var ind = 0;
for( var i = 0, n = ds_list_size(pref_hot); i < n; i++ ) {
var _pref = pref_hot[| i];
var th = line_get_height();
var name = _pref[0];
var val = _pref[1];
@ -537,18 +541,20 @@ event_inherited();
draw_text(ui(16), yy + hh, _pref[0]);
_pref[2].setFocusHover(sFOCUS, sHOVER && sp_hotkey.hover);
var widget_w = ui(240);
var widget_h = th + (padd - ui(4)) * 2;
var widget_x = x1 - ui(4) - widget_w;
var widget_y = yy + hh - ui(4);
var params = new widgetParam(widget_x, widget_y, widget_w, widget_h, val, {}, _m, sp_hotkey.x, sp_hotkey.y);
var th = _pref[2].drawParam(params);
switch(instanceof(_pref[2])) {
case "buttonGroup" :
_pref[2].draw(x1 - ui(4 + 240), yy + ui(4), ui(240), th + (padd - ui(4)) * 2, val, _m, sp_hotkey.x, sp_hotkey.y);
break;
}
yy += th + padd + ui(8);
hh += th + padd + ui(8);
ind++;
}
for(var j = 0; j < ds_list_size(HOTKEY_CONTEXT); j++) {
var ll = HOTKEYS[? HOTKEY_CONTEXT[| j]];

View file

@ -122,6 +122,10 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
unit.triggerButton.register(parent);
}
static drawParam = function(params) {
return draw(params.x + params.w / 2, params.y + ui(40), params.data, params.extra_data, params.m);
}
static draw = function(_x, _y, _data, _extra_data, _m) {
x = _x;
y = _y;
@ -294,5 +298,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
}
resetFocus();
return h;
}
}

View file

@ -55,6 +55,10 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
return self;
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.m);
}
static draw = function(_x, _y, _w, _h, _m, spr = THEME.button, blend = c_white) {
x = _x;
y = _y;

View file

@ -52,6 +52,10 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
parentDialog.addChildren(dialog);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _color, _m) {
x = _x;
y = _y;
@ -118,6 +122,6 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
}
resetFocus();
return click;
return h;
}
}

View file

@ -19,6 +19,10 @@ function buttonGradient(_onApply, dialog = noone) : widget() constructor {
parentDialog.addChildren(dialog);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _gradient, _m) {
x = _x;
y = _y;
@ -57,6 +61,6 @@ function buttonGradient(_onApply, dialog = noone) : widget() constructor {
}
resetFocus();
return click;
return h;
}
}

View file

@ -35,6 +35,10 @@ function buttonGroup(_data, _onClick) : widget() constructor {
sb_small.register(parent);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
}
static draw = function(_x, _y, _w, _h, _selecting, _m, _rx = 0, _ry = 0) {
x = _x;
y = _y;
@ -95,5 +99,7 @@ function buttonGroup(_data, _onClick) : widget() constructor {
draw_sprite_stretched_ext(THEME.widget_selecting, 0, x - ui(3), y - ui(3), w + ui(6), h + ui(6), COLORS._main_accent, 1);
resetFocus();
return h;
}
}

View file

@ -56,6 +56,7 @@ function buttonPalette(_onApply, dialog = noone) : widget() constructor {
}
resetFocus();
return _h;
}
}

View file

@ -22,6 +22,19 @@ function checkBox(_onClick) : widget() constructor {
return t;
}
static drawParam = function(params) {
var ss = params.s;
var x0;
switch(params.halign) {
case fa_left : x0 = params.x; break;
case fa_center : x0 = params.x + (params.w - ss) / 2; break;
case fa_right : x0 = params.x + params.w - ss; break;
}
return draw(x0, params.y, params.data, params.m, params.s);
}
static draw = function(_x, _y, _value, _m, ss = ui(28), halign = fa_left, valign = fa_top) {
x = _x;
y = _y;
@ -61,5 +74,7 @@ function checkBox(_onClick) : widget() constructor {
draw_sprite_stretched_ext(THEME.widget_selecting, 0, _dx - ui(3), _dy - ui(3), ss + ui(6), ss + ui(6), COLORS._main_accent, 1);
resetFocus();
return h;
}
}

View file

@ -9,6 +9,10 @@ function checkBoxGroup(sprs, _onClick) : widget() constructor {
onClick(ind, val);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.data, params.m);
}
static draw = function(_x, _y, _value, _m, ss = ui(28), halign = fa_left, valign = fa_top) {
x = _x;
y = _y;
@ -61,5 +65,7 @@ function checkBoxGroup(sprs, _onClick) : widget() constructor {
draw_sprite_stretched_ext(THEME.widget_selecting, 0, _dx - ui(3), _dy - ui(3), ss + ui(6), ss + ui(6), COLORS._main_accent, 1);
resetFocus();
return h;
}
}

View file

@ -51,6 +51,10 @@ function controlPointBox(_onModify) : widget() constructor {
widgets[i].register(parent);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.data, params.m, params.rx, params.ry);
}
static draw = function(_x, _y, _w, _data, _m, _rx, _ry) {
x = _x;
y = _y;

View file

@ -47,6 +47,10 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor {
tb[3].register(parent);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.data, params.m);
}
static draw = function(_x, _y, _data, _m) {
x = _x;
y = _y;
@ -76,5 +80,7 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor {
b_link.draw(bx, by, ui(24), ui(24), _m, THEME.button_hide);
resetFocus();
return h;
}
}

View file

@ -12,6 +12,10 @@ function curveBox(_onModify) : widget() constructor {
static register = function() {}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _data, _m) {
x = _x; y = _y;
w = _w; h = _h;
@ -223,5 +227,7 @@ function curveBox(_onModify) : widget() constructor {
draw_rectangle(_x, _y, _x + _w, _y + _h, true);
resetFocus();
return h;
}
}

View file

@ -124,6 +124,8 @@ function draw_tooltip_atlas(atlas) {
var ww = ui(160);
var hh = amo * ui(48 + 8) - ui(8);
if(amo && is_array(atlas[0])) return;
var mx = min(mouse_mx + ui(16), WIN_W - (ww + ui(16)));
var my = min(mouse_my + ui(16), WIN_H - (hh + ui(16)));

View file

@ -24,6 +24,10 @@ function fontScrollBox(_onModify) : widget() constructor {
extra_button.interactable = interactable;
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
}
static draw = function(_x, _y, _w, _h, _text, _m = mouse_ui, _rx = 0, _ry = 0) {
x = _x;
y = _y;
@ -70,5 +74,7 @@ function fontScrollBox(_onModify) : widget() constructor {
draw_sprite_stretched_ext(THEME.widget_selecting, 0, _x - ui(3), _y - ui(3), _w + ui(6), _h + ui(6), COLORS._main_accent, 1);
resetFocus();
return h;
}
}

View file

@ -67,6 +67,10 @@ function matrixGrid(_type, _onModify, _unit = noone) : widget() constructor {
tb[i].slide_speed = speed;
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _data, _m) {
x = _x;
y = _y;

View file

@ -72,7 +72,7 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
if(global_var)
if(string_pos(" ", jun.name)) cc = COLORS._main_value_negative;
draw_set_text(f_p0, fa_left, fa_center, cc);
draw_set_text(lineBreak? f_p0 : f_p1, fa_left, fa_center, cc);
draw_text_add(xx + ui(40), lb_y - ui(2), jun.name);
var lb_w = string_width(jun.name) + ui(32);
@ -89,6 +89,8 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
draw_sprite_ui(THEME.info, 0, tx, ty,,,, COLORS._main_icon_light, 1);
} else
draw_sprite_ui(THEME.info, 0, tx, ty,,,, COLORS._main_icon_light, 0.75);
lb_w += ui(56);
}
#endregion
@ -211,133 +213,27 @@ function drawWidget(xx, yy, ww, _m, jun, global_var = true, _hover = false, _foc
jun.editWidget.setInteract(false);
}
var param = {
x: editBoxX,
y: editBoxY,
rx: rx,
rx: ry,
w: editBoxW,
h: editBoxH,
data: jun.showValue(),
m: _m,
}
var param = new widgetParam(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), jun.extra_data, _m, rx, ry);
jun.editWidget.rx = rx;
jun.editWidget.ry = ry;
switch(jun.display_type) {
case VALUE_DISPLAY.button :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, _m);
break;
default :
switch(jun.type) {
case VALUE_TYPE.integer :
case VALUE_TYPE.float :
switch(jun.display_type) {
case VALUE_DISPLAY._default :
case VALUE_DISPLAY.range :
case VALUE_DISPLAY.vector :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m);
break;
case VALUE_DISPLAY.vector_range :
var ebH = jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m);
widH = lineBreak? ebH : ebH - lb_h;
break;
case VALUE_DISPLAY.enum_scroll :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, array_safe_get(jun.display_data, jun.showValue()), _m, rx, ry);
break;
case VALUE_DISPLAY.enum_button :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m, rx, ry);
break;
case VALUE_DISPLAY.padding :
jun.editWidget.draw(xc, _hsy + ui(32), jun.showValue(), _m);
widH = ui(192);
break;
case VALUE_DISPLAY.corner :
jun.editWidget.draw(xc, _hsy + ui(32), jun.showValue(), _m);
widH = ui(192);
break;
case VALUE_DISPLAY.rotation :
case VALUE_DISPLAY.rotation_range :
jun.editWidget.draw(xc, _hsy, jun.showValue(), _m);
widH = jun.editWidget.h;
break;
case VALUE_DISPLAY.slider :
case VALUE_DISPLAY.slider_range :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m);
break;
case VALUE_DISPLAY.area :
jun.editWidget.draw(xc, _hsy + ui(40), jun.showValue(), jun.extra_data, _m);
widH = ui(204);
break;
case VALUE_DISPLAY.puppet_control :
widH = jun.editWidget.draw(editBoxX, editBoxY, editBoxW, jun.showValue(), _m, rx, ry);
break;
case VALUE_DISPLAY.kernel :
var ebH = jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m);
widH = lineBreak? ebH : ebH - lb_h;
break;
case VALUE_DISPLAY.transform :
widH = jun.editWidget.drawParam(param);
break;
}
break;
case VALUE_TYPE.boolean :
editBoxX = lineBreak? editBoxX : (labelWidth + con_w) / 2;
jun.editWidget.draw(editBoxX, editBoxY, jun.showValue(), _m, editBoxH);
break;
case VALUE_TYPE.color :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m);
break;
case VALUE_TYPE.gradient :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m);
break;
case VALUE_TYPE.path :
switch(jun.display_type) {
case VALUE_DISPLAY.path_load :
case VALUE_DISPLAY.path_save :
case VALUE_DISPLAY.path_array :
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m);
break;
case VALUE_DISPLAY.path_font :
var val = jun.showValue();
if(file_exists(val))
val = filename_name(val);
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, val, _m, rx, ry);
break;
}
break;
case VALUE_TYPE.surface :
editBoxH = ui(96);
jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m, rx, ry);
widH = lineBreak? editBoxH : editBoxH - lb_h;
break;
case VALUE_TYPE.curve :
editBoxH = ui(160);
jun.editWidget.draw(ui(32), _hsy, ww - ui(16), editBoxH, jun.showValue(), _m);
if(point_in_rectangle(_m[0], _m[1], ui(32), _hsy, ui(32) + ww - ui(16), _hsy + editBoxH))
mbRight = false;
widH = editBoxH;
break;
case VALUE_TYPE.text :
var _hh = 0;
switch(instanceof(jun.editWidget)) {
case "textBox":
_hh = jun.editWidget.draw(editBoxX, editBoxY, editBoxW, editBoxH, jun.showValue(), _m, jun.display_type);
break;
case "textArea":
_hh = jun.editWidget.draw(ui(16), _hsy, ww, editBoxH, jun.showValue(), _m, jun.display_type);
break;
case "textArrayBox":
_hh = jun.editWidget.draw(ui(16), editBoxY, editBoxW, editBoxH, _m, rx, ry);
break;
}
widH = _hh;
break;
switch(jun.type) {
case VALUE_TYPE.integer :
case VALUE_TYPE.float :
switch(jun.display_type) {
case VALUE_DISPLAY.padding : param.h = ui(192); break;
case VALUE_DISPLAY.corner : param.h = ui(192); break;
case VALUE_DISPLAY.area : param.h = ui(204); break;
}
break;
case VALUE_TYPE.boolean : param.halign = lineBreak? fa_left : fa_center;
case VALUE_TYPE.surface : param.h = ui(96); break;
case VALUE_TYPE.curve : param.h = ui(160);
if(point_in_rectangle(_m[0], _m[1], ui(32), _hsy, ui(32) + ww - ui(16), _hsy + editBoxH))
mbRight = false;
break;
}
widH = jun.editWidget.drawParam(param) - (TEXTBOX_HEIGHT * !lineBreak);
} else if(jun.display_type == VALUE_DISPLAY.label) {
draw_set_text(f_p1, fa_left, fa_top, COLORS._main_text_sub);
draw_text_add(xx + ui(16), _hsy, jun.display_data);

View file

@ -667,7 +667,9 @@ function Node_Composite(_x, _y, _group = noone) : Node_Processor(_x, _y, _group)
draw_sprite_colored(THEME.anchor_rotate, _ri, a.rr[0], a.rr[1],, a.rot);
draw_sprite_colored(THEME.anchor_scale, _si, a.d3[0], a.d3[1],, a.rot);
} else if(point_in_rectangle_points(_mx, _my, a.d0[0], a.d0[1], a.d1[0], a.d1[1], a.d2[0], a.d2[1], a.d3[0], a.d3[1])) {
} else if(point_in_rectangle_points(_mx, _my, a.d0[0], a.d0[1], a.d1[0], a.d1[1], a.d2[0], a.d2[1], a.d3[0], a.d3[1]) &&
(hovering != surface_selecting || surface_selecting == noone)) {
hovering = index;
hovering_type = NODE_COMPOSE_DRAG.move;
}

View file

@ -1,5 +1,5 @@
function Node_Pack_Sprites(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
name = "Pack Sprties";
name = "Pack Sprites";
inputs[| 0] = nodeValue("Sprites", self, JUNCTION_CONNECT.input, VALUE_TYPE.surface, noone);
@ -28,11 +28,21 @@ function Node_Pack_Sprites(_x, _y, _group = noone) : Node(_x, _y, _group) constr
for( var i = 0, n = array_length(rect); i < n; i++ ) {
var r = rect[i];
var _surf = r.surface.get();
var _sx = r.position[0];
var _sy = r.position[1];
if(!is_surface(_surf)) continue;
var _sw = surface_get_width(_surf);
var _sh = surface_get_height(_surf);
draw_rectangle(
_x + _s * (r.x + spac),
_y + _s * (r.y + spac),
_x + _s * (r.x + r.w - spac),
_y + _s * (r.y + r.h - spac), true);
_x + _s * (_sx + spac),
_y + _s * (_sy + spac),
_x + _s * (_sx + _sw - spac),
_y + _s * (_sy + _sh - spac), true);
}
}

View file

@ -43,7 +43,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
outputs[| 1] = nodeValue("Atlas Data", self, JUNCTION_CONNECT.output, VALUE_TYPE.struct, [])
outputs[| 1] = nodeValue("Atlas Data", self, JUNCTION_CONNECT.output, VALUE_TYPE.atlas, [])
.setArrayDepth(1);
refreshSurface = false;
@ -204,7 +204,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
case 2 : _sy = py + (hh - _h); break;
}
_atl[i] = array_push_create(_atl[i], new spriteAtlasData(_sx, _sy, _w, _h, inpt[i], _frame));
_atl[i] = array_push_create(_atl[i], new SurfaceAtlas(inpt[i], [_sx, _sy]));
draw_surface_safe(inpt[i], _sx, _sy);
break;
@ -218,7 +218,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
case 2 : _sx = px + (ww - _w); break;
}
_atl[i] = array_push_create(_atl[i], new spriteAtlasData(_sx, _sy, _w, _h, inpt[i], _frame));
_atl[i] = array_push_create(_atl[i], new SurfaceAtlas(inpt[i], [_sx, _sy]));
draw_surface_safe(inpt[i], _sx, _sy);
break;
@ -230,7 +230,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
px = padd[2] + _col * _w + max(0, _col) * spac;
py = padd[1] + _row * _h + max(0, _row) * spac;
_atl[i] = array_push_create(_atl[i], new spriteAtlasData(px, py, _w, _h, inpt[i], _frame));
_atl[i] = array_push_create(_atl[i], new SurfaceAtlas(inpt[i], [px, py]));
draw_surface_safe(inpt[i], px, py);
break;
}
@ -364,7 +364,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
case 2 : _sy = py + (hh - _h); break;
}
array_push(_atl, new spriteAtlasData(_sx, _sy, _w, _h, inpt[i], i));
array_push(_atl, new SurfaceAtlas(inpt[i], [_sx, _sy]));
draw_surface_safe(inpt[i], _sx, _sy);
px += _w + spac;
@ -384,7 +384,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
case 2 : _sx = px + (ww - _w); break;
}
array_push(_atl, new spriteAtlasData(_sx, _sy, _w, _h, inpt[i], i));
array_push(_atl, new SurfaceAtlas(inpt[i], [_sx, _sy]));
draw_surface_safe(inpt[i], _sx, _sy);
py += _h + spac;
@ -412,7 +412,7 @@ function Node_Render_Sprite_Sheet(_x, _y, _group = noone) : Node(_x, _y, _group)
var _w = surface_get_width(inpt[index]);
var _h = surface_get_height(inpt[index]);
array_push(_atl, new spriteAtlasData(px, py, _w, _h, inpt[index], index));
array_push(_atl, new SurfaceAtlas(inpt[index], [px, py]));
draw_surface_safe(inpt[index], px, py);
px += _w + spac;

View file

@ -59,6 +59,10 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor {
tb[3].register(parent);
}
static drawParam = function(params) {
return draw(params.x + params.w / 2, params.y + ui(32), params.data, params.m);
}
static draw = function(_x, _y, _data, _m) {
x = _x;
y = _y;
@ -92,5 +96,7 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor {
}
resetFocus();
return h;
}
}

View file

@ -1640,7 +1640,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
draw_line_width(tbx + ui(12), tby - toolbar_height / 2 + ui(8), tbx + ui(12), tby + toolbar_height / 2 - ui(8), 2);
}
function drawMinimap() {
static drawMinimap = function() {
var mx1 = w - ui(8);
var my1 = h - toolbar_height - ui(8);
var mx0 = mx1 - minimap_w;
@ -1693,7 +1693,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
var nw = _node.w * ss;
var nh = _node.h * ss;
draw_set_color(n.color);
draw_set_color(_node.color);
draw_roundrect_ext(nx, ny, nx + nw, ny + nh, THEME_VALUE.minimap_corner_radius, THEME_VALUE.minimap_corner_radius, false);
}
draw_set_alpha(1);
@ -1739,7 +1739,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
}
if(pHOVER && point_in_rectangle(mx, my, mx0, my0, mx0 + ui(16), my0 + ui(16))) {
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(2), my0 + ui(2), 1, 1, 180, c_white, 0.75);
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(2), my0 + ui(2), 0.5, 0.5, 180, c_white, 0.75);
if(mouse_press(mb_left, pFOCUS)) {
minimap_dragging = true;
minimap_drag_sx = minimap_w;
@ -1748,7 +1748,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
minimap_drag_my = my;
}
} else
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(2), my0 + ui(2), 1, 1, 180, c_white, 0.3);
draw_sprite_ui(THEME.node_resize, 0, mx0 + ui(2), my0 + ui(2), 0.5, 0.5, 180, c_white, 0.3);
}
function drawContextFrame() {

View file

@ -195,16 +195,17 @@ function Panel_Inspector() : PanelContent() constructor {
var wh = 0;
var _data = PROJECT.attributes[$ param];
wh = editW.drawParam({
x: ui(16),
y: yy,
w: w - ui(16 + 48),
h: TEXTBOX_HEIGHT,
data: _data,
m: _m,
rx: rx,
ry: ry,
});
wh = editW.drawParam(new widgetParam(
ui(16),
yy,
w - ui(16 + 48),
TEXTBOX_HEIGHT,
_data,
{},
_m,
rx,
ry,
));
yy += wh + ui(8);
hh += wh + ui(8);
@ -384,14 +385,7 @@ function Panel_Inspector() : PanelContent() constructor {
draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text);
draw_text_add(ui(8), yy + hg / 2, edt[0]);
switch(instanceof(edt[2])) {
case "textBox" : edt[2].draw(wx0, yy, ww, hg, val, _m); break;
case "checkBox" : edt[2].draw(wx0 + ww / 2 - ui(28) / 2, yy + ui(2), val, _m, ui(28)); break;
case "scrollBox" :
var scBox = edt[2];
scBox.draw(wx0, yy, ww, hg, scBox.data_list[val], _m, x + contentPane.x, y + contentPane.y);
break;
}
edt[2].drawParam(new widgetParam(wx0, yy, ww, hg, val, {}, _m, x + contentPane.x, y + contentPane.y));
yy += hg + ui(8);
hh += hg + ui(8);

View file

@ -17,6 +17,10 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor {
target = other.target;
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _files, _m) {
x = _x;
y = _y;
@ -63,6 +67,6 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor {
resetFocus();
return click;
return h;
}
}

View file

@ -48,6 +48,10 @@ function rangeBox(_type, _onModify) : widget() constructor {
tb[i].register(parent);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _data, _m) {
x = _x;
y = _y;
@ -86,5 +90,7 @@ function rangeBox(_type, _onModify) : widget() constructor {
}
resetFocus();
return h;
}
}

View file

@ -24,12 +24,18 @@ function rotator(_onModify, _step = -1) : widget() constructor {
tb_value.register(parent);
}
static draw = function(_x, _y, _data, _m, draw_tb = true) {
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.data, params.m);
}
static draw = function(_x, _y, _w, _data, _m, draw_tb = true) {
x = _x;
y = _y;
w = 0;
w = _w;
h = ui(64);
_x += _w / 2;
if(!is_real(_data)) return;
var knob_y = _y + h / 2;
var _r = ui(28);
@ -91,5 +97,7 @@ function rotator(_onModify, _step = -1) : widget() constructor {
//draw_text(_x, knob_y, string(_data));
resetFocus();
return h;
}
}

View file

@ -25,12 +25,18 @@ function rotatorRange(_onModify) : widget() constructor {
tb_max.register(parent);
}
static draw = function(_x, _y, _data, _m) {
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.data, params.m);
}
static draw = function(_x, _y, _w, _data, _m) {
x = _x;
y = _y;
w = 0;
w = _w;
h = ui(64);
_x += _w / 2;
if(!is_real(_data[0])) return;
if(!is_real(_data[1])) return;
var knob_y = _y + h / 2;
@ -145,5 +151,7 @@ function rotatorRange(_onModify) : widget() constructor {
//draw_text(_x, knob_y + ui(8), string(_data[1]));
resetFocus();
return h;
}
}

View file

@ -27,13 +27,21 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
}
}
static draw = function(_x, _y, _w, _h, _text, _m = mouse_ui, _rx = 0, _ry = 0) {
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
}
static draw = function(_x, _y, _w, _h, _val, _m = mouse_ui, _rx = 0, _ry = 0) {
x = _x;
y = _y;
open_rx = _rx;
open_ry = _ry;
h = _h;
if(is_array(_text)) return;
if(is_method(data_list)) data = data_list();
else data = data_list;
var _text = is_string(_val)? _val : array_safe_get(data, _val);
curr_text = _text;
w = _w;
@ -45,7 +53,7 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
if(open) {
resetFocus();
return;
return h;
}
draw_sprite_stretched(THEME.textbox, 3, _x, _y, w, _h);
@ -84,5 +92,7 @@ function scrollBox(_data, _onModify, update_hover = true) : widget() constructor
draw_sprite_stretched_ext(THEME.widget_selecting, 0, _x - ui(3), _y - ui(3), _w + ui(6), _h + ui(6), COLORS._main_accent, 1);
resetFocus();
return h;
}
}

View file

@ -34,6 +34,10 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
tb_value.register(parent);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _data, _m, tb_w = 64, halign = fa_left, valign = fa_top) {
x = _x;
y = _y;
@ -116,5 +120,7 @@ function slider(_min, _max, _step, _onModify = noone, _onRelease = noone) : widg
}
resetFocus();
return h;
}
}

View file

@ -32,6 +32,10 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor {
tb_value_max.register(parent);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _data, _m) {
x = _x;
y = _y;
@ -98,5 +102,7 @@ function sliderRange(_min, _max, _step, _onModify) : widget() constructor {
}
resetFocus();
return h;
}
}

View file

@ -16,6 +16,10 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
}
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
}
static draw = function(_x, _y, _w, _h, _surface, _m, _rx, _ry) {
x = _x;
y = _y;
@ -79,5 +83,7 @@ function surfaceBox(_onModify, def_path = "") : widget() constructor {
}
resetFocus();
return h;
}
}

View file

@ -574,6 +574,10 @@ function textArea(_input, _onModify, _extras = noone) : textInput(_input, _onMod
}
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _text, _m) {
x = _x;
y = _y;

View file

@ -8,6 +8,10 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor {
hide = false;
open = false;
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
}
static draw = function(_x, _y, _w, _h, _m, _rx = 0, _ry = 0) {
x = _x;
y = _y;

View file

@ -317,6 +317,10 @@ function textBox(_input, _onModify, _extras = noone) : textInput(_input, _onModi
}
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m,, params.halign, params.valign);
}
static draw = function(_x, _y, _w, _h, _text = "", _m = mouse_ui, _format = VALUE_DISPLAY._default, halign = fa_left, valign = fa_top) {
x = _x;
y = _y;

View file

@ -42,6 +42,10 @@ function transformBox(_onModify) : widget() constructor {
return draw(params.x, params.y, params.w, params.data, params.m);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.data, params.m);
}
static draw = function(_x, _y, _w, _data, _m) {
x = _x;
y = _y;

View file

@ -78,6 +78,10 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _data, _m) {
x = _x;
y = _y;

View file

@ -57,6 +57,10 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
if(extras) extras.register(parent);
}
static drawParam = function(params) {
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
}
static draw = function(_x, _y, _w, _h, _data, _m) {
x = _x;
y = _y;

View file

@ -73,4 +73,21 @@ function widget() constructor {
static drawParam = function(params) {}
static draw = function() {}
}
function widgetParam(x, y, w, h, data, extra_data, m, rx = 0, ry = 0) constructor {
self.x = x;
self.y = y;
self.w = w;
self.h = h;
self.s = ui(28);
self.data = data;
self.extra_data = extra_data;
self.m = m;
self.rx = rx;
self.ry = ry;
self.halign = fa_left;
self.valign = fa_top;
}