feat: add C++ ImGui functions for core UI and visualization

Funciones C++/ImGui para dashboards (grid, panel, docking, sidebar, tabs),
visualizaciones (candlestick, gauge, histogram, pie, sparkline, heatmap,
scatter, line, bar, surface3d, kpi, table), grafos (force layout, renderer,
viewport, spatial hash, types) y utilidades (time series buffer, tracy zones,
memory/fps overlay, plot theme).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-08 00:10:18 +02:00
parent af9ebd1e0a
commit 0bdf35a461
66 changed files with 4236 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
#pragma once
#include "imgui.h"
struct GraphData;
struct GraphRenderer;
struct SpatialHash;
// Persistent state for graph_viewport widget. Create one per viewport and keep
// alive across frames.
struct GraphViewportState {
// Camera
float cam_x = 0.0f, cam_y = 0.0f;
float zoom = 1.0f;
float zoom_min = 0.01f, zoom_max = 50.0f;
// Interaction result (read after calling graph_viewport each frame)
int hovered_node = -1; // node index under cursor, -1 if none
int selected_node = -1; // last clicked node index, -1 if none
bool is_dragging = false;
// Layout
bool layout_running = true; // animate force layout each frame
float layout_energy = 0.0f; // kinetic energy from last step
// Internal — managed by graph_viewport / graph_viewport_destroy
GraphRenderer* renderer = nullptr;
SpatialHash* spatial = nullptr;
bool initialized = false;
// Widget pixel dimensions tracked for resize detection
int render_w = 0, render_h = 0;
// Node being dragged (-1 = none)
int drag_node = -1;
};
// Main viewport widget. Call every ImGui frame.
// id: unique ImGui widget identifier
// graph: mutable graph data (node positions updated on drag)
// state: persistent state (camera, selection, GPU renderer); must outlive frames
// size: widget size in pixels — ImVec2(0,0) uses all available space
// Returns true if any user interaction occurred (hover, click, drag, zoom).
bool graph_viewport(const char* id, GraphData& graph, GraphViewportState& state,
ImVec2 size = ImVec2(0.0f, 0.0f));
// Release GPU resources. Call once when done with the viewport.
void graph_viewport_destroy(GraphViewportState& state);
// Fit camera to current graph bounds with 10% padding.
void graph_viewport_fit(GraphData& graph, GraphViewportState& state);