mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-24 22:16:17 +01:00
- [Normal Light] Light position is now vec2, separate light height as a separate property.
This commit is contained in:
parent
9966fdfdb7
commit
8658db47c9
27 changed files with 337 additions and 325 deletions
|
@ -35,7 +35,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
__txtx("widget_area_two_points", "Two points"),
|
__txtx("widget_area_two_points", "Two points"),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
onModifySingle[0] = function(val) { #region
|
onModifySingle[0] = function(val) {
|
||||||
var v = toNumber(val);
|
var v = toNumber(val);
|
||||||
var m = onModify(v, 0);
|
var m = onModify(v, 0);
|
||||||
|
|
||||||
|
@ -47,9 +47,9 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
m |= onModify(v, 3);
|
m |= onModify(v, 3);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
onModifySingle[1] = function(val) { #region
|
onModifySingle[1] = function(val) {
|
||||||
var v = toNumber(val);
|
var v = toNumber(val);
|
||||||
var m = onModify(v, 1);
|
var m = onModify(v, 1);
|
||||||
|
|
||||||
|
@ -61,9 +61,9 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
m |= onModify(v, 3);
|
m |= onModify(v, 3);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
onModifySingle[2] = function(val) { #region
|
onModifySingle[2] = function(val) {
|
||||||
var v = toNumber(val);
|
var v = toNumber(val);
|
||||||
var m = onModify(v, 2);
|
var m = onModify(v, 2);
|
||||||
|
|
||||||
|
@ -75,9 +75,9 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
m |= onModify(v, 3);
|
m |= onModify(v, 3);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
onModifySingle[3] = function(val) { #region
|
onModifySingle[3] = function(val) {
|
||||||
var v = toNumber(val);
|
var v = toNumber(val);
|
||||||
var m = onModify(v, 3);
|
var m = onModify(v, 3);
|
||||||
|
|
||||||
|
@ -89,26 +89,26 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
m |= onModify(v, 2);
|
m |= onModify(v, 2);
|
||||||
|
|
||||||
return m;
|
return m;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
for(var i = 0; i < 4; i++) { #region
|
for(var i = 0; i < 4; i++) {
|
||||||
tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]);
|
tb[i] = new textBox(TEXTBOX_INPUT.number, onModifySingle[i]);
|
||||||
tb[i].slidable = true;
|
tb[i].slidable = true;
|
||||||
tb[i].hide = true;
|
tb[i].hide = true;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setSlideSpeed = function(speed) { #region
|
static setSlideSpeed = function(speed) {
|
||||||
for(var i = 0; i < 4; i++)
|
for(var i = 0; i < 4; i++)
|
||||||
tb[i].setSlidable(speed);
|
tb[i].setSlidable(speed);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setInteract = function(interactable = noone) { #region
|
static setInteract = function(interactable = noone) {
|
||||||
self.interactable = interactable;
|
self.interactable = interactable;
|
||||||
for(var i = 0; i < 4; i++)
|
for(var i = 0; i < 4; i++)
|
||||||
tb[i].interactable = interactable;
|
tb[i].interactable = interactable;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static register = function(parent = noone) { #region
|
static register = function(parent = noone) {
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case AREA_MODE.two_point :
|
case AREA_MODE.two_point :
|
||||||
case AREA_MODE.area :
|
case AREA_MODE.area :
|
||||||
|
@ -125,21 +125,21 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
|
|
||||||
if(unit != noone && unit.reference != noone)
|
if(unit != noone && unit.reference != noone)
|
||||||
unit.triggerButton.register(parent);
|
unit.triggerButton.register(parent);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isHovering = function() { #region
|
static isHovering = function() {
|
||||||
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
||||||
return false;
|
return false;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
for(var i = 0; i < 4; i++) tb[i].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);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { #region
|
static draw = function(_x, _y, _w, _h, _data, _display_data, _m) {
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -172,7 +172,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
var _bx = _x + _w - _bs;
|
var _bx = _x + _w - _bs;
|
||||||
var _by = _y + _h / 2 - _bs / 2;
|
var _by = _y + _h / 2 - _bs / 2;
|
||||||
|
|
||||||
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, tooltip, THEME.inspector_area_type, mode) == 2) { #region
|
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, tooltip, THEME.inspector_area_type, mode) == 2) {
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case AREA_MODE.area : //area to padding
|
case AREA_MODE.area : //area to padding
|
||||||
var cx = array_safe_get_fast(_data, 0);
|
var cx = array_safe_get_fast(_data, 0);
|
||||||
|
@ -214,13 +214,13 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
onModify((mode + 1) % 3, 5);
|
onModify((mode + 1) % 3, 5);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
var _bx = _x + _w - _bs;
|
var _bx = _x + _w - _bs;
|
||||||
var _by = _y + _h + ui(4) + _h / 2 - _bs / 2;
|
var _by = _y + _h + ui(4) + _h / 2 - _bs / 2;
|
||||||
var _btxt = __txtx("widget_area_fill_surface", "Fill surface");
|
var _btxt = __txtx("widget_area_fill_surface", "Fill surface");
|
||||||
|
|
||||||
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, _btxt, THEME.fill, 0) == 2) { #region
|
if(buttonInstant(THEME.button_hide, _bx, _by, _bs, _bs, _m, active, hover, _btxt, THEME.fill, 0) == 2) {
|
||||||
var cnvt = unit != noone && unit.mode == VALUE_UNIT.reference;
|
var cnvt = unit != noone && unit.mode == VALUE_UNIT.reference;
|
||||||
|
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
|
@ -246,12 +246,12 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
onModify(cnvt? 1 : ss[1], 3);
|
onModify(cnvt? 1 : ss[1], 3);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
_w -= _bs + ui(4);
|
_w -= _bs + ui(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_w - _bs > ui(100)) { #region
|
if(_w - _bs > ui(100)) {
|
||||||
var _bx = _x;
|
var _bx = _x;
|
||||||
var _by = _y + _h / 2 - _bs / 2;
|
var _by = _y + _h / 2 - _bs / 2;
|
||||||
|
|
||||||
|
@ -274,13 +274,13 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
_x +=_bs + ui(4);
|
_x +=_bs + ui(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
for(var i = 0; i < 4; i++)
|
for(var i = 0; i < 4; i++)
|
||||||
tb[i].setFocusHover(active, hover);
|
tb[i].setFocusHover(active, hover);
|
||||||
|
@ -290,7 +290,7 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
var tb_w = _w / 2;
|
var tb_w = _w / 2;
|
||||||
var tb_h = _h;
|
var tb_h = _h;
|
||||||
|
|
||||||
if(mode == AREA_MODE.area) { #region
|
if(mode == AREA_MODE.area) {
|
||||||
var tb_x0 = _x;
|
var tb_x0 = _x;
|
||||||
var tb_y0 = _y;
|
var tb_y0 = _y;
|
||||||
|
|
||||||
|
@ -308,9 +308,9 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
|
|
||||||
tb[2].draw(tb_x0, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 2), _m);
|
tb[2].draw(tb_x0, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 2), _m);
|
||||||
tb[3].draw(tb_x1, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 3), _m);
|
tb[3].draw(tb_x1, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 3), _m);
|
||||||
#endregion
|
|
||||||
|
|
||||||
} else if(mode == AREA_MODE.padding) { #region
|
|
||||||
|
} else if(mode == AREA_MODE.padding) {
|
||||||
var tb_lx = _x;
|
var tb_lx = _x;
|
||||||
var tb_ly = _y;
|
var tb_ly = _y;
|
||||||
|
|
||||||
|
@ -334,9 +334,9 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
|
|
||||||
tb[1].draw(tb_tx, tb_ty, tb_w, tb_h, array_safe_get_fast(_data, 1), _m);
|
tb[1].draw(tb_tx, tb_ty, tb_w, tb_h, array_safe_get_fast(_data, 1), _m);
|
||||||
tb[3].draw(tb_bx, tb_by, tb_w, tb_h, array_safe_get_fast(_data, 3), _m);
|
tb[3].draw(tb_bx, tb_by, tb_w, tb_h, array_safe_get_fast(_data, 3), _m);
|
||||||
#endregion
|
|
||||||
|
|
||||||
} else if(mode == AREA_MODE.two_point) { #region
|
|
||||||
|
} else if(mode == AREA_MODE.two_point) {
|
||||||
var tb_x0 = _x;
|
var tb_x0 = _x;
|
||||||
var tb_y0 = _y;
|
var tb_y0 = _y;
|
||||||
|
|
||||||
|
@ -354,17 +354,17 @@ function areaBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
|
|
||||||
tb[2].draw(tb_x0, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 2), _m);
|
tb[2].draw(tb_x0, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 2), _m);
|
||||||
tb[3].draw(tb_x1, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 3), _m);
|
tb[3].draw(tb_x1, tb_y1, tb_w, tb_h, array_safe_get_fast(_data, 3), _m);
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetFocus();
|
resetFocus();
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new areaBox(onModify, unit);
|
var cln = new areaBox(onModify, unit);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -19,56 +19,56 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
|
||||||
toggled = false;
|
toggled = false;
|
||||||
context = noone;
|
context = noone;
|
||||||
|
|
||||||
static setContext = function(struct) { #region
|
static setContext = function(struct) {
|
||||||
onClick = method(struct, onClick);
|
onClick = method(struct, onClick);
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setLua = function(_lua_thread, _lua_key, _lua_func) { #region
|
static setLua = function(_lua_thread, _lua_key, _lua_func) {
|
||||||
lua_thread = _lua_thread;
|
lua_thread = _lua_thread;
|
||||||
lua_thread_key = _lua_key;
|
lua_thread_key = _lua_key;
|
||||||
onClick = method(self, _lua_func);
|
onClick = method(self, _lua_func);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static trigger = function() { #region
|
static trigger = function() {
|
||||||
clicked = true;
|
clicked = true;
|
||||||
|
|
||||||
if(!is_callable(onClick))
|
if(!is_callable(onClick))
|
||||||
return noone;
|
return noone;
|
||||||
triggered = true;
|
triggered = true;
|
||||||
onClick();
|
onClick();
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isTriggered = function() { #region
|
static isTriggered = function() {
|
||||||
var t = triggered;
|
var t = triggered;
|
||||||
triggered = false;
|
triggered = false;
|
||||||
return t;
|
return t;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setIcon = function(_icon, _index = 0, _blend = c_white) { #region
|
static setIcon = function(_icon, _index = 0, _blend = c_white) {
|
||||||
icon = _icon;
|
icon = _icon;
|
||||||
icon_index = _index;
|
icon_index = _index;
|
||||||
icon_blend = _blend;
|
icon_blend = _blend;
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setText = function(_text) { #region
|
static setText = function(_text) {
|
||||||
text = _text;
|
text = _text;
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setTooltip = function(_tip) { #region
|
static setTooltip = function(_tip) {
|
||||||
tooltip = _tip;
|
tooltip = _tip;
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
|
|
||||||
return draw(params.x, params.y, params.w, params.h, params.m);
|
return draw(params.x, params.y, params.w, params.h, params.m);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _m, spr = THEME.button_def, blend = c_white) { #region
|
static draw = function(_x, _y, _w, _h, _m, spr = THEME.button_def, blend = c_white) {
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -120,9 +120,9 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
|
||||||
if(mouse_release(mb_left)) pressed = false;
|
if(mouse_release(mb_left)) pressed = false;
|
||||||
|
|
||||||
return _h;
|
return _h;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new buttonClass(onClick);
|
var cln = new buttonClass(onClick);
|
||||||
|
|
||||||
cln.icon = icon;
|
cln.icon = icon;
|
||||||
|
@ -134,7 +134,7 @@ function buttonClass(_onClick, _icon = noone) : widget() constructor {
|
||||||
cln.blend = blend;
|
cln.blend = blend;
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_index = 0, _icon_blend = COLORS._main_icon, _icon_alpha = 1, _icon_scale = 1) {
|
function buttonInstant(spr, _x, _y, _w, _h, _m, _act, _hvr, _tip = "", _icon = noone, _icon_index = 0, _icon_blend = COLORS._main_icon, _icon_alpha = 1, _icon_scale = 1) {
|
||||||
|
|
|
@ -111,17 +111,17 @@ function buttonColor(_onApply, dialog = noone) : widget() constructor {
|
||||||
var hoverRect = ihover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _bww, _y + _h);
|
var hoverRect = ihover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _bww, _y + _h);
|
||||||
|
|
||||||
if(hoverRect) {
|
if(hoverRect) {
|
||||||
draw_sprite_stretched(THEME.button_def, 1, _x, _y, _cw, _h);
|
draw_sprite_stretched_ext(THEME.button_def, 1, _x, _y, _cw, _h, boxColor);
|
||||||
|
|
||||||
if(mouse_press(mb_left, iactive))
|
if(mouse_press(mb_left, iactive))
|
||||||
trigger();
|
trigger();
|
||||||
|
|
||||||
if(mouse_click(mb_left, iactive)) {
|
if(mouse_click(mb_left, iactive)) {
|
||||||
draw_sprite_stretched(THEME.button_def, 2, _x, _y, _cw, _h);
|
draw_sprite_stretched_ext(THEME.button_def, 2, _x, _y, _cw, _h, boxColor);
|
||||||
draw_sprite_stretched_ext(THEME.button_def, 3, _x, _y, _cw, _h, COLORS._main_accent, 1);
|
draw_sprite_stretched_ext(THEME.button_def, 3, _x, _y, _cw, _h, COLORS._main_accent);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
draw_sprite_stretched(THEME.button_def, 0, _x, _y, _cw, _h);
|
draw_sprite_stretched_ext(THEME.button_def, 0, _x, _y, _cw, _h, boxColor);
|
||||||
if(mouse_press(mb_left)) deactivate();
|
if(mouse_press(mb_left)) deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,16 +91,16 @@ function buttonGradient(_onApply, dialog = noone) : widget() constructor {
|
||||||
h = _h + ui(22);
|
h = _h + ui(22);
|
||||||
|
|
||||||
if(hoverRect) {
|
if(hoverRect) {
|
||||||
draw_sprite_stretched(THEME.button_def, 1, _x, _y, _w, h);
|
draw_sprite_stretched_ext(THEME.button_def, 1, _x, _y, _w, h, boxColor);
|
||||||
if(mouse_press(mb_left, iactive))
|
if(mouse_press(mb_left, iactive))
|
||||||
trigger();
|
trigger();
|
||||||
|
|
||||||
if(mouse_click(mb_left, iactive)) {
|
if(mouse_click(mb_left, iactive)) {
|
||||||
draw_sprite_stretched(THEME.button_def, 2, _x, _y, _w, h);
|
draw_sprite_stretched_ext(THEME.button_def, 2, _x, _y, _w, h, boxColor);
|
||||||
draw_sprite_stretched_ext(THEME.button_def, 3, _x, _y, _w, h, COLORS._main_accent, 1);
|
draw_sprite_stretched_ext(THEME.button_def, 3, _x, _y, _w, h, COLORS._main_accent, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
draw_sprite_stretched(THEME.button_def, 0, _x, _y, _w, h);
|
draw_sprite_stretched_ext(THEME.button_def, 0, _x, _y, _w, h, boxColor);
|
||||||
if(mouse_press(mb_left)) deactivate();
|
if(mouse_press(mb_left)) deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,9 @@ function buttonGroup(_data, _onClick) : widget() constructor {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
sb_small.setParam(params);
|
sb_small.setParam(params);
|
||||||
|
|
||||||
|
for(var i = 0; i < array_length(data); i++)
|
||||||
|
buttons[i].setParam(params);
|
||||||
|
|
||||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +108,7 @@ function buttonGroup(_data, _onClick) : widget() constructor {
|
||||||
var spr = i == 0 ? buttonSpr[0] : (i == amo - 1? buttonSpr[2] : buttonSpr[1]);
|
var spr = i == 0 ? buttonSpr[0] : (i == amo - 1? buttonSpr[2] : buttonSpr[1]);
|
||||||
|
|
||||||
if(_selecting == i) {
|
if(_selecting == i) {
|
||||||
draw_sprite_stretched(spr, 2, floor(bx), _y, ceil(bww), _h);
|
draw_sprite_stretched_ext(spr, 2, floor(bx), _y, ceil(bww), _h, boxColor);
|
||||||
draw_sel = [spr, bx];
|
draw_sel = [spr, bx];
|
||||||
} else {
|
} else {
|
||||||
buttons[i].draw(floor(bx), _y, ceil(bww), _h, _m, spr);
|
buttons[i].draw(floor(bx), _y, ceil(bww), _h, _m, spr);
|
||||||
|
|
|
@ -86,16 +86,16 @@ function buttonPalette(_onApply, dialog = noone) : widget() constructor {
|
||||||
h = _h + array_length(_color) * _colr_h + ui(2);
|
h = _h + array_length(_color) * _colr_h + ui(2);
|
||||||
|
|
||||||
if(hoverRect) {
|
if(hoverRect) {
|
||||||
draw_sprite_stretched(THEME.button_def, 1, _x, _y, _w, h);
|
draw_sprite_stretched_ext(THEME.button_def, 1, _x, _y, _w, h, boxColor);
|
||||||
if(mouse_press(mb_left, iactive))
|
if(mouse_press(mb_left, iactive))
|
||||||
trigger();
|
trigger();
|
||||||
|
|
||||||
if(mouse_click(mb_left, iactive)) {
|
if(mouse_click(mb_left, iactive)) {
|
||||||
draw_sprite_stretched(THEME.button_def, 2, _x, _y, _w, h);
|
draw_sprite_stretched_ext(THEME.button_def, 2, _x, _y, _w, h, boxColor);
|
||||||
draw_sprite_stretched_ext(THEME.button_def, 3, _x, _y, _w, h, COLORS._main_accent, 1);
|
draw_sprite_stretched_ext(THEME.button_def, 3, _x, _y, _w, h, COLORS._main_accent, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
draw_sprite_stretched(THEME.button_def, 0, _x, _y, _w, h);
|
draw_sprite_stretched_ext(THEME.button_def, 0, _x, _y, _w, h, boxColor);
|
||||||
if(mouse_press(mb_left)) deactivate();
|
if(mouse_press(mb_left)) deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ function controlPointBox(_onModify) : widget() constructor {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
tbCx.setParam(params);
|
tbCx.setParam(params);
|
||||||
tbCy.setParam(params);
|
tbCy.setParam(params);
|
||||||
|
@ -74,7 +74,7 @@ function controlPointBox(_onModify) : widget() constructor {
|
||||||
scMode.setParam(params);
|
scMode.setParam(params);
|
||||||
|
|
||||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.rx, params.ry);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _data, _m, _rx, _ry) {
|
static draw = function(_x, _y, _w, _h, _data, _m, _rx, _ry) {
|
||||||
x = _x;
|
x = _x;
|
||||||
|
@ -101,8 +101,8 @@ function controlPointBox(_onModify) : widget() constructor {
|
||||||
var _ww = _w / 2;
|
var _ww = _w / 2;
|
||||||
var _wh = _h;
|
var _wh = _h;
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
tbCx.draw(_x, yy, _ww, _wh, _cx, _m);
|
tbCx.draw(_x, yy, _ww, _wh, _cx, _m);
|
||||||
tbCy.draw(_x + _ww, yy, _ww, _wh, _cy, _m);
|
tbCy.draw(_x + _ww, yy, _ww, _wh, _cy, _m);
|
||||||
|
@ -112,8 +112,8 @@ function controlPointBox(_onModify) : widget() constructor {
|
||||||
case PUPPET_FORCE_MODE.move:
|
case PUPPET_FORCE_MODE.move:
|
||||||
case PUPPET_FORCE_MODE.puppet:
|
case PUPPET_FORCE_MODE.puppet:
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
tbFx.label = "fx";
|
tbFx.label = "fx";
|
||||||
tbFy.label = "fy";
|
tbFy.label = "fy";
|
||||||
|
@ -132,8 +132,8 @@ function controlPointBox(_onModify) : widget() constructor {
|
||||||
|
|
||||||
case PUPPET_FORCE_MODE.wind:
|
case PUPPET_FORCE_MODE.wind:
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, yy, _w, _wh, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, yy, _w, _wh, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
tbFx.label = __txt("strength");
|
tbFx.label = __txt("strength");
|
||||||
tbW.label = __txt("width");
|
tbW.label = __txt("width");
|
||||||
|
@ -151,9 +151,9 @@ function controlPointBox(_onModify) : widget() constructor {
|
||||||
return yy - _y;
|
return yy - _y;
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new controlPointBox(onModify);
|
var cln = new controlPointBox(onModify);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -88,11 +88,11 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
_x += _bs + ui(4);
|
_x += _bs + ui(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
var tb_w = _w / 2;
|
var tb_w = _w / 2;
|
||||||
var tb_h = _h;
|
var tb_h = _h;
|
||||||
|
@ -120,9 +120,9 @@ function cornerBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new cornerBox(onModify, unit);
|
var cln = new cornerBox(onModify, unit);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -129,8 +129,8 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct
|
||||||
|
|
||||||
var ww = _w / size;
|
var ww = _w / size;
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, ww * size, _h * size, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, ww * size, _h * size, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, ww * size, _h * size, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, ww * size, _h * size, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
for(var i = 0; i < size; i++)
|
for(var i = 0; i < size; i++)
|
||||||
for(var j = 0; j < size; j++) {
|
for(var j = 0; j < size; j++) {
|
||||||
|
@ -150,9 +150,9 @@ function matrixGrid(_type, _size, _onModify, _unit = noone) : widget() construct
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new matrixGrid(type, size, onModify, unit);
|
var cln = new matrixGrid(type, size, onModify, unit);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
global.loop_nodes = [ "Node_Iterate", "Node_Iterate_Each" ];
|
global.loop_nodes = [ "Node_Iterate", "Node_Iterate_Each" ];
|
||||||
|
|
||||||
#macro INAME internalName == ""? name : internalName
|
#macro INAME internalName == ""? name : internalName
|
||||||
|
#macro SHOW_PARAM (show_parameter && previewable)
|
||||||
|
|
||||||
enum CACHE_USE {
|
enum CACHE_USE {
|
||||||
none,
|
none,
|
||||||
|
@ -94,11 +95,12 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
y = _y;
|
y = _y;
|
||||||
|
|
||||||
name_height = 16;
|
name_height = 16;
|
||||||
w = 128;
|
w = 128;
|
||||||
h = 128;
|
h = 128;
|
||||||
min_w = w;
|
min_w = w;
|
||||||
min_h = name_height;
|
min_h = name_height;
|
||||||
fix_h = h;
|
con_h = 0;
|
||||||
|
|
||||||
h_param = h;
|
h_param = h;
|
||||||
will_setHeight = false;
|
will_setHeight = false;
|
||||||
|
|
||||||
|
@ -618,17 +620,17 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
} run_in(1, function() /*=>*/ { updateIO() });
|
} run_in(1, function() /*=>*/ { updateIO() });
|
||||||
|
|
||||||
static setHeight = function() {
|
static setHeight = function() {
|
||||||
w = show_parameter? attributes.node_param_width : min_w;
|
w = SHOW_PARAM? attributes.node_param_width : min_w;
|
||||||
|
|
||||||
if(!auto_height) return;
|
if(!auto_height) return;
|
||||||
junction_draw_hei_y = show_parameter? 32 : 24;
|
junction_draw_hei_y = SHOW_PARAM? 32 : 24;
|
||||||
junction_draw_pad_y = show_parameter? min_h : 32;
|
junction_draw_pad_y = SHOW_PARAM? min_h : 32;
|
||||||
|
|
||||||
var _hi, _ho;
|
var _hi, _ho;
|
||||||
|
|
||||||
if(previewable) {
|
if(previewable) {
|
||||||
_hi = junction_draw_pad_y + show_parameter * 4;
|
_hi = junction_draw_pad_y + SHOW_PARAM * 4;
|
||||||
_ho = junction_draw_pad_y + show_parameter * 4;
|
_ho = junction_draw_pad_y + SHOW_PARAM * 4;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
junction_draw_hei_y = 16;
|
junction_draw_hei_y = 16;
|
||||||
|
@ -667,8 +669,6 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
h = max(min_h, _prev_surf * 128, _hi, _ho);
|
h = max(min_h, _prev_surf * 128, _hi, _ho);
|
||||||
if(attributes.node_height) h = max(h, attributes.node_height);
|
if(attributes.node_height) h = max(h, attributes.node_height);
|
||||||
|
|
||||||
fix_h = h;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static getJunctionList = function() { #region ////getJunctionList
|
static getJunctionList = function() { #region ////getJunctionList
|
||||||
|
@ -1145,7 +1145,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
out_cache_len = ds_list_size(outputs);
|
out_cache_len = ds_list_size(outputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
var _iny = yy + (junction_draw_pad_y + junction_draw_hei_y * 0.5 * show_parameter) * _s;
|
var _iny = yy + (junction_draw_pad_y + junction_draw_hei_y * 0.5 * SHOW_PARAM) * _s;
|
||||||
|
|
||||||
for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) {
|
for( var i = 0, n = ds_list_size(inputs); i < n; i++ ) {
|
||||||
jun = inputs[| i];
|
jun = inputs[| i];
|
||||||
|
@ -1162,7 +1162,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
xx = xx + w * _s;
|
xx = xx + w * _s;
|
||||||
var _outy = yy + (junction_draw_pad_y + junction_draw_hei_y * 0.5 * show_parameter) * _s;
|
var _outy = yy + (junction_draw_pad_y + junction_draw_hei_y * 0.5 * SHOW_PARAM) * _s;
|
||||||
|
|
||||||
for(var i = 0; i < outputs_amount; i++) {
|
for(var i = 0; i < outputs_amount; i++) {
|
||||||
var idx = outputs_index[i];
|
var idx = outputs_index[i];
|
||||||
|
@ -1173,7 +1173,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
_outy += junction_draw_hei_y * _s * jun.isVisible();
|
_outy += junction_draw_hei_y * _s * jun.isVisible();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(show_parameter) h = h_param;
|
if(SHOW_PARAM) h = h_param;
|
||||||
|
|
||||||
onPreDraw(_x, _y, _s, _iny, _outy);
|
onPreDraw(_x, _y, _s, _iny, _outy);
|
||||||
}
|
}
|
||||||
|
@ -1196,25 +1196,32 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
static drawGetBbox = function(xx, yy, _s) {
|
static drawGetBbox = function(xx, yy, _s) {
|
||||||
var pad_label = draw_name && display_parameter.avoid_label;
|
var pad_label = draw_name && display_parameter.avoid_label;
|
||||||
|
|
||||||
var _w = w;
|
var x0 = xx;
|
||||||
var _h = show_parameter? min_h : h;
|
var x1 = xx + w * _s;
|
||||||
|
var y0 = yy;
|
||||||
|
var y1 = yy + h * _s;
|
||||||
|
|
||||||
_w *= _s;
|
if(pad_label) y0 += name_height * _s;
|
||||||
_h *= _s;
|
if(SHOW_PARAM) y1 = yy + con_h * _s;
|
||||||
|
|
||||||
_w -= max(draw_padding, draw_pad_w) * 2;
|
x0 += max(draw_padding, draw_pad_w);
|
||||||
_h -= max(draw_padding, draw_pad_h) * 2 + name_height * _s * pad_label;
|
x1 -= max(draw_padding, draw_pad_w);
|
||||||
|
y0 += max(draw_padding, draw_pad_h);
|
||||||
|
y1 -= max(draw_padding, draw_pad_h);
|
||||||
|
|
||||||
var _xc = xx + w * _s / 2;
|
var _w = x1 - x0;
|
||||||
var _yc = yy + _h / 2 + pad_label * name_height * _s + draw_padding;
|
var _h = y1 - y0;
|
||||||
|
|
||||||
|
var _xc = (x0 + x1) / 2;
|
||||||
|
var _yc = (y0 + y1) / 2;
|
||||||
|
|
||||||
_w *= display_parameter.preview_scale / 100;
|
_w *= display_parameter.preview_scale / 100;
|
||||||
_h *= display_parameter.preview_scale / 100;
|
_h *= display_parameter.preview_scale / 100;
|
||||||
|
|
||||||
var x0 = _xc - _w / 2;
|
x0 = _xc - _w / 2;
|
||||||
var x1 = _xc + _w / 2;
|
x1 = _xc + _w / 2;
|
||||||
var y0 = _yc - _h / 2;
|
y0 = _yc - _h / 2;
|
||||||
var y1 = _yc + _h / 2;
|
y1 = _yc + _h / 2;
|
||||||
|
|
||||||
return __draw_bbox.fromPoints(x0, y0, x1, y1);
|
return __draw_bbox.fromPoints(x0, y0, x1, y1);
|
||||||
}
|
}
|
||||||
|
@ -1272,12 +1279,10 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
var rx = PANEL_GRAPH.x;
|
var rx = PANEL_GRAPH.x;
|
||||||
var ry = PANEL_GRAPH.y;
|
var ry = PANEL_GRAPH.y;
|
||||||
|
|
||||||
var jy = _y + junction_draw_pad_y * _s + wh / 2;
|
var jy = _y + con_h * _s + wh / 2;
|
||||||
|
|
||||||
var boundH = _x > draw_boundary[0] - w * _s && _x < draw_boundary[2];
|
var extY = 0;
|
||||||
var boundV = 1;//_y > draw_boundary[1] - h * _s && _y < draw_boundary[3];
|
var drwT = _s > 0.5;
|
||||||
var extY = 0;
|
|
||||||
var drawText = _s > 0.5;
|
|
||||||
|
|
||||||
for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
|
for(var i = 0, n = array_length(inputDisplayList); i < n; i++) {
|
||||||
var jun = inputDisplayList[i];
|
var jun = inputDisplayList[i];
|
||||||
|
@ -1285,7 +1290,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
|
|
||||||
jun.y = jy;
|
jun.y = jy;
|
||||||
|
|
||||||
if(drawText) {
|
if(drwT) {
|
||||||
draw_set_text(f_sdf, fa_left, fa_center, jun.color_display);
|
draw_set_text(f_sdf, fa_left, fa_center, jun.color_display);
|
||||||
draw_text_add(lx, jun.y, jun.getName(), _s * 0.25);
|
draw_text_add(lx, jun.y, jun.getName(), _s * 0.25);
|
||||||
|
|
||||||
|
@ -1312,6 +1317,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
_param.ry = ry;
|
_param.ry = ry;
|
||||||
_param.s = wh;
|
_param.s = wh;
|
||||||
_param.font = f_p2;
|
_param.font = f_p2;
|
||||||
|
_param.color = getColor();
|
||||||
|
|
||||||
if(is_instanceof(jun, checkBox))
|
if(is_instanceof(jun, checkBox))
|
||||||
_param.halign = fa_center;
|
_param.halign = fa_center;
|
||||||
|
@ -1321,14 +1327,13 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
var _h = wd.drawParam(_param);
|
var _h = wd.drawParam(_param);
|
||||||
jun.graphWidgetH = _h / _s;
|
jun.graphWidgetH = _h / _s;
|
||||||
|
|
||||||
extY += max(0, (jun.graphWidgetH + 4) - junction_draw_hei_y);
|
extY += max(0, jun.graphWidgetH + 4);
|
||||||
|
jy += (jun.graphWidgetH + 4) * _s;
|
||||||
|
|
||||||
if(wd.isHovering()) draggable = false;
|
if(wd.isHovering()) draggable = false;
|
||||||
|
|
||||||
jy += (jun.graphWidgetH + 4) * _s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h = fix_h + extY;
|
h = con_h + extY + 4;
|
||||||
h_param = h;
|
h_param = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1718,7 +1723,7 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
catch(e) { log_warning("NODE onDrawNode", exception_print(e)); }
|
catch(e) { log_warning("NODE onDrawNode", exception_print(e)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if(show_parameter) drawJunctionWidget(xx, yy, _mx, _my, _s, _hover, _focus);
|
if(SHOW_PARAM) drawJunctionWidget(xx, yy, _mx, _my, _s, _hover, _focus);
|
||||||
|
|
||||||
draw_name = false;
|
draw_name = false;
|
||||||
if((previewable && _s >= 0.75) || (!previewable && h * _s >= name_height * .5)) drawNodeName(xx, yy, _s);
|
if((previewable && _s >= 0.75) || (!previewable && h * _s >= name_height * .5)) drawNodeName(xx, yy, _s);
|
||||||
|
@ -2298,13 +2303,9 @@ function Node(_x, _y, _group = noone) : __Node_Base(_x, _y) constructor {
|
||||||
INLINE
|
INLINE
|
||||||
|
|
||||||
min_w = _w;
|
min_w = _w;
|
||||||
min_h = _h;
|
con_h = _h;
|
||||||
min_h = name_height; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
if(_apply) {
|
if(_apply) { w = _w; h = _h; }
|
||||||
w = _w;
|
|
||||||
h = _h;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static move = function(_x, _y, _s) {
|
static move = function(_x, _y, _s) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
||||||
|
|
||||||
inputs[| 3] = nodeValue("Ambient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);
|
inputs[| 3] = nodeValue("Ambient", self, JUNCTION_CONNECT.input, VALUE_TYPE.color, c_black);
|
||||||
|
|
||||||
inputs[| 4] = nodeValue("Light position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0, -1 ])
|
inputs[| 4] = nodeValue("Light position", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, [ 0, 0 ])
|
||||||
.setDisplay(VALUE_DISPLAY.vector)
|
.setDisplay(VALUE_DISPLAY.vector)
|
||||||
.setUnitRef(function(index) { return getDimension(index); });
|
.setUnitRef(function(index) { return getDimension(index); });
|
||||||
|
|
||||||
|
@ -25,9 +25,11 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
||||||
inputs[| 9] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
inputs[| 9] = nodeValue("Active", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, true);
|
||||||
active_index = 9;
|
active_index = 9;
|
||||||
|
|
||||||
|
inputs[| 10] = nodeValue("Light height", self, JUNCTION_CONNECT.input, VALUE_TYPE.float, 1);
|
||||||
|
|
||||||
input_display_list = [ 9, 0,
|
input_display_list = [ 9, 0,
|
||||||
["Normal", false], 1, 2,
|
["Normal", false], 1, 2,
|
||||||
["Light", false], 3, 8, 4, 5, 6, 7
|
["Light", false], 3, 8, 4, 10, 5, 6, 7
|
||||||
];
|
];
|
||||||
|
|
||||||
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
outputs[| 0] = nodeValue("Surface out", self, JUNCTION_CONNECT.output, VALUE_TYPE.surface, noone);
|
||||||
|
@ -58,14 +60,17 @@ function Node_Normal_Light(_x, _y, _group = noone) : Node_Processor(_x, _y, _gro
|
||||||
var _light_int = _data[6];
|
var _light_int = _data[6];
|
||||||
var _light_col = _data[7];
|
var _light_col = _data[7];
|
||||||
var _light_typ = _data[8];
|
var _light_typ = _data[8];
|
||||||
|
var _light_hei = _data[10];
|
||||||
|
|
||||||
|
var _dim = surface_get_dimension(_data[0]);
|
||||||
|
|
||||||
surface_set_shader(_outSurf, sh_normal_light);
|
surface_set_shader(_outSurf, sh_normal_light);
|
||||||
shader_set_surface("normalMap", _map);
|
shader_set_surface("normalMap", _map);
|
||||||
shader_set_f("normalHeight", _hei);
|
shader_set_f("normalHeight", _hei);
|
||||||
shader_set_f("dimension", surface_get_width_safe(_data[0]), surface_get_height_safe(_data[0]));
|
shader_set_f("dimension", _dim);
|
||||||
shader_set_color("ambiance", _amb);
|
shader_set_color("ambiance", _amb);
|
||||||
|
|
||||||
shader_set_f("lightPosition", _light_pos[0], _light_pos[1], _light_pos[2] / 100, _light_ran );
|
shader_set_f("lightPosition", _light_pos[0], _light_pos[1], -_light_hei / 100, _light_ran );
|
||||||
shader_set_color("lightColor", _light_col);
|
shader_set_color("lightColor", _light_col);
|
||||||
shader_set_f("lightIntensity", _light_int);
|
shader_set_f("lightIntensity", _light_int);
|
||||||
shader_set_i("lightType", _light_typ);
|
shader_set_i("lightType", _light_typ);
|
||||||
|
|
|
@ -37,14 +37,14 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
||||||
|
|
||||||
outputs[| 0] = nodeValue("Number", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
|
outputs[| 0] = nodeValue("Number", self, JUNCTION_CONNECT.output, VALUE_TYPE.float, 0);
|
||||||
|
|
||||||
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) { #region
|
static drawOverlay = function(hover, active, _x, _y, _s, _mx, _my, _snx, _sny) {
|
||||||
var __ax = getInputData(0);
|
var __ax = getInputData(0);
|
||||||
if(is_array(__ax)) return;
|
if(is_array(__ax)) return;
|
||||||
|
|
||||||
inputs[| 0].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
inputs[| 0].drawOverlay(hover, active, _x, _y, _s, _mx, _my, _snx, _sny);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static step = function() { #region
|
static step = function() {
|
||||||
var int = getInputData(1);
|
var int = getInputData(1);
|
||||||
var disp = getInputData(2);
|
var disp = getInputData(2);
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
||||||
}
|
}
|
||||||
|
|
||||||
outputs[| 0].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float);
|
outputs[| 0].setType(int? VALUE_TYPE.integer : VALUE_TYPE.float);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static processNumber = function(_val, _int) {
|
static processNumber = function(_val, _int) {
|
||||||
if(is_string(_val)) return _int? round(toNumber(_val)) : toNumber(_val);
|
if(is_string(_val)) return _int? round(toNumber(_val)) : toNumber(_val);
|
||||||
|
@ -92,13 +92,13 @@ function Node_Number(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
|
||||||
return _val;
|
return _val;
|
||||||
}
|
}
|
||||||
|
|
||||||
static update = function() { #region
|
static update = function() {
|
||||||
var _dat = getInputData(0);
|
var _dat = getInputData(0);
|
||||||
var _int = getInputData(1);
|
var _int = getInputData(1);
|
||||||
|
|
||||||
var _res = processNumber(_dat, _int);
|
var _res = processNumber(_dat, _int);
|
||||||
outputs[| 0].setValue(_res);
|
outputs[| 0].setValue(_res);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) { #region
|
||||||
var bbox = drawGetBbox(xx, yy, _s);
|
var bbox = drawGetBbox(xx, yy, _s);
|
||||||
|
|
|
@ -42,15 +42,15 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
|
|
||||||
static setSlideSpeed = function(speed) { for(var i = 0; i < 4; i++) tb[i].setSlidable(speed); }
|
static setSlideSpeed = function(speed) { for(var i = 0; i < 4; i++) tb[i].setSlidable(speed); }
|
||||||
|
|
||||||
static setInteract = function(interactable = noone) { #region
|
static setInteract = function(interactable = noone) {
|
||||||
self.interactable = interactable;
|
self.interactable = interactable;
|
||||||
b_link.interactable = interactable;
|
b_link.interactable = interactable;
|
||||||
|
|
||||||
for( var i = 0; i < 4; i++ )
|
for( var i = 0; i < 4; i++ )
|
||||||
tb[i].interactable = interactable;
|
tb[i].interactable = interactable;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static register = function(parent = noone) { #region
|
static register = function(parent = noone) {
|
||||||
b_link.register();
|
b_link.register();
|
||||||
|
|
||||||
if(unit != noone && unit.reference != noone)
|
if(unit != noone && unit.reference != noone)
|
||||||
|
@ -60,7 +60,7 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
tb[0].register(parent);
|
tb[0].register(parent);
|
||||||
tb[1].register(parent);
|
tb[1].register(parent);
|
||||||
tb[3].register(parent);
|
tb[3].register(parent);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isHovering = function() {
|
static isHovering = function() {
|
||||||
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
||||||
|
@ -103,11 +103,11 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y + _h + ui(4), _w, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y + _h + ui(4), _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
var tb_w = _w / 2;
|
var tb_w = _w / 2;
|
||||||
var tb_h = _h;
|
var tb_h = _h;
|
||||||
|
@ -134,9 +134,9 @@ function paddingBox(_onModify, _unit = noone) : widget() constructor {
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new paddingBox(onModify, unit);
|
var cln = new paddingBox(onModify, unit);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -88,9 +88,9 @@ function pathAnchorBox(_onModify) : widget() constructor {
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new pathAnchorBox(onModify);
|
var cln = new pathAnchorBox(onModify);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -39,11 +39,11 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor {
|
||||||
}
|
}
|
||||||
|
|
||||||
var click = false;
|
var click = false;
|
||||||
draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, _h);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor);
|
||||||
|
|
||||||
if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h)) {
|
if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + _h)) {
|
||||||
hovering = true;
|
hovering = true;
|
||||||
draw_sprite_stretched(THEME.textbox, 1, _x, _y, _w, _h);
|
draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, _h, boxColor);
|
||||||
|
|
||||||
if(mouse_press(mb_left, active)) {
|
if(mouse_press(mb_left, active)) {
|
||||||
trigger();
|
trigger();
|
||||||
|
@ -53,7 +53,7 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor {
|
||||||
if(mouse_click(mb_left, active))
|
if(mouse_click(mb_left, active))
|
||||||
draw_sprite_stretched(THEME.textbox, 2, _x, _y, _w, _h);
|
draw_sprite_stretched(THEME.textbox, 2, _x, _y, _w, _h);
|
||||||
} else {
|
} else {
|
||||||
draw_sprite_stretched(THEME.textbox, 0, _x, _y, _w, _h);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor);
|
||||||
if(mouse_press(mb_left)) deactivate();
|
if(mouse_press(mb_left)) deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,9 +82,9 @@ function pathArrayBox(_target, _data, _onClick) : widget() constructor {
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new pathArrayBox(target, data, onClick);
|
var cln = new pathArrayBox(target, data, onClick);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -124,8 +124,8 @@ function quarternionBox(_onModify) : widget() constructor {
|
||||||
|
|
||||||
var _dispDat = _data;
|
var _dispDat = _data;
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
for(var i = 0; i < size; i++) {
|
for(var i = 0; i < size; i++) {
|
||||||
var _a = _dispDat[i];
|
var _a = _dispDat[i];
|
||||||
|
@ -143,8 +143,8 @@ function quarternionBox(_onModify) : widget() constructor {
|
||||||
return _h;
|
return _h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new quarternionBox(onModify);
|
var cln = new quarternionBox(onModify);
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -35,38 +35,38 @@ function rangeBox(_type, _onModify) : widget() constructor {
|
||||||
tb[i].label = labels[i];
|
tb[i].label = labels[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static setSlideSpeed = function(speed) { #region
|
static setSlideSpeed = function(speed) {
|
||||||
tb[0].setSlidable(speed);
|
tb[0].setSlidable(speed);
|
||||||
tb[1].setSlidable(speed);
|
tb[1].setSlidable(speed);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setInteract = function(interactable = noone) { #region
|
static setInteract = function(interactable = noone) {
|
||||||
self.interactable = interactable;
|
self.interactable = interactable;
|
||||||
|
|
||||||
tb[0].interactable = interactable;
|
tb[0].interactable = interactable;
|
||||||
if(!linked)
|
if(!linked)
|
||||||
tb[1].interactable = interactable;
|
tb[1].interactable = interactable;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static register = function(parent = noone) { #region
|
static register = function(parent = noone) {
|
||||||
tb[0].register(parent);
|
tb[0].register(parent);
|
||||||
if(!linked)
|
if(!linked)
|
||||||
tb[1].register(parent);
|
tb[1].register(parent);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isHovering = function() { #region
|
static isHovering = function() {
|
||||||
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
||||||
return false;
|
return false;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
for(var i = 0; i < 2; i++) tb[i].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);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { #region
|
static draw = function(_x, _y, _w, _h, _data, _display_data, _m) {
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -104,8 +104,8 @@ function rangeBox(_type, _onModify) : widget() constructor {
|
||||||
var ww = linked? _w : _w / 2;
|
var ww = linked? _w : _w / 2;
|
||||||
disp_w = disp_w == 0? ww : lerp_float(disp_w, ww, 5);
|
disp_w = disp_w == 0? ww : lerp_float(disp_w, ww, 5);
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
if(linked) {
|
if(linked) {
|
||||||
tb[0].setFocusHover(active, hover);
|
tb[0].setFocusHover(active, hover);
|
||||||
|
@ -123,11 +123,11 @@ function rangeBox(_type, _onModify) : widget() constructor {
|
||||||
resetFocus();
|
resetFocus();
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new rangeBox(type, onModify);
|
var cln = new rangeBox(type, onModify);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -17,25 +17,25 @@ function rotator(_onModify, _step = -1) : widget() constructor {
|
||||||
|
|
||||||
halign = fa_center;
|
halign = fa_center;
|
||||||
|
|
||||||
static setInteract = function(interactable = noone) { #region
|
static setInteract = function(interactable = noone) {
|
||||||
self.interactable = interactable;
|
self.interactable = interactable;
|
||||||
tb_value.interactable = interactable;
|
tb_value.interactable = interactable;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static register = function(parent = noone) { #region
|
static register = function(parent = noone) {
|
||||||
tb_value.register(parent);
|
tb_value.register(parent);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isHovering = function() { return dragging || tb_value.hovering; }
|
static isHovering = function() { return dragging || tb_value.hovering; }
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
tb_value.setParam(params);
|
tb_value.setParam(params);
|
||||||
|
|
||||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _data, _m, draw_tb = true) { #region
|
static draw = function(_x, _y, _w, _h, _data, _m, draw_tb = true) {
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -56,8 +56,8 @@ function rotator(_onModify, _step = -1) : widget() constructor {
|
||||||
var _tx = _drawRot? _x + _r + ui(4) : _x;
|
var _tx = _drawRot? _x + _r + ui(4) : _x;
|
||||||
var _tw = _drawRot? _w - _r - ui(4) : _w;
|
var _tw = _drawRot? _w - _r - ui(4) : _w;
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
tb_value.setFocusHover(active, hover);
|
tb_value.setFocusHover(active, hover);
|
||||||
tb_value.draw(_tx, _y, _tw, _h, _data, _m);
|
tb_value.draw(_tx, _y, _tw, _h, _data, _m);
|
||||||
|
@ -123,11 +123,11 @@ function rotator(_onModify, _step = -1) : widget() constructor {
|
||||||
resetFocus();
|
resetFocus();
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new rotator(onModify, valStep);
|
var cln = new rotator(onModify, valStep);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -21,26 +21,26 @@ function rotatorRandom(_onModify) : widget() constructor {
|
||||||
__txtx("widget_rotator_random_double_span", "Double Span")
|
__txtx("widget_rotator_random_double_span", "Double Span")
|
||||||
]);
|
]);
|
||||||
|
|
||||||
static setInteract = function(interactable = noone) { #region
|
static setInteract = function(interactable = noone) {
|
||||||
self.interactable = interactable;
|
self.interactable = interactable;
|
||||||
tb_min_0.interactable = interactable;
|
tb_min_0.interactable = interactable;
|
||||||
tb_max_0.interactable = interactable;
|
tb_max_0.interactable = interactable;
|
||||||
|
|
||||||
if(mode == 2 || mode == 3) tb_min_1.interactable = interactable;
|
if(mode == 2 || mode == 3) tb_min_1.interactable = interactable;
|
||||||
if(mode == 2) tb_max_1.interactable = interactable;
|
if(mode == 2) tb_max_1.interactable = interactable;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static register = function(parent = noone) { #region
|
static register = function(parent = noone) {
|
||||||
tb_min_0.register(parent);
|
tb_min_0.register(parent);
|
||||||
tb_max_0.register(parent);
|
tb_max_0.register(parent);
|
||||||
|
|
||||||
if(mode == 2 || mode == 3) tb_min_1.register(parent);
|
if(mode == 2 || mode == 3) tb_min_1.register(parent);
|
||||||
if(mode == 2) tb_max_1.register(parent);
|
if(mode == 2) tb_max_1.register(parent);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isHovering = function() { return dragging || tb_min_0.hovering || tb_max_0.hovering || tb_min_1.hovering || tb_max_1.hovering; }
|
static isHovering = function() { return dragging || tb_min_0.hovering || tb_max_0.hovering || tb_min_1.hovering || tb_max_1.hovering; }
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
tb_min_0.setParam(params);
|
tb_min_0.setParam(params);
|
||||||
tb_max_0.setParam(params);
|
tb_max_0.setParam(params);
|
||||||
|
@ -48,9 +48,9 @@ function rotatorRandom(_onModify) : widget() constructor {
|
||||||
tb_max_1.setParam(params);
|
tb_max_1.setParam(params);
|
||||||
|
|
||||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _data, _m) { #region
|
static draw = function(_x, _y, _w, _h, _data, _m) {
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -69,17 +69,17 @@ function rotatorRandom(_onModify) : widget() constructor {
|
||||||
|
|
||||||
switch(mode) {
|
switch(mode) {
|
||||||
case 2 :
|
case 2 :
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y + _h + ui(4), _tw, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y + _h + ui(4), _tw, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y + _h + ui(4), _tw, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y + _h + ui(4), _tw, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
case 0 :
|
case 0 :
|
||||||
case 1 :
|
case 1 :
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3 :
|
case 3 :
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_drawRot) {
|
if(_drawRot) {
|
||||||
|
@ -458,11 +458,10 @@ function rotatorRandom(_onModify) : widget() constructor {
|
||||||
resetFocus();
|
resetFocus();
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new rotatorRandom(onModify);
|
var cln = new rotatorRandom(onModify);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -11,28 +11,28 @@ function rotatorRange(_onModify) : widget() constructor {
|
||||||
tb_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 0); } ).setSlidable([ 0.1, 15 ], true); tb_min.hide = true;
|
tb_min = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 0); } ).setSlidable([ 0.1, 15 ], true); tb_min.hide = true;
|
||||||
tb_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 1); } ).setSlidable([ 0.1, 15 ], true); tb_max.hide = true;
|
tb_max = new textBox(TEXTBOX_INPUT.number, function(val) { return onModify(val, 1); } ).setSlidable([ 0.1, 15 ], true); tb_max.hide = true;
|
||||||
|
|
||||||
static setInteract = function(interactable = noone) { #region
|
static setInteract = function(interactable = noone) {
|
||||||
self.interactable = interactable;
|
self.interactable = interactable;
|
||||||
tb_min.interactable = interactable;
|
tb_min.interactable = interactable;
|
||||||
tb_max.interactable = interactable;
|
tb_max.interactable = interactable;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static register = function(parent = noone) { #region
|
static register = function(parent = noone) {
|
||||||
tb_min.register(parent);
|
tb_min.register(parent);
|
||||||
tb_max.register(parent);
|
tb_max.register(parent);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isHovering = function() { return dragging || tb_min.hovering || tb_max.hovering; }
|
static isHovering = function() { return dragging || tb_min.hovering || tb_max.hovering; }
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
tb_min.setParam(params);
|
tb_min.setParam(params);
|
||||||
tb_max.setParam(params);
|
tb_max.setParam(params);
|
||||||
|
|
||||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _data, _m) { #region
|
static draw = function(_x, _y, _w, _h, _data, _m) {
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -46,8 +46,8 @@ function rotatorRange(_onModify) : widget() constructor {
|
||||||
var _tx = _drawRot? _x + _r + ui(4) : _x;
|
var _tx = _drawRot? _x + _r + ui(4) : _x;
|
||||||
var _tw = _drawRot? _w - _r - ui(4) : _w;
|
var _tw = _drawRot? _w - _r - ui(4) : _w;
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _tx, _y, _tw, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _tx, _y, _tw, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
_tw /= 2;
|
_tw /= 2;
|
||||||
|
|
||||||
|
@ -125,11 +125,10 @@ function rotatorRange(_onModify) : widget() constructor {
|
||||||
resetFocus();
|
resetFocus();
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new rotatorRange(onModify);
|
var cln = new rotatorRange(onModify);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -12,33 +12,33 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor {
|
||||||
tb_value_min.hide = true;
|
tb_value_min.hide = true;
|
||||||
tb_value_max.hide = true;
|
tb_value_max.hide = true;
|
||||||
|
|
||||||
static setSlideSpeed = function(speed) { #region
|
static setSlideSpeed = function(speed) {
|
||||||
tb_value_min.setSlidable(speed);
|
tb_value_min.setSlidable(speed);
|
||||||
tb_value_max.setSlidable(speed);
|
tb_value_max.setSlidable(speed);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setInteract = function(interactable = noone) { #region
|
static setInteract = function(interactable = noone) {
|
||||||
self.interactable = interactable;
|
self.interactable = interactable;
|
||||||
tb_value_min.interactable = interactable;
|
tb_value_min.interactable = interactable;
|
||||||
tb_value_max.interactable = interactable;
|
tb_value_max.interactable = interactable;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static register = function(parent = noone) { #region
|
static register = function(parent = noone) {
|
||||||
tb_value_min.register(parent);
|
tb_value_min.register(parent);
|
||||||
tb_value_max.register(parent);
|
tb_value_max.register(parent);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isHovering = function() { return tb_value_min.hovering || tb_value_max.hovering; }
|
static isHovering = function() { return tb_value_min.hovering || tb_value_max.hovering; }
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
tb_value_min.setParam(params);
|
tb_value_min.setParam(params);
|
||||||
tb_value_max.setParam(params);
|
tb_value_max.setParam(params);
|
||||||
|
|
||||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _data, _m) { #region
|
static draw = function(_x, _y, _w, _h, _data, _m) {
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -46,7 +46,7 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor {
|
||||||
if(!is_real(_data[0])) return h;
|
if(!is_real(_data[0])) return h;
|
||||||
if(!is_real(_data[1])) return h;
|
if(!is_real(_data[1])) return h;
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
|
||||||
|
|
||||||
var _minn = slide_range[0];
|
var _minn = slide_range[0];
|
||||||
var _maxx = slide_range[1];
|
var _maxx = slide_range[1];
|
||||||
|
@ -59,17 +59,17 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor {
|
||||||
curr_range[1] = (_currMax <= _maxx)? _maxx : _maxx + ceil(abs(_currMax - _maxx) / _rang) * _rang;
|
curr_range[1] = (_currMax <= _maxx)? _maxx : _maxx + ceil(abs(_currMax - _maxx) / _rang) * _rang;
|
||||||
}
|
}
|
||||||
|
|
||||||
var lx = _w * (_currMin - curr_range[0]) / (curr_range[1] - curr_range[0]);
|
var lx = _w * ((_currMin ) - curr_range[0]) / (curr_range[1] - curr_range[0]);
|
||||||
var lw = _w * ((_currMax - _currMin) - curr_range[0]) / (curr_range[1] - curr_range[0]);
|
var lw = _w * ((_currMax - _currMin) - curr_range[0]) / (curr_range[1] - curr_range[0]);
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 4, _x + lx, _y, lw, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 4, _x + lx, _y, lw, _h, boxColor, 1);
|
||||||
|
|
||||||
var tb_w = _w / 2;
|
var tb_w = _w / 2;
|
||||||
|
|
||||||
if(tb_value_min.selecting || tb_value_max.selecting) {
|
if(tb_value_min.selecting || tb_value_max.selecting) {
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, _h, boxColor, 1);
|
||||||
} else {
|
} else {
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
}
|
}
|
||||||
|
|
||||||
tb_value_min.curr_range[0] = curr_range[0];
|
tb_value_min.curr_range[0] = curr_range[0];
|
||||||
|
@ -85,11 +85,11 @@ function sliderRange(_step, _int, _range, _onModify) : widget() constructor {
|
||||||
tb_value_max.draw(_x + tb_w, _y, tb_w, _h, _data[1], _m);
|
tb_value_max.draw(_x + tb_w, _y, tb_w, _h, _data[1], _m);
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new sliderRange(stepSize, isInt, slide_range, onModify);
|
var cln = new sliderRange(stepSize, isInt, slide_range, onModify);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -8,13 +8,13 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor {
|
||||||
hide = false;
|
hide = false;
|
||||||
open = false;
|
open = false;
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
|
|
||||||
return draw(params.x, params.y, params.w, params.h, params.m, params.rx, params.ry);
|
return draw(params.x, params.y, params.w, params.h, params.m, params.rx, params.ry);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _m, _rx = 0, _ry = 0) { #region
|
static draw = function(_x, _y, _w, _h, _m, _rx = 0, _ry = 0) {
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -39,13 +39,13 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor {
|
||||||
|
|
||||||
h = th;
|
h = th;
|
||||||
|
|
||||||
draw_sprite_stretched(THEME.textbox, 3, _x, _y, _w, th);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, th, boxColor);
|
||||||
|
|
||||||
if(open) {
|
if(open) {
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 2, _x, _y, _w, th, COLORS._main_accent, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 2, _x, _y, _w, th, COLORS._main_accent, 1);
|
||||||
} else {
|
} else {
|
||||||
if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + th)) {
|
if(hover && point_in_rectangle(_m[0], _m[1], _x, _y, _x + _w, _y + th)) {
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, th, c_white, 0.5 + !hide * 0.5);
|
draw_sprite_stretched_ext(THEME.textbox, 1, _x, _y, _w, th, boxColor, 0.5 + !hide * 0.5);
|
||||||
if(mouse_press(mb_left, active)) {
|
if(mouse_press(mb_left, active)) {
|
||||||
with(dialogCall(o_dialog_arrayBox, _rx + _x, _ry + _y + th)) {
|
with(dialogCall(o_dialog_arrayBox, _rx + _x, _ry + _y + th)) {
|
||||||
arrayBox = other;
|
arrayBox = other;
|
||||||
|
@ -53,7 +53,7 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(!hide)
|
} else if(!hide)
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, th, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, th, boxColor, 0.5 + 0.5 * interactable);
|
||||||
}
|
}
|
||||||
|
|
||||||
var tx = _x + ui(4);
|
var tx = _x + ui(4);
|
||||||
|
@ -76,11 +76,11 @@ function textArrayBox(arraySet, data, onModify = noone) : widget() constructor {
|
||||||
|
|
||||||
resetFocus();
|
resetFocus();
|
||||||
return th;
|
return th;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new textArrayBox(getArray, data, onModify);
|
var cln = new textArrayBox(getArray, data, onModify);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -72,13 +72,13 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
static setOnRelease = function(release) { onRelease = release; return self; }
|
static setOnRelease = function(release) { onRelease = release; return self; }
|
||||||
|
|
||||||
static modifyValue = function(value) { #region
|
static modifyValue = function(value) {
|
||||||
if(input == TEXTBOX_INPUT.number) {
|
if(input == TEXTBOX_INPUT.number) {
|
||||||
if(use_range) value = clamp(value, range_min, range_max);
|
if(use_range) value = clamp(value, range_min, range_max);
|
||||||
}
|
}
|
||||||
|
|
||||||
onModify(value);
|
onModify(value);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setSlidable = function(slideStep = slide_speed, _slide_int = false, _slide_range = noone) {
|
static setSlidable = function(slideStep = slide_speed, _slide_int = false, _slide_range = noone) {
|
||||||
slidable = true;
|
slidable = true;
|
||||||
|
@ -90,13 +90,13 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
static setRange = function(_rng_min, _rng_max) { #region
|
static setRange = function(_rng_min, _rng_max) {
|
||||||
use_range = true;
|
use_range = true;
|
||||||
range_min = _rng_min;
|
range_min = _rng_min;
|
||||||
range_max = _rng_max;
|
range_max = _rng_max;
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setFont = function(font) { self.font = font; return self; }
|
static setFont = function(font) { self.font = font; return self; }
|
||||||
static setLabel = function(label) { self.label = label; return self; }
|
static setLabel = function(label) { self.label = label; return self; }
|
||||||
|
@ -104,7 +104,7 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
static setPadding = function(padding) { self.padding = padding; return self; }
|
static setPadding = function(padding) { self.padding = padding; return self; }
|
||||||
static setEmpty = function() { no_empty = false; return self; }
|
static setEmpty = function() { no_empty = false; return self; }
|
||||||
|
|
||||||
static activate = function() { #region
|
static activate = function() {
|
||||||
WIDGET_CURRENT = self;
|
WIDGET_CURRENT = self;
|
||||||
WIDGET_CURRENT_SCROLL = parent;
|
WIDGET_CURRENT_SCROLL = parent;
|
||||||
parentFocus();
|
parentFocus();
|
||||||
|
@ -120,9 +120,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
keyboard_lastkey = -1;
|
keyboard_lastkey = -1;
|
||||||
|
|
||||||
if(PEN_USE) keyboard_virtual_show(input == TEXTBOX_INPUT.number? kbv_type_numbers : kbv_type_default, kbv_returnkey_default, kbv_autocapitalize_none, true);
|
if(PEN_USE) keyboard_virtual_show(input == TEXTBOX_INPUT.number? kbv_type_numbers : kbv_type_default, kbv_returnkey_default, kbv_autocapitalize_none, true);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static deactivate = function() { #region
|
static deactivate = function() {
|
||||||
if(WIDGET_CURRENT != self) return;
|
if(WIDGET_CURRENT != self) return;
|
||||||
|
|
||||||
apply();
|
apply();
|
||||||
|
@ -133,9 +133,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
UNDO_HOLDING = false;
|
UNDO_HOLDING = false;
|
||||||
|
|
||||||
if(PEN_USE) keyboard_virtual_hide();
|
if(PEN_USE) keyboard_virtual_hide();
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static onKey = function(key) { #region
|
static onKey = function(key) {
|
||||||
if(KEYBOARD_PRESSED == vk_left) {
|
if(KEYBOARD_PRESSED == vk_left) {
|
||||||
if(key_mod_press(SHIFT)) {
|
if(key_mod_press(SHIFT)) {
|
||||||
if(cursor_select == -1)
|
if(cursor_select == -1)
|
||||||
|
@ -155,9 +155,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
move_cursor(1);
|
move_cursor(1);
|
||||||
}
|
}
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static apply = function(release = false) { #region
|
static apply = function(release = false) {
|
||||||
var _val = _input_text;
|
var _val = _input_text;
|
||||||
disp_x_to = 0;
|
disp_x_to = 0;
|
||||||
|
|
||||||
|
@ -184,14 +184,14 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
|
|
||||||
if(IS_PATREON) shake_amount = PREFERENCES.textbox_shake / 4;
|
if(IS_PATREON) shake_amount = PREFERENCES.textbox_shake / 4;
|
||||||
return false;
|
return false;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static move_cursor = function(delta) { #region
|
static move_cursor = function(delta) {
|
||||||
var ll = string_length(_input_text) + 1;
|
var ll = string_length(_input_text) + 1;
|
||||||
cursor = safe_mod(cursor + delta + ll, ll);
|
cursor = safe_mod(cursor + delta + ll, ll);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static editText = function() { #region
|
static editText = function() {
|
||||||
var edited = false;
|
var edited = false;
|
||||||
|
|
||||||
#region text editor
|
#region text editor
|
||||||
|
@ -341,9 +341,9 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
} else if(auto_update && (edited || keyboard_check_pressed(vk_anykey))) {
|
} else if(auto_update && (edited || keyboard_check_pressed(vk_anykey))) {
|
||||||
apply();
|
apply();
|
||||||
}
|
}
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static display_text = function(_x, _y, _text, _w, _m = -1) { #region
|
static display_text = function(_x, _y, _text, _w, _m = -1) {
|
||||||
draw_set_alpha(0.5 + 0.5 * interactable);
|
draw_set_alpha(0.5 + 0.5 * interactable);
|
||||||
_y += ui(1); //Huh?
|
_y += ui(1); //Huh?
|
||||||
|
|
||||||
|
@ -389,13 +389,13 @@ function textBox(_input, _onModify) : textInput(_input, _onModify) constructor {
|
||||||
if(mouse_release(mb_left, active))
|
if(mouse_release(mb_left, active))
|
||||||
click_block = false;
|
click_block = false;
|
||||||
}
|
}
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
|
|
||||||
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.halign, params.valign);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.m, params.halign, params.valign);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _text = "", _m = mouse_ui, halign = fa_left, valign = fa_top) { #region
|
static draw = function(_x, _y, _w, _h, _text = "", _m = mouse_ui, halign = fa_left, valign = fa_top) { #region
|
||||||
x = _x;
|
x = _x;
|
||||||
|
|
|
@ -25,13 +25,13 @@ function transformBox(_onModify) : widget() constructor {
|
||||||
tb[i].label = labels[i];
|
tb[i].label = labels[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static setInteract = function(interactable = noone) { #region
|
static setInteract = function(interactable = noone) {
|
||||||
self.interactable = interactable;
|
self.interactable = interactable;
|
||||||
|
|
||||||
for( var i = 0, n = array_length(tb); i < n; i++ )
|
for( var i = 0, n = array_length(tb); i < n; i++ )
|
||||||
tb[i].setInteract(interactable);
|
tb[i].setInteract(interactable);
|
||||||
rot.setInteract(interactable);
|
rot.setInteract(interactable);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static register = function(parent = noone) {
|
static register = function(parent = noone) {
|
||||||
tb[TRANSFORM.pos_x].register(parent);
|
tb[TRANSFORM.pos_x].register(parent);
|
||||||
|
@ -41,20 +41,20 @@ function transformBox(_onModify) : widget() constructor {
|
||||||
tb[TRANSFORM.sca_y].register(parent);
|
tb[TRANSFORM.sca_y].register(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static isHovering = function() { #region
|
static isHovering = function() {
|
||||||
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
||||||
return hovering;
|
return hovering;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
rot.setParam(params);
|
rot.setParam(params);
|
||||||
for(var i = 0; i < 5; i++) tb[i].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);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.m);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _data, _m) { #region
|
static draw = function(_x, _y, _w, _h, _data, _m) {
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -82,8 +82,8 @@ function transformBox(_onModify) : widget() constructor {
|
||||||
|
|
||||||
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Position"));
|
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Position"));
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x + lbw, _y, _w - lbw, tbh, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x + lbw, _y, _w - lbw, tbh, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x + lbw, _y, _w - lbw, tbh, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x + lbw, _y, _w - lbw, tbh, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
tb[TRANSFORM.pos_x].draw(_x + lbw, _y, tbw, tbh, _data[TRANSFORM.pos_x], _m);
|
tb[TRANSFORM.pos_x].draw(_x + lbw, _y, tbw, tbh, _data[TRANSFORM.pos_x], _m);
|
||||||
tb[TRANSFORM.pos_y].draw(_x + lbw + tbw, _y, tbw, tbh, _data[TRANSFORM.pos_y], _m);
|
tb[TRANSFORM.pos_y].draw(_x + lbw + tbw, _y, tbw, tbh, _data[TRANSFORM.pos_y], _m);
|
||||||
|
@ -97,8 +97,8 @@ function transformBox(_onModify) : widget() constructor {
|
||||||
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey);
|
draw_set_text(font, fa_left, fa_center, CDEF.main_dkgrey);
|
||||||
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Scale"));
|
if(_lab) draw_text_add(_x, _y + tbh / 2, __txt("Scale"));
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x + lbw, _y, _w - lbw, tbh, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x + lbw, _y, _w - lbw, tbh, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x + lbw, _y, _w - lbw, tbh, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x + lbw, _y, _w - lbw, tbh, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
tbw = array_length(_data) > 4? (_w - lbw) / 2 : _w - lbw;
|
tbw = array_length(_data) > 4? (_w - lbw) / 2 : _w - lbw;
|
||||||
|
|
||||||
|
@ -109,11 +109,11 @@ function transformBox(_onModify) : widget() constructor {
|
||||||
resetFocus();
|
resetFocus();
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new transformBox(onModify);
|
var cln = new transformBox(onModify);
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -156,8 +156,8 @@ function vectorBox(_size, _onModify, _unit = noone) : widget() constructor {
|
||||||
var ww = per_line? _w : _w / sz;
|
var ww = per_line? _w : _w / sz;
|
||||||
|
|
||||||
if(!per_line) {
|
if(!per_line) {
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var i = 0; i < sz; i++) {
|
for(var i = 0; i < sz; i++) {
|
||||||
|
|
|
@ -31,44 +31,44 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
|
||||||
|
|
||||||
extras = -1;
|
extras = -1;
|
||||||
|
|
||||||
for(var i = 0; i < size; i++) { #region
|
for(var i = 0; i < size; i++) {
|
||||||
tb[i] = new textBox(_type, onModifySingle[i]);
|
tb[i] = new textBox(_type, onModifySingle[i]);
|
||||||
tb[i].slidable = true;
|
tb[i].slidable = true;
|
||||||
tb[i].hide = true;
|
tb[i].hide = true;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setSlideSpeed = function(speed) { #region
|
static setSlideSpeed = function(speed) {
|
||||||
for(var i = 0; i < size; i++)
|
for(var i = 0; i < size; i++)
|
||||||
tb[i].setSlidable(speed);
|
tb[i].setSlidable(speed);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setInteract = function(interactable = noone) { #region
|
static setInteract = function(interactable = noone) {
|
||||||
self.interactable = interactable;
|
self.interactable = interactable;
|
||||||
|
|
||||||
var _step = linked? 2 : 1;
|
var _step = linked? 2 : 1;
|
||||||
for( var i = 0; i < size; i += _step )
|
for( var i = 0; i < size; i += _step )
|
||||||
tb[i].interactable = interactable;
|
tb[i].interactable = interactable;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static register = function(parent = noone) { #region
|
static register = function(parent = noone) {
|
||||||
var _step = linked? 2 : 1;
|
var _step = linked? 2 : 1;
|
||||||
for( var i = 0; i < size; i += _step )
|
for( var i = 0; i < size; i += _step )
|
||||||
tb[i].register(parent);
|
tb[i].register(parent);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isHovering = function() {
|
static isHovering = function() {
|
||||||
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
for( var i = 0, n = array_length(tb); i < n; i++ ) if(tb[i].isHovering()) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static drawParam = function(params) { #region
|
static drawParam = function(params) {
|
||||||
setParam(params);
|
setParam(params);
|
||||||
for(var i = 0; i < size; i++) tb[i].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);
|
return draw(params.x, params.y, params.w, params.h, params.data, params.display_data, params.m);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static draw = function(_x, _y, _w, _h, _data, _display_data, _m) { #region
|
static draw = function(_x, _y, _w, _h, _data, _display_data, _m) {
|
||||||
x = _x;
|
x = _x;
|
||||||
y = _y;
|
y = _y;
|
||||||
w = _w;
|
w = _w;
|
||||||
|
@ -112,8 +112,8 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
|
||||||
var ww = _w / 2;
|
var ww = _w / 2;
|
||||||
|
|
||||||
if(linked) {
|
if(linked) {
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, _y, _w, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, _y, _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
for( var i = 0; i < 2; i++ ) {
|
for( var i = 0; i < 2; i++ ) {
|
||||||
var bx = _x + ww * i;
|
var bx = _x + ww * i;
|
||||||
|
@ -127,8 +127,8 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
|
||||||
for( var j = 0; j < 2; j++ ) {
|
for( var j = 0; j < 2; j++ ) {
|
||||||
var by = _y + (_h + ui(4)) * j;
|
var by = _y + (_h + ui(4)) * j;
|
||||||
|
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 3, _x, by, _w, _h, c_white, 1);
|
draw_sprite_stretched_ext(THEME.textbox, 3, _x, by, _w, _h, boxColor, 1);
|
||||||
draw_sprite_stretched_ext(THEME.textbox, 0, _x, by, _w, _h, c_white, 0.5 + 0.5 * interactable);
|
draw_sprite_stretched_ext(THEME.textbox, 0, _x, by, _w, _h, boxColor, 0.5 + 0.5 * interactable);
|
||||||
|
|
||||||
for( var i = 0; i < 2; i++ ) {
|
for( var i = 0; i < 2; i++ ) {
|
||||||
var bx = _x + ww * i;
|
var bx = _x + ww * i;
|
||||||
|
@ -143,14 +143,14 @@ function vectorRangeBox(_size, _type, _onModify, _unit = noone) : widget() const
|
||||||
resetFocus();
|
resetFocus();
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static clone = function() { #region
|
static clone = function() {
|
||||||
var cln = new vectorRangeBox(size, type, onModify, unit);
|
var cln = new vectorRangeBox(size, type, onModify, unit);
|
||||||
|
|
||||||
cln.axis = axis;
|
cln.axis = axis;
|
||||||
cln.extras = extras;
|
cln.extras = extras;
|
||||||
|
|
||||||
return cln;
|
return cln;
|
||||||
} #endregion
|
}
|
||||||
}
|
}
|
|
@ -22,6 +22,8 @@ function widget() constructor {
|
||||||
sep_axis = false;
|
sep_axis = false;
|
||||||
unit = noone;
|
unit = noone;
|
||||||
|
|
||||||
|
boxColor = c_white;
|
||||||
|
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
w = 0;
|
w = 0;
|
||||||
|
@ -30,69 +32,71 @@ function widget() constructor {
|
||||||
rx = 0;
|
rx = 0;
|
||||||
ry = 0;
|
ry = 0;
|
||||||
|
|
||||||
static setLua = function(_lua_thread, _lua_key, _lua_func) { #region
|
static setLua = function(_lua_thread, _lua_key, _lua_func) {
|
||||||
lua_thread = _lua_thread;
|
lua_thread = _lua_thread;
|
||||||
lua_thread_key = _lua_key;
|
lua_thread_key = _lua_key;
|
||||||
onModify = method(self, _lua_func);
|
onModify = method(self, _lua_func);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setInteract = function(interactable = noone) { #region
|
static setInteract = function(interactable = noone) {
|
||||||
self.interactable = interactable;
|
self.interactable = interactable;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static register = function(parent = noone) { #region
|
static register = function(parent = noone) {
|
||||||
if(!interactable) return;
|
if(!interactable) return;
|
||||||
|
|
||||||
array_push(WIDGET_ACTIVE, self);
|
array_push(WIDGET_ACTIVE, self);
|
||||||
self.parent = parent;
|
self.parent = parent;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setParam = function(params) { #region
|
static setParam = function(params) {
|
||||||
font = params.font;
|
font = params.font;
|
||||||
rx = params.rx;
|
rx = params.rx;
|
||||||
ry = params.ry;
|
ry = params.ry;
|
||||||
|
|
||||||
sep_axis = params.sep_axis;
|
sep_axis = params.sep_axis;
|
||||||
} #endregion
|
|
||||||
|
boxColor = params.color;
|
||||||
|
}
|
||||||
|
|
||||||
static trigger = function() { }
|
static trigger = function() { }
|
||||||
|
|
||||||
static parentFocus = function() { #region
|
static parentFocus = function() {
|
||||||
if(parent == noone) return;
|
if(parent == noone) return;
|
||||||
|
|
||||||
if(y < 0)
|
if(y < 0)
|
||||||
parent.scroll_y_to += abs(y) + ui(16);
|
parent.scroll_y_to += abs(y) + ui(16);
|
||||||
else if(y + ui(16) > parent.surface_h)
|
else if(y + ui(16) > parent.surface_h)
|
||||||
parent.scroll_y_to -= abs(parent.surface_h - y) + h + ui(16);
|
parent.scroll_y_to -= abs(parent.surface_h - y) + h + ui(16);
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static isHovering = function() { return hovering; }
|
static isHovering = function() { return hovering; }
|
||||||
|
|
||||||
static activate = function() { #region
|
static activate = function() {
|
||||||
if(!interactable) return;
|
if(!interactable) return;
|
||||||
|
|
||||||
WIDGET_CURRENT = self;
|
WIDGET_CURRENT = self;
|
||||||
WIDGET_CURRENT_SCROLL = parent;
|
WIDGET_CURRENT_SCROLL = parent;
|
||||||
parentFocus();
|
parentFocus();
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static deactivate = function() { #region
|
static deactivate = function() {
|
||||||
if(WIDGET_CURRENT != self) return;
|
if(WIDGET_CURRENT != self) return;
|
||||||
WIDGET_CURRENT = noone;
|
WIDGET_CURRENT = noone;
|
||||||
WIDGET_CURRENT_SCROLL = noone;
|
WIDGET_CURRENT_SCROLL = noone;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static setFocusHover = function(active = false, hover = false) { #region
|
static setFocusHover = function(active = false, hover = false) {
|
||||||
self.active = interactable && active;
|
self.active = interactable && active;
|
||||||
self.hover = interactable && hover;
|
self.hover = interactable && hover;
|
||||||
self.iactive = active;
|
self.iactive = active;
|
||||||
self.ihover = hover;
|
self.ihover = hover;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static resetFocus = function() { #region
|
static resetFocus = function() {
|
||||||
active = false;
|
active = false;
|
||||||
hover = false;
|
hover = false;
|
||||||
} #endregion
|
}
|
||||||
|
|
||||||
static clone = function() { return variable_clone(self); }
|
static clone = function() { return variable_clone(self); }
|
||||||
|
|
||||||
|
@ -119,5 +123,6 @@ function widgetParam(x, y, w, h, data, display_data = {}, m = mouse_ui, rx = 0,
|
||||||
|
|
||||||
self.font = f_p0;
|
self.font = f_p0;
|
||||||
|
|
||||||
sep_axis = false;
|
color = c_white;
|
||||||
|
sep_axis = false;
|
||||||
}
|
}
|
Loading…
Reference in a new issue