backend-infra-engineer: Pre-0.2.2 snapshot (2023)

This commit is contained in:
scawful
2023-12-29 22:43:40 -05:00
parent e7470bdfac
commit d94b7a3e81
174 changed files with 31731 additions and 4836 deletions

79
src/app/gui/widgets.h Normal file
View File

@@ -0,0 +1,79 @@
#ifndef YAZE_GUI_WIDGETS_H
#define YAZE_GUI_WIDGETS_H
#include <ImGuiColorTextEdit/TextEditor.h>
#include <imgui/imgui.h>
#include <imgui/misc/cpp/imgui_stdlib.h>
#include <functional>
#include <vector>
#include "absl/status/status.h"
#include "app/core/constants.h"
#include "app/gfx/bitmap.h"
namespace yaze {
namespace app {
namespace gui {
class DynamicLayout {
};
TextEditor::LanguageDefinition GetAssemblyLanguageDef();
void RenderTabItem(const std::string& title,
const std::function<void()>& render_func);
class BitmapViewer {
public:
BitmapViewer() : current_bitmap_index_(0) {}
void Display(const std::vector<gfx::Bitmap>& bitmaps) {
if (bitmaps.empty()) {
ImGui::Text("No bitmaps available.");
return;
}
// Display the current bitmap index and total count.
ImGui::Text("Viewing Bitmap %d / %zu", current_bitmap_index_ + 1,
bitmaps.size());
// Buttons to navigate through bitmaps.
if (ImGui::Button("<- Prev")) {
if (current_bitmap_index_ > 0) {
--current_bitmap_index_;
}
}
ImGui::SameLine();
if (ImGui::Button("Next ->")) {
if (current_bitmap_index_ < bitmaps.size() - 1) {
++current_bitmap_index_;
}
}
// Display the current bitmap.
const gfx::Bitmap& current_bitmap = bitmaps[current_bitmap_index_];
// Assuming Bitmap has a function to get its texture ID, and width and
// height.
ImTextureID tex_id = current_bitmap.texture();
ImVec2 size(current_bitmap.width(), current_bitmap.height());
ImGui::Image(tex_id, size);
// Scroll if the image is larger than the display area.
if (ImGui::BeginChild("BitmapScrollArea", ImVec2(0, 0), false,
ImGuiWindowFlags_HorizontalScrollbar)) {
ImGui::Image(tex_id, size);
ImGui::EndChild();
}
}
private:
int current_bitmap_index_;
};
} // namespace gui
} // namespace app
} // namespace yaze
#endif