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_SHELL_COORDINATOR_WELCOME_SCREEN_H_
2#define YAZE_APP_EDITOR_SHELL_COORDINATOR_WELCOME_SCREEN_H_
3
4#include <cstdint>
5#include <functional>
6#include <string>
7
9#include "imgui/imgui.h"
10
11namespace yaze {
12namespace editor {
13
14class UserSettings;
15
21 public:
23
29 bool Show(bool* p_open);
30
34 void SetOpenRomCallback(std::function<void()> callback) {
35 open_rom_callback_ = callback;
36 }
37
41 void SetNewProjectCallback(std::function<void()> callback) {
42 new_project_callback_ = callback;
43 }
44
49 std::function<void(const std::string&)> callback) {
51 }
52
57 std::function<void(const std::string&)> callback) {
58 open_project_callback_ = callback;
59 }
60
64 void SetOpenAgentCallback(std::function<void()> callback) {
65 open_agent_callback_ = callback;
66 }
67
71 void SetOpenPrototypeResearchCallback(std::function<void()> callback) {
72 open_prototype_research_callback_ = std::move(callback);
73 }
74
78 void SetOpenAssemblyEditorNoRomCallback(std::function<void()> callback) {
79 open_assembly_editor_no_rom_callback_ = std::move(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
110 void RefreshRecentProjects(bool force = false);
111
115 void UpdateAnimations();
116
120 bool ShouldShow() const { return !manually_closed_; }
121
126
132 void SetLayoutOffsets(float left, float right) {
133 left_offset_ = left;
134 right_offset_ = right;
135 }
136
140 void SetContextState(bool has_rom, bool has_project) {
141 has_rom_ = has_rom;
142 has_project_ = has_project;
143 }
144
152 void SetUserSettings(UserSettings* settings);
153
162
163 private:
164 void DrawHeader();
165 void DrawQuickActions();
166 void DrawRecentProjects();
167 void DrawProjectPanel(const RecentProject& project, int index,
168 const ImVec2& card_size);
170 void DrawTipsSection();
171 void DrawWhatsNew();
172 void DrawFirstRunGuide();
175
177 bool manually_closed_ = false;
178
179 // Callbacks
180 std::function<void()> open_rom_callback_;
181 std::function<void()> new_project_callback_;
182 std::function<void(const std::string&)> open_project_callback_;
183 std::function<void(const std::string&)> new_project_with_template_callback_;
184 std::function<void()> open_agent_callback_;
187 std::function<void()> open_project_dialog_callback_;
190
191 // UI state
193
194 // Animation state
195 float animation_time_ = 0.0f;
196 float card_hover_scale_[6] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
198
199 // Staggered entry animations
201 float entry_time_ = 0.0f; // Time since welcome screen opened
202 static constexpr float kEntryAnimDuration = 0.4f; // Duration per section
203 static constexpr float kEntryStaggerDelay = 0.08f; // Delay between sections
204
205 // Interactive triforce positions (smooth interpolation)
206 static constexpr int kNumTriforces = 6;
210
211 // Particle system
212 static constexpr int kMaxParticles = 50;
213 struct Particle {
214 ImVec2 position;
215 ImVec2 velocity;
216 float size;
217 float alpha;
218 float lifetime;
220 };
223 // Fractional accumulator for particle spawning. Previously a static local
224 // inside Show(), which silently shared state between (hypothetical) multiple
225 // WelcomeScreen instances and couldn't be reset.
227
228 // Triforce animation settings
231 float triforce_speed_multiplier_ = 0.3f; // Default slower speed
235 float particle_spawn_rate_ = 2.0f; // Particles per second
236
237 // Layout offsets for sidebar awareness (so welcome screen centers in dockspace)
238 float left_offset_ = 0.0f;
239 float right_offset_ = 0.0f;
240
241 // Context state for gating actions
242 bool has_rom_ = false;
243 bool has_project_ = false;
244
245 // Inline popup state for rename / edit-notes flows triggered from the
246 // recent-project context menu. Single-slot (one popup at a time).
250 char rename_buffer_[256] = {};
251 char notes_buffer_[1024] = {};
252
253 // Optional link to persisted user preferences. When set, animation tweaks
254 // flow back through it and survive app restarts.
256
258};
259
260} // namespace editor
261} // namespace yaze
262
263#endif // YAZE_APP_EDITOR_SHELL_COORDINATOR_WELCOME_SCREEN_H_
Manages user preferences and settings persistence.
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 SetOpenAgentCallback(std::function< void()> callback)
Set callback for opening AI Agent.
static constexpr float kEntryStaggerDelay
RecentProjectsModel recent_projects_model_
static constexpr int kNumTriforces
const RecentProjectsModel & recent_projects() const
void SetLayoutOffsets(float left, float right)
Set layout offsets for sidebar awareness.
RecentAnnotationKind pending_annotation_kind_
static constexpr float kEntryAnimDuration
void SetOpenAssemblyEditorNoRomCallback(std::function< void()> callback)
Open the assembly editor for file/folder work (no ROM required).
void RefreshRecentProjects(bool force=false)
Refresh recent projects list from the project manager.
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_
RecentProjectsModel & recent_projects()
Accessor used by command-palette wiring so the same recent list drives both the visual cards and the ...
ImVec2 triforce_base_positions_[kNumTriforces]
Particle particles_[kMaxParticles]
void SetOpenPrototypeResearchCallback(std::function< void()> callback)
Open the graphics editor focused on prototype research (no ROM).
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_)
std::function< void()> open_project_dialog_callback_
void SetOpenProjectCallback(std::function< void(const std::string &)> callback)
Set callback for opening project.
std::function< void()> open_prototype_research_callback_
void SetContextState(bool has_rom, bool has_project)
Set context state for gating actions.
void SetUserSettings(UserSettings *settings)
Wire persisted user settings so animation tweaks survive restart.
std::function< void()> open_assembly_editor_no_rom_callback_
std::function< void()> open_agent_callback_
std::function< void()> open_project_management_callback_