summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/editor.cpp42
-rw-r--r--src/editor.hpp3
2 files changed, 45 insertions, 0 deletions
diff --git a/src/editor.cpp b/src/editor.cpp
index 6d7e0d6..5b656c9 100644
--- a/src/editor.cpp
+++ b/src/editor.cpp
@@ -119,6 +119,36 @@ namespace silly::editor {
}
}
+ void Editor::showAboutWindow(const sf::RenderWindow &window) {
+ sf::Vector2u windowSize = window.getSize();
+
+ ImGui::SetNextWindowPos(
+ ImVec2(windowSize.x / 2.0f - 160, windowSize.y / 2.0f - 70));
+ ImGui::SetNextWindowSize(ImVec2(320, 140));
+ ImGui::Begin("About sillyeditor", NULL,
+ ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize);
+
+ ImGui::BeginChild("about_info");
+
+ ImGui::Text("Thanks for using sillyeditor!");
+ ImGui::Text("Developed by ilotterytea");
+ ImGui::Text("v0.1.0");
+
+ ImGui::Dummy(ImVec2(0, ImGui::GetContentRegionAvail().y - 32.0f));
+
+ ImGui::TextLinkOpenURL("Found bug?",
+ "https://github.com/ilotterytea/sillyeditor/issues");
+
+ ImGui::EndChild();
+
+ if (ImGui::IsWindowCollapsed()) {
+ ImGui::SetWindowCollapsed(false);
+ this->aboutState = false;
+ }
+
+ ImGui::End();
+ }
+
void Editor::createSavePackageWindow(const sf::RenderWindow &window) {
sf::Vector2u windowSize = window.getSize();
@@ -394,6 +424,14 @@ namespace silly::editor {
}
}
+ if (ImGui::BeginMenu("Help")) {
+ if (ImGui::MenuItem("About sillyeditor")) {
+ this->aboutState = true;
+ }
+
+ ImGui::EndMenu();
+ }
+
ImGui::SameLine(ImGui::GetContentRegionAvail().x - 200);
// Current level and floor info
@@ -569,6 +607,10 @@ namespace silly::editor {
ImGui::End();
+ if (this->aboutState) {
+ this->showAboutWindow(window);
+ }
+
if (package.get_name().empty() || this->newPackageState.has_value()) {
this->createNewPackage(window);
return;
diff --git a/src/editor.hpp b/src/editor.hpp
index aac6615..186cb5e 100644
--- a/src/editor.hpp
+++ b/src/editor.hpp
@@ -49,6 +49,7 @@ namespace silly::editor {
void createNewLevel(const sf::RenderWindow &window);
void createNewFloor(const sf::RenderWindow &window);
void createSavePackageWindow(const sf::RenderWindow &window);
+ void showAboutWindow(const sf::RenderWindow &window);
void drawHeaderBar(sf::RenderWindow &window);
LevelPackage &package;
@@ -59,6 +60,8 @@ namespace silly::editor {
float zoom = 1.0f;
bool isDragging = false;
+ bool aboutState = false;
+
std::optional<std::shared_ptr<TilesetTile>> selectedTile;
std::optional<NewTileState> newTileState;
std::optional<NewLevelState> newLevelState;