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
58 void SetOpenProjectCallback(std::function<void(const std::string&)> callback) {
59 open_project_callback_ = callback;
60 }
61
66
70 void UpdateAnimations();
71
75 bool ShouldShow() const { return !manually_closed_; }
76
81
86
87 private:
88 void DrawHeader();
89 void DrawQuickActions();
90 void DrawRecentProjects();
91 void DrawProjectCard(const RecentProject& project, int index);
93 void DrawTipsSection();
94 void DrawWhatsNew();
95
96 std::vector<RecentProject> recent_projects_;
97 bool manually_closed_ = false;
98 bool first_show_attempt_ = true; // Override ImGui ini state on first display
99
100 // Callbacks
101 std::function<void()> open_rom_callback_;
102 std::function<void()> new_project_callback_;
103 std::function<void(const std::string&)> open_project_callback_;
104
105 // UI state
107 static constexpr int kMaxRecentProjects = 6;
108
109 // Animation state
110 float animation_time_ = 0.0f;
111 float card_hover_scale_[6] = {1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f};
113
114 // Interactive triforce positions (smooth interpolation)
115 static constexpr int kNumTriforces = 6;
119
120 // Particle system
121 static constexpr int kMaxParticles = 50;
122 struct Particle {
123 ImVec2 position;
124 ImVec2 velocity;
125 float size;
126 float alpha;
127 float lifetime;
129 };
132
133 // Triforce animation settings
136 float triforce_speed_multiplier_ = 0.3f; // Default slower speed
140 float particle_spawn_rate_ = 2.0f; // Particles per second
141};
142
143} // namespace editor
144} // namespace yaze
145
146#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.
static constexpr int kNumTriforces
std::vector< RecentProject > recent_projects_
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 UpdateAnimations()
Update animation time for dynamic effects.
static constexpr int kMaxParticles
bool Show(bool *p_open)
Show the welcome screen.
ImVec2 triforce_positions_[kNumTriforces]
static constexpr int kMaxRecentProjects
void SetOpenProjectCallback(std::function< void(const std::string &)> callback)
Set callback for opening project.
std::function< void(const std::string &)> open_project_callback_
void ResetFirstShow()
Reset first show flag (for testing/forcing display)
void DrawProjectCard(const RecentProject &project, int index)
Main namespace for the application.
Definition controller.cc:20
Information about a recently used project.