backend-infra-engineer: format welcome screen
This commit is contained in:
@@ -173,9 +173,8 @@ GridLayout ComputeGridLayout(float avail_width, float min_width,
|
|||||||
static_cast<float>(columns);
|
static_cast<float>(columns);
|
||||||
};
|
};
|
||||||
|
|
||||||
layout.columns =
|
layout.columns = std::max(1, static_cast<int>((avail_width + spacing) /
|
||||||
std::max(1, static_cast<int>((avail_width + spacing) /
|
(preferred_width + spacing)));
|
||||||
(preferred_width + spacing)));
|
|
||||||
|
|
||||||
layout.item_width = width_for_columns(layout.columns);
|
layout.item_width = width_for_columns(layout.columns);
|
||||||
while (layout.columns > 1 && layout.item_width < min_width) {
|
while (layout.columns > 1 && layout.item_width < min_width) {
|
||||||
@@ -250,11 +249,10 @@ bool WelcomeScreen::Show(bool* p_open) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Window flags: allow menu bar to be clickable by not bringing to front
|
// Window flags: allow menu bar to be clickable by not bringing to front
|
||||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoCollapse |
|
ImGuiWindowFlags window_flags =
|
||||||
ImGuiWindowFlags_NoResize |
|
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize |
|
||||||
ImGuiWindowFlags_NoMove |
|
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoBringToFrontOnFocus |
|
||||||
ImGuiWindowFlags_NoBringToFrontOnFocus |
|
ImGuiWindowFlags_NoTitleBar;
|
||||||
ImGuiWindowFlags_NoTitleBar;
|
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 20));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20, 20));
|
||||||
|
|
||||||
@@ -450,7 +448,8 @@ bool WelcomeScreen::Show(bool* p_open) {
|
|||||||
const bool narrow_layout = content_width < 900.0f;
|
const bool narrow_layout = content_width < 900.0f;
|
||||||
|
|
||||||
if (narrow_layout) {
|
if (narrow_layout) {
|
||||||
float left_height = std::clamp(content_height * 0.45f, 260.0f, content_height);
|
float left_height =
|
||||||
|
std::clamp(content_height * 0.45f, 260.0f, content_height);
|
||||||
ImGui::BeginChild("LeftPanel", ImVec2(0, left_height), true,
|
ImGui::BeginChild("LeftPanel", ImVec2(0, left_height), true,
|
||||||
ImGuiWindowFlags_NoScrollbar);
|
ImGuiWindowFlags_NoScrollbar);
|
||||||
DrawQuickActions();
|
DrawQuickActions();
|
||||||
@@ -487,8 +486,8 @@ bool WelcomeScreen::Show(bool* p_open) {
|
|||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
} else {
|
} else {
|
||||||
ImGui::BeginChild("LeftPanel",
|
ImGui::BeginChild("LeftPanel",
|
||||||
ImVec2(ImGui::GetContentRegionAvail().x * 0.3f, 0), true,
|
ImVec2(ImGui::GetContentRegionAvail().x * 0.3f, 0),
|
||||||
ImGuiWindowFlags_NoScrollbar);
|
true, ImGuiWindowFlags_NoScrollbar);
|
||||||
DrawQuickActions();
|
DrawQuickActions();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
@@ -705,8 +704,8 @@ void WelcomeScreen::DrawQuickActions() {
|
|||||||
// Handled by callback
|
// Handled by callback
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip(
|
ImGui::SetTooltip(ICON_MD_INFO
|
||||||
ICON_MD_INFO " Open a clean, legally obtained ALttP (USA) ROM file");
|
" Open a clean, legally obtained ALttP (USA) ROM file");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
@@ -717,7 +716,8 @@ void WelcomeScreen::DrawQuickActions() {
|
|||||||
// Handled by callback
|
// Handled by callback
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip(ICON_MD_INFO " Create a new project from a ROM and template");
|
ImGui::SetTooltip(ICON_MD_INFO
|
||||||
|
" Create a new project from a ROM and template");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
@@ -728,8 +728,8 @@ void WelcomeScreen::DrawQuickActions() {
|
|||||||
// Handled by callback
|
// Handled by callback
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip(
|
ImGui::SetTooltip(ICON_MD_INFO
|
||||||
ICON_MD_INFO " Ask the AI agent to guide edits in natural language");
|
" Ask the AI agent to guide edits in natural language");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,16 +758,17 @@ void WelcomeScreen::DrawRecentProjects() {
|
|||||||
|
|
||||||
const float scale = ImGui::GetFontSize() / 16.0f;
|
const float scale = ImGui::GetFontSize() / 16.0f;
|
||||||
const float min_width = kRecentCardBaseWidth * scale;
|
const float min_width = kRecentCardBaseWidth * scale;
|
||||||
const float max_width = kRecentCardBaseWidth * kRecentCardWidthMaxFactor * scale;
|
const float max_width =
|
||||||
|
kRecentCardBaseWidth * kRecentCardWidthMaxFactor * scale;
|
||||||
const float min_height = kRecentCardBaseHeight * scale;
|
const float min_height = kRecentCardBaseHeight * scale;
|
||||||
const float max_height = kRecentCardBaseHeight * kRecentCardHeightMaxFactor * scale;
|
const float max_height =
|
||||||
|
kRecentCardBaseHeight * kRecentCardHeightMaxFactor * scale;
|
||||||
const float spacing = ImGui::GetStyle().ItemSpacing.x;
|
const float spacing = ImGui::GetStyle().ItemSpacing.x;
|
||||||
const float aspect_ratio = min_height / std::max(min_width, 1.0f);
|
const float aspect_ratio = min_height / std::max(min_width, 1.0f);
|
||||||
|
|
||||||
GridLayout layout = ComputeGridLayout(ImGui::GetContentRegionAvail().x,
|
GridLayout layout = ComputeGridLayout(
|
||||||
min_width, max_width, min_height,
|
ImGui::GetContentRegionAvail().x, min_width, max_width, min_height,
|
||||||
max_height, min_width, aspect_ratio,
|
max_height, min_width, aspect_ratio, spacing);
|
||||||
spacing);
|
|
||||||
|
|
||||||
int column = 0;
|
int column = 0;
|
||||||
for (size_t i = 0; i < recent_projects_.size(); ++i) {
|
for (size_t i = 0; i < recent_projects_.size(); ++i) {
|
||||||
@@ -837,8 +838,7 @@ void WelcomeScreen::DrawProjectPanel(const RecentProject& project, int index,
|
|||||||
cursor_pos,
|
cursor_pos,
|
||||||
ImVec2(cursor_pos.x + resolved_card_size.x,
|
ImVec2(cursor_pos.x + resolved_card_size.x,
|
||||||
cursor_pos.y + resolved_card_size.y),
|
cursor_pos.y + resolved_card_size.y),
|
||||||
color_top_u32,
|
color_top_u32, color_top_u32, color_bottom_u32, color_bottom_u32);
|
||||||
color_top_u32, color_bottom_u32, color_bottom_u32);
|
|
||||||
|
|
||||||
// Static themed border
|
// Static themed border
|
||||||
ImVec4 border_color_base = (index % 3 == 0) ? kHyruleGreen
|
ImVec4 border_color_base = (index % 3 == 0) ? kHyruleGreen
|
||||||
@@ -847,11 +847,10 @@ void WelcomeScreen::DrawProjectPanel(const RecentProject& project, int index,
|
|||||||
ImU32 border_color = ImGui::GetColorU32(ImVec4(
|
ImU32 border_color = ImGui::GetColorU32(ImVec4(
|
||||||
border_color_base.x, border_color_base.y, border_color_base.z, 0.5f));
|
border_color_base.x, border_color_base.y, border_color_base.z, 0.5f));
|
||||||
|
|
||||||
draw_list->AddRect(
|
draw_list->AddRect(cursor_pos,
|
||||||
cursor_pos,
|
ImVec2(cursor_pos.x + resolved_card_size.x,
|
||||||
ImVec2(cursor_pos.x + resolved_card_size.x,
|
cursor_pos.y + resolved_card_size.y),
|
||||||
cursor_pos.y + resolved_card_size.y),
|
border_color, 6.0f, 0, 2.0f);
|
||||||
border_color, 6.0f, 0, 2.0f);
|
|
||||||
|
|
||||||
// Make the card clickable
|
// Make the card clickable
|
||||||
ImGui::SetCursorScreenPos(cursor_pos);
|
ImGui::SetCursorScreenPos(cursor_pos);
|
||||||
@@ -867,11 +866,10 @@ void WelcomeScreen::DrawProjectPanel(const RecentProject& project, int index,
|
|||||||
if (is_hovered) {
|
if (is_hovered) {
|
||||||
ImU32 hover_color = ImGui::GetColorU32(
|
ImU32 hover_color = ImGui::GetColorU32(
|
||||||
ImVec4(kTriforceGold.x, kTriforceGold.y, kTriforceGold.z, 0.15f));
|
ImVec4(kTriforceGold.x, kTriforceGold.y, kTriforceGold.z, 0.15f));
|
||||||
draw_list->AddRectFilled(
|
draw_list->AddRectFilled(cursor_pos,
|
||||||
cursor_pos,
|
ImVec2(cursor_pos.x + resolved_card_size.x,
|
||||||
ImVec2(cursor_pos.x + resolved_card_size.x,
|
cursor_pos.y + resolved_card_size.y),
|
||||||
cursor_pos.y + resolved_card_size.y),
|
hover_color, 6.0f);
|
||||||
hover_color, 6.0f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw content (tighter layout)
|
// Draw content (tighter layout)
|
||||||
@@ -1018,11 +1016,10 @@ void WelcomeScreen::DrawTemplatesSection() {
|
|||||||
Template templates[] = {
|
Template templates[] = {
|
||||||
{ICON_MD_COTTAGE, "Vanilla ROM Hack",
|
{ICON_MD_COTTAGE, "Vanilla ROM Hack",
|
||||||
"Standard editing without custom ASM", "Vanilla ROM Hack", kHyruleGreen},
|
"Standard editing without custom ASM", "Vanilla ROM Hack", kHyruleGreen},
|
||||||
{ICON_MD_MAP, "ZSCustomOverworld v3",
|
{ICON_MD_MAP, "ZSCustomOverworld v3", "Full overworld expansion features",
|
||||||
"Full overworld expansion features", "ZSCustomOverworld v3 (Recommended)",
|
"ZSCustomOverworld v3 (Recommended)", kMasterSwordBlue},
|
||||||
kMasterSwordBlue},
|
{ICON_MD_LAYERS, "ZSCustomOverworld v2", "Basic overworld expansion",
|
||||||
{ICON_MD_LAYERS, "ZSCustomOverworld v2",
|
"ZSCustomOverworld v2", kShadowPurple},
|
||||||
"Basic overworld expansion", "ZSCustomOverworld v2", kShadowPurple},
|
|
||||||
{ICON_MD_SHUFFLE, "Randomizer Compatible",
|
{ICON_MD_SHUFFLE, "Randomizer Compatible",
|
||||||
"Minimal custom features for rando", "Randomizer Compatible",
|
"Minimal custom features for rando", "Randomizer Compatible",
|
||||||
kSpiritOrange},
|
kSpiritOrange},
|
||||||
@@ -1072,7 +1069,8 @@ void WelcomeScreen::DrawTemplatesSection() {
|
|||||||
ImVec2(-1, 30))) {
|
ImVec2(-1, 30))) {
|
||||||
// Trigger template-based project creation
|
// Trigger template-based project creation
|
||||||
if (new_project_with_template_callback_) {
|
if (new_project_with_template_callback_) {
|
||||||
new_project_with_template_callback_(templates[selected_template_].template_id);
|
new_project_with_template_callback_(
|
||||||
|
templates[selected_template_].template_id);
|
||||||
} else if (new_project_callback_) {
|
} else if (new_project_callback_) {
|
||||||
// Fallback to regular new project if template callback not set
|
// Fallback to regular new project if template callback not set
|
||||||
new_project_callback_();
|
new_project_callback_();
|
||||||
@@ -1082,9 +1080,10 @@ void WelcomeScreen::DrawTemplatesSection() {
|
|||||||
ImGui::PopStyleColor(3);
|
ImGui::PopStyleColor(3);
|
||||||
|
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("%s Create new project with '%s' template\nThis will "
|
ImGui::SetTooltip(
|
||||||
"open a ROM and apply the template settings.",
|
"%s Create new project with '%s' template\nThis will "
|
||||||
ICON_MD_INFO, templates[selected_template_].name);
|
"open a ROM and apply the template settings.",
|
||||||
|
ICON_MD_INFO, templates[selected_template_].name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1134,9 +1133,11 @@ void WelcomeScreen::DrawWhatsNew() {
|
|||||||
|
|
||||||
Feature features[] = {
|
Feature features[] = {
|
||||||
{ICON_MD_MUSIC_NOTE, "Music Editor",
|
{ICON_MD_MUSIC_NOTE, "Music Editor",
|
||||||
"Complete SPC music editing with piano roll and tracker views", kTriforceGold},
|
"Complete SPC music editing with piano roll and tracker views",
|
||||||
|
kTriforceGold},
|
||||||
{ICON_MD_PIANO, "Piano Roll & Playback",
|
{ICON_MD_PIANO, "Piano Roll & Playback",
|
||||||
"Visual note editing with authentic N-SPC audio preview", kMasterSwordBlue},
|
"Visual note editing with authentic N-SPC audio preview",
|
||||||
|
kMasterSwordBlue},
|
||||||
{ICON_MD_SPEAKER, "Instrument Editor",
|
{ICON_MD_SPEAKER, "Instrument Editor",
|
||||||
"Edit ADSR envelopes, samples, and instrument banks", kHyruleGreen},
|
"Edit ADSR envelopes, samples, and instrument banks", kHyruleGreen},
|
||||||
{ICON_MD_PSYCHOLOGY, "AI Agent Integration",
|
{ICON_MD_PSYCHOLOGY, "AI Agent Integration",
|
||||||
|
|||||||
Reference in New Issue
Block a user