FS4
الذهاب إلى القناة على Telegram
لا توجد بيانات
المشتركون
لا توجد بيانات24 ساعات
+347 أيام
+5630 أيام
أرشيف المشاركات
0
#include "imgui.h"
// Draw the custom shape in the graph to screen coordinates
void DrawCustomShape(float x, float y, float size)
{
ImDrawList* draw_list = ImGui::GetForegroundDrawList(); // Get foreground draw list to draw directly to the screen
// Define the points of the shape
float radius = size / 2;
// Top circle aligned to (x, y)
ImVec2 top_center = ImVec2(x, y); // Position of the top circle's center
// Draw the small filled circle at the top
draw_list->AddCircleFilled(
top_center,
radius / 3,
IM_COL32(0, 255, 0, 255)
);
// Starting point of the vertical line (starts from the top circle's center, bottom circle's center is the lower end of the vertical line)
ImVec2 center = ImVec2(top_center.x, top_center.y + size); // Center point position of the vertical line
// Draw the middle vertical line with increased thickness
draw_list->AddLine(
ImVec2(center.x, top_center.y),
ImVec2(center.x, center.y), // From the top circle's center to the lower end of the vertical line
IM_COL32(0, 255, 0, 255),
radius / 1.7 // Thicken the line
);
// The positions of the two bottom circles should be based on the end point of the vertical line (i.e., the bottom of the vertical line)
float bottom_circle_y = center.y + radius / 8; // Y coordinate of the bottom circles (bottom position of the vertical line)
ImVec2 bottom_left = ImVec2(center.x - radius / 2, bottom_circle_y); // Center of the left circle
ImVec2 bottom_right = ImVec2(center.x + radius / 2, bottom_circle_y); // Center of the right circle
// Draw the two filled circles at the bottom
draw_list->AddCircleFilled(
bottom_left,
radius / 2,
IM_COL32(0, 255, 0, 255)
);
draw_list->AddCircleFilled(
bottom_right,
radius / 2,
IM_COL32(0, 255, 0, 255)
);
// Draw a line from the center to the edge inside the top circle
draw_list->AddLine(
ImVec2(top_center.x, top_center.y - 10), // Start from the top circle's center
ImVec2(top_center.x, top_center.y - radius / 3),
IM_COL32(255, 0, 0, 255),
4.0f
);
}
Ui;Click