yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
welcome_screen.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_UI_WELCOME_SCREEN_H_
2#define YAZE_APP_EDITOR_UI_WELCOME_SCREEN_H_
3
4#include <functional>
5#include <string>
6#include <vector>
7
8#include "imgui/imgui.h"
9
10namespace yaze {
11namespace editor {
12
18 std::string name;
19 std::string filepath;
20 std::string rom_title;
21 std::string last_modified;
22 std::string thumbnail_path; // Optional screenshot
23 int days_ago = 0;
24};
25
31 public:
33
39 bool Show(bool* p_open);
40
44 void SetOpenRomCallback(std::function<void()> callback) {
45 open_rom_callback_ = callback;
46 }
47
51 void SetNewProjectCallback(std::function<void()> callback) {
52 new_project_callback_ = callback;
53 }
54
59 std::function<void(const std::string&)> callback) {
61 }
62
67 std::function<void(const std::string&)> callback) {
68 open_project_callback_ = callback;
69 }
70
74 void SetOpenAgentCallback(std::function<void()> callback) {
75 open_agent_callback_ = callback;
76 }
77
82
86 void UpdateAnimations();
87
91 bool ShouldShow() const { return !manually_closed_; }
92
97
102
108 void SetLayoutOffsets(float left, float right) {
109 left_offset_ = left;
110 right_offset_ = right;
111 }
112
113 private:
114 void DrawHeader();
115 void DrawQuickActions();
116 void DrawRecentProjects();
117 void DrawProjectPanel(const RecentProject& project, int index);
119 void DrawTipsSection();
120 void DrawWhatsNew();
121
122 std::vector<RecentProject> recent_projects_;
123 bool manually_closed_ = false;
124 bool first_show_attempt_ = true; // Override ImGui ini state on first display
125
126 // Callbacks
127 std::function<void()> open_rom_callback_;
128 std::function<void()> new_project_callback_;
129 std::function<void(const std::string&)> open_project_callback_;
130 std::function<void(const std::string&)> new_project_with_template_callback_;
131 std::function<void()> open_agent_callback_;
132
133 // UI state
135 static constexpr int kMaxRecentProjects = 6;
136
137 // Animation state
138 float animation_time_ = 0.0f;
139 float card_hover_scale_[6] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
141
142 // Interactive triforce positions (smooth interpolation)
143 static constexpr int kNumTriforces = 6;
147
148 // Particle system
149 static constexpr int kMaxParticles = 50;
150 struct Particle {
151 ImVec2 position;
152 ImVec2 velocity;
153 float size;
154 float alpha;
155 float lifetime;
157 };
160
161 // Triforce animation settings
164 float triforce_speed_multiplier_ = 0.3f; // Default slower speed
168 float particle_spawn_rate_ = 2.0f; // Particles per second
169
170 // Layout offsets for sidebar awareness (so welcome screen centers in dockspace)
171 float left_offset_ = 0.0f;
172 float right_offset_ = 0.0f;
173};
174
175} // namespace editor
176} // namespace yaze
177
178#endif // YAZE_APP_EDITOR_UI_WELCOME_SCREEN_H_
Modern welcome screen with project grid and quick actions.
std::function< void()> open_rom_callback_
std::function< void()> new_project_callback_
void SetNewProjectCallback(std::function< void()> callback)
Set callback for creating new project.
void MarkManuallyClosed()
Mark as manually closed (don't show again this session)
void RefreshRecentProjects()
Refresh recent projects list from the project manager.
void SetOpenAgentCallback(std::function< void()> callback)
Set callback for opening AI Agent.
static constexpr int kNumTriforces
std::vector< RecentProject > recent_projects_
void SetLayoutOffsets(float left, float right)
Set layout offsets for sidebar awareness.
bool ShouldShow() const
Check if screen should be shown.
void SetOpenRomCallback(std::function< void()> callback)
Set callback for opening ROM.
ImVec2 triforce_base_positions_[kNumTriforces]
Particle particles_[kMaxParticles]
void DrawProjectPanel(const RecentProject &project, int index)
std::function< void(const std::string &) new_project_with_template_callback_)
void UpdateAnimations()
Update animation time for dynamic effects.
static constexpr int kMaxParticles
bool Show(bool *p_open)
Show the welcome screen.
ImVec2 triforce_positions_[kNumTriforces]
void SetNewProjectWithTemplateCallback(std::function< void(const std::string &)> callback)
Set callback for creating project with template.
std::function< void(const std::string &) open_project_callback_)
static constexpr int kMaxRecentProjects
void SetOpenProjectCallback(std::function< void(const std::string &)> callback)
Set callback for opening project.
std::function< void()> open_agent_callback_
void ResetFirstShow()
Reset first show flag (for testing/forcing display)
Information about a recently used project.