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 metadata_summary;
22 std::string last_modified;
23 std::string item_type;
24 std::string item_icon;
25 std::string thumbnail_path; // Optional screenshot
26 bool unavailable = false;
27 int days_ago = 0;
28};
29
35 public:
37
43 bool Show(bool* p_open);
44
48 void SetOpenRomCallback(std::function<void()> callback) {
49 open_rom_callback_ = callback;
50 }
51
55 void SetNewProjectCallback(std::function<void()> callback) {
56 new_project_callback_ = callback;
57 }
58
63 std::function<void(const std::string&)> callback) {
65 }
66
71 std::function<void(const std::string&)> callback) {
72 open_project_callback_ = callback;
73 }
74
78 void SetOpenAgentCallback(std::function<void()> callback) {
79 open_agent_callback_ = callback;
80 }
81
85 void SetOpenProjectDialogCallback(std::function<void()> callback) {
87 }
88
92 void SetOpenProjectManagementCallback(std::function<void()> callback) {
94 }
95
99 void SetOpenProjectFileEditorCallback(std::function<void()> callback) {
101 }
102
107
111 void UpdateAnimations();
112
116 bool ShouldShow() const { return !manually_closed_; }
117
122
127
133 void SetLayoutOffsets(float left, float right) {
134 left_offset_ = left;
135 right_offset_ = right;
136 }
137
141 void SetContextState(bool has_rom, bool has_project) {
142 has_rom_ = has_rom;
143 has_project_ = has_project;
144 }
145
146 private:
147 void DrawHeader();
148 void DrawQuickActions();
149 void DrawRecentProjects();
150 void DrawProjectPanel(const RecentProject& project, int index,
151 const ImVec2& card_size);
153 void DrawTipsSection();
154 void DrawWhatsNew();
155
156 std::vector<RecentProject> recent_projects_;
157 bool manually_closed_ = false;
158 bool first_show_attempt_ = true; // Override ImGui ini state on first display
159
160 // Callbacks
161 std::function<void()> open_rom_callback_;
162 std::function<void()> new_project_callback_;
163 std::function<void(const std::string&)> open_project_callback_;
164 std::function<void(const std::string&)> new_project_with_template_callback_;
165 std::function<void()> open_agent_callback_;
166 std::function<void()> open_project_dialog_callback_;
169
170 // UI state
172 static constexpr int kMaxRecentProjects = 6;
173
174 // Animation state
175 float animation_time_ = 0.0f;
176 float card_hover_scale_[6] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
178
179 // Staggered entry animations
181 float entry_time_ = 0.0f; // Time since welcome screen opened
182 static constexpr float kEntryAnimDuration = 0.4f; // Duration per section
183 static constexpr float kEntryStaggerDelay = 0.08f; // Delay between sections
184
185 // Interactive triforce positions (smooth interpolation)
186 static constexpr int kNumTriforces = 6;
190
191 // Particle system
192 static constexpr int kMaxParticles = 50;
193 struct Particle {
194 ImVec2 position;
195 ImVec2 velocity;
196 float size;
197 float alpha;
198 float lifetime;
200 };
203
204 // Triforce animation settings
207 float triforce_speed_multiplier_ = 0.3f; // Default slower speed
211 float particle_spawn_rate_ = 2.0f; // Particles per second
212
213 // Layout offsets for sidebar awareness (so welcome screen centers in dockspace)
214 float left_offset_ = 0.0f;
215 float right_offset_ = 0.0f;
216
217 // Context state for gating actions
218 bool has_rom_ = false;
219 bool has_project_ = false;
220
221 // Deferred refresh for recent projects (avoid mutating during draw loop)
223};
224
225} // namespace editor
226} // namespace yaze
227
228#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 float kEntryStaggerDelay
static constexpr int kNumTriforces
std::vector< RecentProject > recent_projects_
void SetLayoutOffsets(float left, float right)
Set layout offsets for sidebar awareness.
static constexpr float kEntryAnimDuration
bool ShouldShow() const
Check if screen should be shown.
void DrawProjectPanel(const RecentProject &project, int index, const ImVec2 &card_size)
void SetOpenRomCallback(std::function< void()> callback)
Set callback for opening ROM.
std::function< void()> open_project_file_editor_callback_
ImVec2 triforce_base_positions_[kNumTriforces]
Particle particles_[kMaxParticles]
void SetOpenProjectDialogCallback(std::function< void()> callback)
Set callback for opening the project file dialog.
std::function< void(const std::string &) new_project_with_template_callback_)
void UpdateAnimations()
Update animation time for dynamic effects.
void SetOpenProjectManagementCallback(std::function< void()> callback)
Set callback for showing project management.
static constexpr int kMaxParticles
void SetOpenProjectFileEditorCallback(std::function< void()> callback)
Set callback for showing the project file editor.
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
std::function< void()> open_project_dialog_callback_
void SetOpenProjectCallback(std::function< void(const std::string &)> callback)
Set callback for opening project.
void SetContextState(bool has_rom, bool has_project)
Set context state for gating actions.
std::function< void()> open_agent_callback_
void ResetFirstShow()
Reset first show flag (for testing/forcing display)
std::function< void()> open_project_management_callback_
Information about a recently used project.