Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
RenderHelpers.cpp
Go to the documentation of this file.
1/**
2 * @file RenderHelpers.cpp
3 * @brief Implementation of rendering helper functions for node graphs
4 */
5
6#include "RenderHelpers.h"
7#include "../AI/BehaviorTree.h"
8#include "../third_party/imnodes/imnodes.h"
9
10namespace Olympe {
11namespace NodeGraphShared {
12
14 int nodeId,
15 const BTNodeLayout* layout,
16 bool isOutput,
17 float pinOffset,
18 float headerHeight,
19 float zoom
20)
21{
22 // Get node's screen-space position and dimensions from ImNodes
23 ImVec2 nodeScreenPos = ImNodes::GetNodeScreenSpacePos(nodeId);
24 ImVec2 nodeDimensions = ImNodes::GetNodeDimensions(nodeId);
25
26 // Calculate pin Y position: below the header, centered on the "In"/"Out" text row
27 // The header height determines where the first row of content begins
29
30 float pinX;
31 if (isOutput)
32 {
33 // Output pin: right edge of node + offset
35 }
36 else
37 {
38 // Input pin: left edge of node - offset
40 }
41
42 return ImVec2(pinX, pinY);
43}
44
47 const ImVec2& center,
48 float radius,
49 uint32_t color,
52)
53{
54 if (!drawList)
55 return;
56
57 // Draw outline first (larger circle)
58 float outerRadius = radius + outlineThickness;
59 drawList->AddCircleFilled(center, outerRadius, outlineColor);
60
61 // Draw inner circle on top
62 drawList->AddCircleFilled(center, radius, color);
63}
64
65} // namespace NodeGraphShared
66} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Helper functions for rendering node graph pins and connections.
void DrawPinCircle(ImDrawList *drawList, const ImVec2 &center, float radius, ImU32 fillColor, ImU32 outlineColor, float outlineThickness)
ImVec2 ComputePinCenterScreen(int nodeId, const BTNodeLayout *layout, bool isOutput, float pinOffset, float headerPx, float currentZoom)
Compute the screen-space center position of a pin.
< Provides AssetID and INVALID_ASSET_ID