Added Google Abseil library

This commit is contained in:
Justin Scofield
2022-07-23 16:33:52 -04:00
parent 8aa19eae7e
commit 9655b35363
12 changed files with 376 additions and 144 deletions

View File

@@ -1,15 +1,53 @@
#include "widgets.h"
#include <ImGuiColorTextEdit/TextEditor.h>
#include "absl/status/status.h"
#include "app/core/constants.h"
namespace yaze {
namespace gui {
namespace widgets {
bool BeginCentered(const char *name) {
ImGuiIO &io = ImGui::GetIO();
ImVec2 pos(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.5f);
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, ImVec2(0.5f, 0.5f));
ImGuiWindowFlags flags = ImGuiWindowFlags_NoMove |
ImGuiWindowFlags_NoDecoration |
ImGuiWindowFlags_AlwaysAutoResize;
return ImGui::Begin(name, nullptr, flags);
}
void DisplayStatus(const absl::Status &status) {
static bool display_open = true;
if (display_open) {
auto title = absl::StrCat("StatusWindow_", status.ToString()).data();
if (BeginCentered(title)) {
ImGui::Text(status.ToString().data());
ImGui::Spacing();
ImGui::NextColumn();
ImGui::Columns(1);
ImGui::Separator();
ImGui::NewLine();
ImGui::SameLine(270);
// click ok when finished adjusting
if (ImGui::Button("OK", ImVec2(200, 0))) {
display_open = false;
}
ImGui::End();
}
}
}
TextEditor::LanguageDefinition GetAssemblyLanguageDef() {
TextEditor::LanguageDefinition language_65816;
for (auto &k : app::core::kKeywords)
language_65816.mKeywords.emplace(k);
for (auto &k : app::core::kKeywords) language_65816.mKeywords.emplace(k);
for (auto &k : app::core::kIdentifiers) {
TextEditor::Identifier id;

View File

@@ -3,13 +3,18 @@
#include <ImGuiColorTextEdit/TextEditor.h>
#include "absl/status/status.h"
#include "app/core/constants.h"
namespace yaze {
namespace gui {
namespace widgets {
void DisplayStatus(const absl::Status& status);
TextEditor::LanguageDefinition GetAssemblyLanguageDef();
}
} // namespace widgets
} // namespace gui
} // namespace yaze