add hyperlink to GitHub in the homepage for easier access to the project
This commit is contained in:
@@ -51,29 +51,6 @@ std::string GetEditorName(EditorType type) {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void EditorManager::DrawRomSelector() {
|
|
||||||
absl::Status status;
|
|
||||||
|
|
||||||
SameLine((GetWindowWidth() / 2) - 100);
|
|
||||||
if (current_rom_ && current_rom_->is_loaded()) {
|
|
||||||
SetNextItemWidth(GetWindowWidth() / 6);
|
|
||||||
if (BeginCombo("##ROMSelector", current_rom_->short_name().c_str())) {
|
|
||||||
for (const auto &rom : roms_) {
|
|
||||||
if (MenuItem(rom->short_name().c_str())) {
|
|
||||||
status = SetCurrentRom(rom.get());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EndCombo();
|
|
||||||
}
|
|
||||||
if (!status.ok()) {
|
|
||||||
std::string error_message = status.message().data();
|
|
||||||
throw std::runtime_error(error_message);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Text("No ROM loaded");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr const char *kOverworldEditorName = ICON_MD_LAYERS " Overworld Editor";
|
constexpr const char *kOverworldEditorName = ICON_MD_LAYERS " Overworld Editor";
|
||||||
constexpr const char *kGraphicsEditorName = ICON_MD_PHOTO " Graphics Editor";
|
constexpr const char *kGraphicsEditorName = ICON_MD_PHOTO " Graphics Editor";
|
||||||
constexpr const char *kPaletteEditorName = ICON_MD_PALETTE " Palette Editor";
|
constexpr const char *kPaletteEditorName = ICON_MD_PALETTE " Palette Editor";
|
||||||
@@ -351,12 +328,17 @@ absl::Status EditorManager::Update() {
|
|||||||
void EditorManager::DrawHomepage() {
|
void EditorManager::DrawHomepage() {
|
||||||
TextWrapped("Welcome to the Yet Another Zelda3 Editor (yaze)!");
|
TextWrapped("Welcome to the Yet Another Zelda3 Editor (yaze)!");
|
||||||
TextWrapped(
|
TextWrapped(
|
||||||
"This editor is designed to be a comprehensive tool for editing the "
|
"Comprehensive tool for editing the Legend of Zelda: A Link to the "
|
||||||
"Legend of Zelda: A Link to the Past.");
|
"Past.");
|
||||||
TextWrapped(
|
TextWrapped(
|
||||||
"The editor is still in development, so please report any bugs or issues "
|
"The editor is still in development, so please report any bugs or issues "
|
||||||
"you encounter.");
|
"you encounter.");
|
||||||
|
|
||||||
|
// Hyperlink to github
|
||||||
|
if (gui::ClickableText("https://github.com/scawful/yaze")) {
|
||||||
|
gui::OpenUrl("https://github.com/scawful/yaze");
|
||||||
|
}
|
||||||
|
|
||||||
if (!current_rom_) {
|
if (!current_rom_) {
|
||||||
TextWrapped("No ROM loaded.");
|
TextWrapped("No ROM loaded.");
|
||||||
if (gui::ClickableText("Open a ROM")) {
|
if (gui::ClickableText("Open a ROM")) {
|
||||||
@@ -410,6 +392,29 @@ void EditorManager::DrawHomepage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditorManager::DrawRomSelector() {
|
||||||
|
absl::Status status;
|
||||||
|
|
||||||
|
SameLine((GetWindowWidth() / 2) - 100);
|
||||||
|
if (current_rom_ && current_rom_->is_loaded()) {
|
||||||
|
SetNextItemWidth(GetWindowWidth() / 6);
|
||||||
|
if (BeginCombo("##ROMSelector", current_rom_->short_name().c_str())) {
|
||||||
|
for (const auto &rom : roms_) {
|
||||||
|
if (MenuItem(rom->short_name().c_str())) {
|
||||||
|
status = SetCurrentRom(rom.get());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EndCombo();
|
||||||
|
}
|
||||||
|
if (!status.ok()) {
|
||||||
|
std::string error_message = status.message().data();
|
||||||
|
throw std::runtime_error(error_message);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Text("No ROM loaded");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EditorManager::DrawMenuBar() {
|
void EditorManager::DrawMenuBar() {
|
||||||
static bool show_display_settings = false;
|
static bool show_display_settings = false;
|
||||||
static bool save_as_menu = false;
|
static bool save_as_menu = false;
|
||||||
@@ -545,9 +550,6 @@ absl::Status EditorManager::LoadRom() {
|
|||||||
manager.Save();
|
manager.Save();
|
||||||
RETURN_IF_ERROR(LoadAssets());
|
RETURN_IF_ERROR(LoadAssets());
|
||||||
|
|
||||||
// Show ROM info popup after loading
|
|
||||||
popup_manager_->Show("ROM Information");
|
|
||||||
|
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -192,35 +192,36 @@ void Paragraph(const std::string& text) {
|
|||||||
bool ClickableText(const std::string& text) {
|
bool ClickableText(const std::string& text) {
|
||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
ImGui::PushID(text.c_str());
|
ImGui::PushID(text.c_str());
|
||||||
|
|
||||||
// Calculate text size
|
// Calculate text size
|
||||||
ImVec2 text_size = ImGui::CalcTextSize(text.c_str());
|
ImVec2 text_size = ImGui::CalcTextSize(text.c_str());
|
||||||
|
|
||||||
// Get cursor position for hover detection
|
// Get cursor position for hover detection
|
||||||
ImVec2 pos = ImGui::GetCursorScreenPos();
|
ImVec2 pos = ImGui::GetCursorScreenPos();
|
||||||
ImRect bb(pos, ImVec2(pos.x + text_size.x, pos.y + text_size.y));
|
ImRect bb(pos, ImVec2(pos.x + text_size.x, pos.y + text_size.y));
|
||||||
|
|
||||||
// Add item
|
// Add item
|
||||||
const ImGuiID id = ImGui::GetID(text.c_str());
|
const ImGuiID id = ImGui::GetID(text.c_str());
|
||||||
bool result = false;
|
bool result = false;
|
||||||
if (ImGui::ItemAdd(bb, id)) {
|
if (ImGui::ItemAdd(bb, id)) {
|
||||||
bool hovered = ImGui::IsItemHovered();
|
bool hovered = ImGui::IsItemHovered();
|
||||||
bool clicked = ImGui::IsItemClicked();
|
bool clicked = ImGui::IsItemClicked();
|
||||||
|
|
||||||
// Render text with appropriate color
|
// Render text with appropriate color
|
||||||
ImVec4 color = hovered ? ImGui::GetStyleColorVec4(ImGuiCol_Text)
|
ImVec4 color = hovered ? ImGui::GetStyleColorVec4(ImGuiCol_Text)
|
||||||
: ImGui::GetStyleColorVec4(ImGuiCol_TextLink);
|
: ImGui::GetStyleColorVec4(ImGuiCol_TextLink);
|
||||||
ImGui::GetWindowDrawList()->AddText(pos, ImGui::ColorConvertFloat4ToU32(color), text.c_str());
|
ImGui::GetWindowDrawList()->AddText(
|
||||||
|
pos, ImGui::ColorConvertFloat4ToU32(color), text.c_str());
|
||||||
|
|
||||||
result = clicked;
|
result = clicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
|
|
||||||
// Advance cursor past the text
|
// Advance cursor past the text
|
||||||
ImGui::Dummy(text_size);
|
ImGui::Dummy(text_size);
|
||||||
ImGui::EndGroup();
|
ImGui::EndGroup();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,9 +250,9 @@ void ItemLabel(absl::string_view title, ItemLabelFlags flags) {
|
|||||||
ImGui::ItemSize(textRect);
|
ImGui::ItemSize(textRect);
|
||||||
if (ImGui::ItemAdd(
|
if (ImGui::ItemAdd(
|
||||||
textRect, window->GetID(title.data(), title.data() + title.size()))) {
|
textRect, window->GetID(title.data(), title.data() + title.size()))) {
|
||||||
ImGui::RenderTextEllipsis(
|
ImGui::RenderTextEllipsis(ImGui::GetWindowDrawList(), textRect.Min,
|
||||||
ImGui::GetWindowDrawList(), textRect.Min, textRect.Max, textRect.Max.x,
|
textRect.Max, textRect.Max.x, title.data(),
|
||||||
textRect.Max.x, title.data(), title.data() + title.size(), &textSize);
|
title.data() + title.size(), &textSize);
|
||||||
|
|
||||||
if (textRect.GetWidth() < textSize.x && ImGui::IsItemHovered())
|
if (textRect.GetWidth() < textSize.x && ImGui::IsItemHovered())
|
||||||
ImGui::SetTooltip("%.*s", (int)title.size(), title.data());
|
ImGui::SetTooltip("%.*s", (int)title.size(), title.data());
|
||||||
@@ -414,5 +415,10 @@ void DrawMenu(Menu& menu) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool OpenUrl(const std::string& url) {
|
||||||
|
// Open the url in the default browser
|
||||||
|
return system(("open " + url).c_str()) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace gui
|
} // namespace gui
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ static Menu kMainMenu;
|
|||||||
|
|
||||||
constexpr std::string kSeparator = "-";
|
constexpr std::string kSeparator = "-";
|
||||||
|
|
||||||
|
IMGUI_API bool OpenUrl(const std::string &url);
|
||||||
|
|
||||||
} // namespace gui
|
} // namespace gui
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user