Added editor codebase
This commit is contained in:
98
Editor/menu.cpp
Normal file
98
Editor/menu.cpp
Normal file
@@ -0,0 +1,98 @@
|
||||
#include <cstdio>
|
||||
#include <SDL2/SDL.h>
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
#include "imgui.h"
|
||||
#include "ssup.h"
|
||||
|
||||
#include "actions.cpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
void updateAppStyle(){
|
||||
switch (applicationStyle){
|
||||
case 0:
|
||||
ImGui::StyleColorsLight();
|
||||
break;
|
||||
case 1:
|
||||
ImGui::StyleColorsDark();
|
||||
break;
|
||||
default:
|
||||
ImGui::StyleColorsClassic();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void renderMenu(){
|
||||
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize(ImVec2(ImGui::GetMainViewport()->Size.x, 0), ImGuiCond_Always);
|
||||
ImGui::Begin("###INVISFRAME", NULL, ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_MenuBar);
|
||||
|
||||
if (ImGui::BeginMenuBar()){
|
||||
if (ImGui::BeginMenu(appLang == LANG::ENGLISH ? "Edit" : "Bearbeiten")){
|
||||
|
||||
ImGui::EndMenu();
|
||||
} if (ImGui::BeginMenu(appLang == LANG::ENGLISH ? "Actions" : "Aktionen")){
|
||||
|
||||
renderActions(),
|
||||
|
||||
ImGui::EndMenu();
|
||||
} if (ImGui::BeginMenu(appLang == LANG::ENGLISH ? "Settings" : "Einstellungen")){
|
||||
|
||||
|
||||
ImGui::SeparatorText("Application Style");
|
||||
if (ImGui::RadioButton(appLang == LANG::ENGLISH ? "Light" : "Hell", &applicationStyle, 0)) updateAppStyle();
|
||||
if (ImGui::RadioButton(appLang == LANG::ENGLISH ? "Dark" : "Dunkel", &applicationStyle, 1)) updateAppStyle();
|
||||
if (ImGui::RadioButton(appLang == LANG::ENGLISH ? "Classic" : "Klassisch", &applicationStyle, 2)) updateAppStyle();
|
||||
|
||||
ImGui::SeparatorText(appLang == LANG::ENGLISH ? "Language" : "Sprache");
|
||||
ImGui::RadioButton(appLang == LANG::ENGLISH ? "English" : "Englisch", &appLang, LANG::ENGLISH);
|
||||
ImGui::RadioButton(appLang == LANG::ENGLISH ? "Deutsch" : "German", &appLang, LANG::GERMAN);
|
||||
|
||||
ImGui::EndMenu();
|
||||
} if (ImGui::BeginMenu("About")){
|
||||
if (ImGui::Button(appLang == LANG::ENGLISH ? "Why does this exist?" : "Warum existiert sowas?")) ImGui::OpenPopup("Fuck School");
|
||||
|
||||
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
|
||||
ImGui::SetNextWindowPos(center, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
if (ImGui::BeginPopupModal("Fuck School", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
ImGui::Text(appLang == LANG::ENGLISH ?
|
||||
"Because: Fuck school\nBecause: Fuck math\nBecause: Free time is more valuable than fucking school" :
|
||||
"Weil: Fick Schule\nWeil: Fick Mathe\nWeil: Freizeit viel mehr Wert ist als scheiß Schule");
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::SetItemDefaultFocus();
|
||||
if (ImGui::Button("OK", ImVec2(120, 0))) ImGui::CloseCurrentPopup();
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
if (ImGui::Button(appLang == LANG::ENGLISH ? "License information" : "Lizenz Information")) ImGui::OpenPopup("Licence Info");
|
||||
|
||||
ImGui::SetNextWindowPos(center, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
|
||||
if (ImGui::BeginPopupModal("Licence Info", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||
ImGui::Text(appLang == LANG::ENGLISH ?
|
||||
"This shit is licenced under the GNU-GPL3 licence.\nThis means you can edit and modify this shit how ever you like.\nThe sourcecode and all info regarding the project can be found" :
|
||||
"Diese Scheiße ist unter der GNU-GPL3 Lizenz lizenziert.\nDas heißt du kannst änderungen und modifikationen vorhehmen, wie du möchtest.\nDer Source-Code und jegliche Info über das Projekt kann");
|
||||
ImGui::TextLinkOpenURL(appLang == LANG::ENGLISH ? "here at my Git instance" : "hier auf meiner Git Instanz", "https://git.weingardt.dev");
|
||||
ImGui::Text(appLang == LANG::ENGLISH ? "or" : "oder");
|
||||
ImGui::TextLinkOpenURL(appLang == LANG::ENGLISH ? "here on my website" : "hier auf meiner Webseite gefunden werden", "https://weingardt.dev/ssup");
|
||||
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
ImGui::SetItemDefaultFocus();
|
||||
if (ImGui::Button("OK", ImVec2(120, 0))) ImGui::CloseCurrentPopup();
|
||||
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
Reference in New Issue
Block a user