Skip to content

Commit 992f0de

Browse files
committed
begin working on popups
1 parent e4a3e5f commit 992f0de

1 file changed

Lines changed: 45 additions & 1 deletion

File tree

src/gui/gui.cpp

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88

99
std::string editor_text = "Bread Developer Suite";
1010

11+
bool open_about;
12+
bool open_credits;
13+
bool open_load;
14+
bool open_save;
15+
1116
static int string_resize(ImGuiInputTextCallbackData* data) {
1217
if (data->EventFlag == ImGuiInputTextFlags_CallbackResize) {
1318
std::string* str = (std::string*)data->UserData;
@@ -51,7 +56,46 @@ int main() {
5156
ImGui::DockSpaceOverViewport(0, ImGui::GetMainViewport());
5257
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->WorkPos);
5358
ImGui::SetNextWindowSize(ImGui::GetMainViewport()->WorkSize);
54-
ImGui::Begin("Bread Developer Suite");
59+
ImGui::Begin("Bread Developer Suite", NULL, ImGuiWindowFlags_MenuBar);
60+
if (ImGui::BeginMenuBar()) {
61+
if (ImGui::BeginMenu("About")) {
62+
if (ImGui::MenuItem("About")) {
63+
open_about = true;
64+
}
65+
if (ImGui::MenuItem("Credits")) {
66+
open_credits = true;
67+
}
68+
if (ImGui::MenuItem("Exit")) {
69+
break;
70+
}
71+
ImGui::EndMenu();
72+
}
73+
if (ImGui::BeginMenu("File")) {
74+
if (ImGui::MenuItem("Load")) {
75+
open_load = true;
76+
}
77+
if (ImGui::MenuItem("Save")) {
78+
open_save = true;
79+
}
80+
ImGui::EndMenu();
81+
}
82+
ImGui::EndMenuBar();
83+
}
84+
if (open_about == true) {
85+
ImGui::OpenPopup("about_popup");
86+
open_about = false;
87+
}
88+
if (ImGui::BeginPopupModal("about_popup", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
89+
ImGui::Text("Bread Developer Suite");
90+
ImGui::Text("Part of the bread compiler");
91+
ImGui::Text("Licensed under the MIT License, see license for more information");
92+
ImGui::Text("The developer suite was made possible with external libraries, see credits for more info");
93+
ImGui::Text("By angrypig555");
94+
if (ImGui::Button("Close")) {
95+
ImGui::CloseCurrentPopup();
96+
}
97+
ImGui::EndPopup();
98+
}
5599
ImGui::Text("Welcome to the Bread Developer Suite");
56100
if (compiler == 2) {
57101
ImGui::Text("Using compiler clang");

0 commit comments

Comments
 (0)