Pixel-Composer/scripts/node_boolean/node_boolean.gml

30 lines
1,020 B
Text
Raw Normal View History

2023-02-28 09:43:01 +01:00
function Node_Boolean(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) constructor {
2023-01-09 03:14:20 +01:00
name = "Boolean";
color = COLORS.node_blend_number;
previewable = false;
w = 96;
min_h = 32 + 24 * 1;
2023-03-05 07:16:44 +01:00
wd_checkBox = new checkBox( function() { inputs[| 0].setValue(!inputs[| 0].getValue()); } );
wd_checkBox.spr = THEME.node_checkbox;
2023-02-14 05:32:32 +01:00
inputs[| 0] = nodeValue("Value", self, JUNCTION_CONNECT.input, VALUE_TYPE.boolean, false)
2023-01-09 03:14:20 +01:00
.setVisible(true, true);
2023-02-14 05:32:32 +01:00
outputs[| 0] = nodeValue("Boolean", self, JUNCTION_CONNECT.output, VALUE_TYPE.boolean, false);
2023-01-09 03:14:20 +01:00
2023-02-14 05:32:32 +01:00
function process_data(_output, _data, _output_index, _array_index = 0) {
2023-01-09 03:14:20 +01:00
return _data[0];
}
2023-03-05 07:16:44 +01:00
static onDrawNode = function(xx, yy, _mx, _my, _s, _hover, _focus) {
2023-01-09 03:14:20 +01:00
draw_set_text(f_h5, fa_center, fa_center, COLORS._main_text);
2023-03-05 07:16:44 +01:00
var val = inputs[| 0].getValue();
2023-01-09 03:14:20 +01:00
var bbox = drawGetBbox(xx, yy, _s);
2023-03-05 07:16:44 +01:00
wd_checkBox.setActiveFocus(_focus, _hover);
wd_checkBox.draw(bbox.xc, bbox.yc, val, [ _mx, _my ], bbox.h + 8 * _s, fa_center, fa_center);
2023-01-09 03:14:20 +01:00
}
}