yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
background_renderer.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_UI_BACKGROUND_RENDERER_H
2#define YAZE_APP_EDITOR_UI_BACKGROUND_RENDERER_H
3
4#include <memory>
5#include <vector>
6
8#include "rom/rom.h"
9#include "imgui/imgui.h"
10
11namespace yaze {
12namespace gui {
13
19 public:
20 struct GridSettings {
21 float grid_size = 32.0f; // Size of grid cells
22 float line_thickness = 1.0f; // Thickness of grid lines
23 float opacity = 0.12f; // Subtle but visible opacity
24 float fade_distance = 400.0f; // Distance over which grid fades
25 bool enable_animation = false; // Animation toggle (default off)
27 false; // Color breathing effect toggle (default off)
28 bool radial_fade = true; // Re-enable subtle radial fade
29 bool enable_dots = false; // Use dots instead of lines
30 float dot_size = 2.0f; // Size of grid dots
31 float animation_speed = 1.0f; // Animation speed multiplier
32 float breathing_speed = 1.5f; // Breathing effect speed
34 0.3f; // How much color changes during breathing
35 };
36
37 static BackgroundRenderer& Get();
38
39 // Main rendering functions
40 void RenderDockingBackground(ImDrawList* draw_list, const ImVec2& window_pos,
41 const ImVec2& window_size,
42 const Color& theme_color);
43 void RenderGridBackground(ImDrawList* draw_list, const ImVec2& window_pos,
44 const ImVec2& window_size, const Color& grid_color);
45 void RenderRadialGradient(ImDrawList* draw_list, const ImVec2& center,
46 float radius, const Color& inner_color,
47 const Color& outer_color);
48
49 // Configuration
50 void SetGridSettings(const GridSettings& settings) {
51 grid_settings_ = settings;
52 }
53 const GridSettings& GetGridSettings() const { return grid_settings_; }
54
55 // Animation
56 void UpdateAnimation(float delta_time);
57 void SetAnimationEnabled(bool enabled) {
59 }
60
61 // Theme integration
62 void UpdateForTheme(const Color& primary_color,
63 const Color& background_color);
64
65 // UI for settings
66 void DrawSettingsUI();
67
68 private:
69 BackgroundRenderer() = default;
70
72 float animation_time_ = 0.0f;
73 Color cached_grid_color_{0.5f, 0.5f, 0.5f, 0.1f};
74
75 // Helper functions
76 float CalculateRadialFade(const ImVec2& pos, const ImVec2& center,
77 float max_distance) const;
78 ImU32 BlendColorWithFade(const Color& base_color, float fade_factor) const;
79 void DrawGridLine(ImDrawList* draw_list, const ImVec2& start,
80 const ImVec2& end, ImU32 color, float thickness) const;
81 void DrawGridDot(ImDrawList* draw_list, const ImVec2& pos, ImU32 color,
82 float size) const;
83};
84
90 public:
91 static void BeginEnhancedDockSpace(ImGuiID dockspace_id,
92 const ImVec2& size = ImVec2(0, 0),
93 ImGuiDockNodeFlags flags = 0);
94 static void EndEnhancedDockSpace();
95
96 // Configuration
97 static void SetBackgroundEnabled(bool enabled) {
98 background_enabled_ = enabled;
99 }
100 static void SetGridEnabled(bool enabled) { grid_enabled_ = enabled; }
101 static void SetEffectsEnabled(bool enabled) { effects_enabled_ = enabled; }
102
103 private:
105 static bool grid_enabled_;
106 static bool effects_enabled_;
107 static ImVec2 last_dockspace_pos_;
108 static ImVec2 last_dockspace_size_;
109};
110
111} // namespace gui
112} // namespace yaze
113
114#endif // YAZE_APP_EDITOR_UI_BACKGROUND_RENDERER_H
Renders themed background effects for docking windows.
void SetGridSettings(const GridSettings &settings)
void RenderRadialGradient(ImDrawList *draw_list, const ImVec2 &center, float radius, const Color &inner_color, const Color &outer_color)
void RenderGridBackground(ImDrawList *draw_list, const ImVec2 &window_pos, const ImVec2 &window_size, const Color &grid_color)
void DrawGridLine(ImDrawList *draw_list, const ImVec2 &start, const ImVec2 &end, ImU32 color, float thickness) const
static BackgroundRenderer & Get()
float CalculateRadialFade(const ImVec2 &pos, const ImVec2 &center, float max_distance) const
void UpdateAnimation(float delta_time)
const GridSettings & GetGridSettings() const
void UpdateForTheme(const Color &primary_color, const Color &background_color)
void DrawGridDot(ImDrawList *draw_list, const ImVec2 &pos, ImU32 color, float size) const
ImU32 BlendColorWithFade(const Color &base_color, float fade_factor) const
void RenderDockingBackground(ImDrawList *draw_list, const ImVec2 &window_pos, const ImVec2 &window_size, const Color &theme_color)
Enhanced docking space with themed background effects.
static void BeginEnhancedDockSpace(ImGuiID dockspace_id, const ImVec2 &size=ImVec2(0, 0), ImGuiDockNodeFlags flags=0)
static void SetEffectsEnabled(bool enabled)
static void SetGridEnabled(bool enabled)
static void SetBackgroundEnabled(bool enabled)