30 lines
681 B
C++
30 lines
681 B
C++
#pragma once
|
|
|
|
#include <algorithm>
|
|
|
|
#include <imgui.h>
|
|
#include <imgui_internal.h>
|
|
|
|
|
|
namespace nf7::gui {
|
|
|
|
static inline void NodeSocket() noexcept {
|
|
auto win = ImGui::GetCurrentWindow();
|
|
|
|
const auto em = ImGui::GetFontSize();
|
|
const auto lh = std::max(win->DC.CurrLineSize.y, em);
|
|
const auto rad = em/2 / ImNodes::CanvasState().Zoom;
|
|
const auto sz = ImVec2(rad*2, lh);
|
|
const auto pos = ImGui::GetCursorScreenPos() + sz/2;
|
|
|
|
auto dlist = ImGui::GetWindowDrawList();
|
|
dlist->AddCircleFilled(
|
|
pos, rad, IM_COL32(100, 100, 100, 100));
|
|
dlist->AddCircleFilled(
|
|
pos, rad*.8f, IM_COL32(200, 200, 200, 200));
|
|
|
|
ImGui::Dummy(sz);
|
|
}
|
|
|
|
} // namespacce nf7::gui
|