Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
RenderHelpers.h
Go to the documentation of this file.
1/**
2 * @file RenderHelpers.h
3 * @brief Helper functions for rendering node graph pins and connections
4 */
5
6#pragma once
7
8#include "../third_party/imgui/imgui.h"
9#include "../vector.h"
10#include <cstdint>
11
12namespace Olympe {
13
14// Forward declarations
15struct BTNodeLayout;
16
17namespace NodeGraphShared {
18
19/**
20 * @brief Compute the screen-space center position of a pin
21 *
22 * Calculates where a pin should be rendered on screen, accounting for:
23 * - Node screen position and dimensions
24 * - Pin type (input/output)
25 * - Header offset
26 * - Zoom level
27 *
28 * @param nodeId The ImNodes node ID
29 * @param layout The node's layout information (optional, used for validation)
30 * @param isOutput True for output pin (right side), false for input pin (left side)
31 * @param pinOffset Horizontal offset from node edge (from ImNodes::GetStyle().PinOffset)
32 * @param headerHeight Height of the node header in pixels (pins are positioned below header)
33 * @param zoom Current zoom level (affects spacing)
34 * @return ImVec2 The screen-space center position of the pin
35 */
37 int nodeId,
38 const BTNodeLayout* layout,
39 bool isOutput,
40 float pinOffset,
41 float headerHeight,
42 float zoom
43);
44
45/**
46 * @brief Draw a pin circle with outline
47 *
48 * Renders a circular pin with two layers:
49 * - Outer circle (outline) for contrast
50 * - Inner circle (main color)
51 *
52 * @param drawList ImGui draw list to render to
53 * @param center Center position of the pin in screen space
54 * @param radius Inner radius of the pin
55 * @param color Inner circle color (RGBA)
56 * @param outlineColor Outline color (RGBA)
57 * @param outlineThickness Thickness of the outline in pixels
58 */
59void DrawPinCircle(
61 const ImVec2& center,
62 float radius,
63 uint32_t color,
66);
67
68} // namespace NodeGraphShared
69} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
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