Pixel-Composer/objects/o_main/Draw_75.gml

164 lines
5.1 KiB
Text
Raw Normal View History

2022-01-13 05:24:03 +01:00
/// @description tooltip filedrop
2023-03-28 06:58:28 +02:00
if(OS == os_windows && gameframe_is_minimized()) exit;
2022-01-13 05:24:03 +01:00
#region tooltip
2023-01-25 06:49:00 +01:00
if(is_array(TOOLTIP) || TOOLTIP != "") {
2023-02-14 02:51:14 +01:00
if(is_struct(TOOLTIP) && struct_has(TOOLTIP, "drawTooltip")) {
TOOLTIP.drawTooltip();
} else if(is_array(TOOLTIP)) {
2023-01-25 06:49:00 +01:00
var content = TOOLTIP[0];
var type = TOOLTIP[1];
2023-03-05 07:16:44 +01:00
if(is_method(content)) content = content();
2023-01-25 06:49:00 +01:00
switch(type) {
case VALUE_TYPE.float :
case VALUE_TYPE.integer :
case VALUE_TYPE.text :
2023-03-11 01:40:17 +01:00
case VALUE_TYPE.struct :
2023-01-25 06:49:00 +01:00
case VALUE_TYPE.path :
2023-02-17 04:48:54 +01:00
draw_tooltip_text(string_real(content));
2023-01-25 06:49:00 +01:00
break;
case VALUE_TYPE.boolean :
2023-06-01 19:50:53 +02:00
draw_tooltip_text(printBool(content));
2023-01-25 06:49:00 +01:00
break;
case VALUE_TYPE.curve :
2023-06-05 18:27:53 +02:00
draw_tooltip_text("[" + __txt("Curve Object") + "]");
2023-01-25 06:49:00 +01:00
break;
case VALUE_TYPE.color :
draw_tooltip_color(content);
break;
2023-05-28 20:00:51 +02:00
case VALUE_TYPE.gradient :
draw_tooltip_gradient(content);
break;
2023-01-25 06:49:00 +01:00
case VALUE_TYPE.d3object :
2023-06-05 18:27:53 +02:00
draw_tooltip_text("[" + __txt("3D Object") + "]");
2023-01-25 06:49:00 +01:00
break;
case VALUE_TYPE.object :
2023-06-05 18:27:53 +02:00
draw_tooltip_text("[" + __txt("Object") + "]");
2023-01-25 06:49:00 +01:00
break;
case VALUE_TYPE.surface :
draw_tooltip_surface(content);
break;
2023-02-14 02:51:14 +01:00
case VALUE_TYPE.rigid :
2023-06-05 18:27:53 +02:00
draw_tooltip_text("[" + __txt("Rigidbody Object") + " (id: " + string(content[$ "object"]) + ")]");
2023-02-14 02:51:14 +01:00
break;
case VALUE_TYPE.particle :
2023-03-13 10:45:56 +01:00
var txt = "[" +
2023-06-05 18:27:53 +02:00
__txt("Particle Object") +
2023-03-13 10:45:56 +01:00
" (size: " + string(array_length(content)) + ") " +
"]";
draw_tooltip_text(txt);
2023-02-14 02:51:14 +01:00
break;
case VALUE_TYPE.pathnode :
2023-06-05 18:27:53 +02:00
draw_tooltip_text("[" + __txt("Path Object") + "]");
2023-02-14 02:51:14 +01:00
break;
case VALUE_TYPE.fdomain :
2023-06-05 18:27:53 +02:00
draw_tooltip_text("[" + __txt("Fluid Domain") + " (id: " + string(content) + ")]");
2023-03-19 09:17:39 +01:00
break;
case VALUE_TYPE.strands :
2023-06-05 18:27:53 +02:00
var txt = __txt("Strands Object");
2023-03-19 09:17:39 +01:00
if(is_struct(content))
txt += " (strands: " + string(array_length(content.hairs)) + ")";
draw_tooltip_text("[" + txt + "]");
break;
case VALUE_TYPE.mesh :
2023-06-05 18:27:53 +02:00
var txt = __txt("Mesh Object");
2023-03-19 09:17:39 +01:00
if(is_struct(content))
txt += " (triangles: " + string(array_length(content.triangles)) + ")";
draw_tooltip_text("[" + txt + "]");
2023-02-14 02:51:14 +01:00
break;
2023-05-03 21:42:17 +02:00
case VALUE_TYPE.d3vertex :
2023-06-05 18:27:53 +02:00
var txt = __txt("3D Vertex");
2023-05-03 21:42:17 +02:00
txt += " (groups: " + string(array_length(content)) + ")";
draw_tooltip_text("[" + txt + "]");
break;
2023-05-28 20:00:51 +02:00
case VALUE_TYPE.atlas :
draw_tooltip_atlas(content);
break;
2023-06-24 22:12:35 +02:00
case VALUE_TYPE.buffer :
draw_tooltip_buffer(content);
break;
2023-01-25 06:49:00 +01:00
}
} else
draw_tooltip_text(TOOLTIP);
2022-01-13 05:24:03 +01:00
}
TOOLTIP = "";
2023-02-14 02:51:14 +01:00
#endregion
2023-03-25 12:27:04 +01:00
#region dragging
if(DRAGGING != noone) {
switch(DRAGGING.type) {
2023-03-26 07:13:36 +02:00
case "Color" :
draw_sprite_stretched_ext(THEME.color_picker_box, 1, mouse_mx + ui(-16), mouse_my + ui(-16), ui(32), ui(32), DRAGGING.data, 0.5);
break;
2023-03-25 12:27:04 +01:00
case "Palette" :
2023-03-26 07:13:36 +02:00
drawPalette(DRAGGING.data, mouse_mx - ui(64), mouse_my - ui(12), ui(128), ui(24), 0.5);
2023-03-25 12:27:04 +01:00
break;
2023-03-26 07:13:36 +02:00
case "Gradient" :
DRAGGING.data.draw(mouse_mx - ui(64), mouse_my - ui(12), ui(128), ui(24), 0.5);
2023-03-25 12:27:04 +01:00
break;
2023-03-25 12:53:29 +01:00
case "Asset" :
2023-03-26 07:13:36 +02:00
if(DRAGGING.data.spr) {
var ss = 32 / max(sprite_get_width(DRAGGING.data.spr), sprite_get_height(DRAGGING.data.spr))
draw_sprite_ext(DRAGGING.data.spr, 0, mouse_mx, mouse_my, ss, ss, 0, c_white, 0.5);
}
2023-03-25 12:53:29 +01:00
break;
case "Collection" :
if(DRAGGING.data.spr) {
var ss = 32 / max(sprite_get_width(DRAGGING.data.spr), sprite_get_height(DRAGGING.data.spr))
draw_sprite_ext(DRAGGING.data.spr, 0, mouse_mx, mouse_my, ss, ss, 0, c_white, 0.5);
}
break;
2023-03-26 07:13:36 +02:00
case "Bool" :
draw_set_alpha(0.5);
draw_set_text(f_h3, fa_center, fa_center, COLORS._main_text);
draw_text_bbox({ xc: mouse_mx, yc: mouse_my, w: ui(128), h: ui(24) }, DRAGGING.data? "True" : "False");
draw_set_alpha(1);
break;
default:
draw_set_alpha(0.5);
draw_set_text(f_h3, fa_center, fa_center, COLORS._main_text);
draw_text_bbox({ xc: mouse_mx, yc: mouse_my, w: ui(128), h: ui(24) }, DRAGGING.data);
draw_set_alpha(1);
2023-03-25 12:27:04 +01:00
}
if(mouse_release(mb_left))
DRAGGING = noone;
}
#endregion
2023-02-14 02:51:14 +01:00
#region safe mode
if(SAFE_MODE) {
draw_sprite_stretched_ext(THEME.ui_panel_active, 0, 0, 0, WIN_W, WIN_H, COLORS._main_value_negative, 1);
draw_set_text(f_h1, fa_right, fa_bottom, COLORS._main_value_negative);
draw_set_alpha(0.1);
2023-06-04 18:28:29 +02:00
draw_text(WIN_W - ui(16), WIN_H - ui(8), __txtx("safe_mode", "SAFE MODE"));
2023-02-14 02:51:14 +01:00
draw_set_alpha(1);
}
2023-02-23 07:02:19 +01:00
#endregion
2023-03-25 12:27:04 +01:00
#region draw gui top
PANEL_MAIN.drawGUI();
2023-06-17 14:30:49 +02:00
if(NODE_DROPPER_TARGET != noone) {
draw_sprite_ui(THEME.node_dropper, 0, mouse_x + ui(20), mouse_y + ui(20));
if(mouse_press(mb_left, NODE_DROPPER_TARGET_CAN))
NODE_DROPPER_TARGET = noone;
NODE_DROPPER_TARGET_CAN = true;
} else
NODE_DROPPER_TARGET_CAN = false;
2023-03-25 12:27:04 +01:00
#endregion
2023-05-08 19:14:30 +02:00
#region debug
2023-05-22 20:31:55 +02:00
if(global.FLAG[$ "hover_element"]) {
2023-05-08 19:14:30 +02:00
draw_set_text(f_p0, fa_right, fa_bottom, COLORS._main_text);
if(HOVERING_ELEMENT)
draw_text(WIN_W, WIN_H, $"[{instanceof(HOVERING_ELEMENT)}]");
}
#endregion
2023-02-23 07:02:19 +01:00
#region frame
2023-04-05 20:13:27 +02:00
draw_set_color(merge_color(COLORS._main_icon, COLORS._main_icon_dark, 0.95));
2023-02-23 07:02:19 +01:00
draw_rectangle(1, 1, WIN_W - 2, WIN_H - 2, true);
2022-01-13 05:24:03 +01:00
#endregion