move DungeonEditor, merge widgets with style, split up CMakeLists
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
include(app/editor/CMakeLists.txt)
|
||||
|
||||
add_executable(
|
||||
yaze
|
||||
app/yaze.cc
|
||||
|
||||
19
src/app/editor/CMakeLists.txt
Normal file
19
src/app/editor/CMakeLists.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
set(
|
||||
YAZE_APP_EDITOR_SRC
|
||||
app/editor/dungeon/dungeon_editor.cc
|
||||
app/editor/master_editor.cc
|
||||
app/editor/settings_editor.cc
|
||||
app/editor/overworld_editor.cc
|
||||
app/editor/sprite/sprite_editor.cc
|
||||
app/editor/music/music_editor.cc
|
||||
app/editor/message/message_editor.cc
|
||||
app/editor/code/assembly_editor.cc
|
||||
app/editor/graphics/screen_editor.cc
|
||||
app/editor/graphics/graphics_editor.cc
|
||||
app/editor/graphics/palette_editor.cc
|
||||
app/editor/graphics/tile16_editor.cc
|
||||
app/editor/graphics/gfx_group_editor.cc
|
||||
app/editor/utils/gfx_context.cc
|
||||
app/editor/overworld/refresh.cc
|
||||
app/editor/overworld/entity.cc
|
||||
)
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "app/core/platform/file_dialog.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
#include "app/gui/widgets.h"
|
||||
#include "core/constants.h"
|
||||
|
||||
namespace yaze {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "app/core/common.h"
|
||||
#include "app/editor/utils/editor.h"
|
||||
#include "app/gui/widgets.h"
|
||||
#include "app/gui/style.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "app/editor/code/assembly_editor.h"
|
||||
#include "app/editor/code/memory_editor.h"
|
||||
#include "app/editor/utils/gfx_context.h"
|
||||
#include "app/editor/dungeon_editor.h"
|
||||
#include "app/editor/dungeon/dungeon_editor.h"
|
||||
#include "app/editor/graphics/graphics_editor.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/editor/graphics/screen_editor.h"
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "app/gui/input.h"
|
||||
#include "app/gui/pipeline.h"
|
||||
#include "app/gui/style.h"
|
||||
#include "app/gui/widgets.h"
|
||||
#include "app/rom.h"
|
||||
|
||||
namespace yaze {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
#include "app/gui/pipeline.h"
|
||||
#include "app/gui/widgets.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/overworld/overworld.h"
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/pipeline.h"
|
||||
#include "app/gui/widgets.h"
|
||||
#include "app/gui/style.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/overworld/overworld.h"
|
||||
|
||||
|
||||
@@ -389,10 +389,12 @@ absl::Status GraphicsEditor::UpdateLinkGfxView() {
|
||||
NEXT_COLUMN();
|
||||
link_canvas_.DrawBackground();
|
||||
link_canvas_.DrawGrid(16.0f);
|
||||
|
||||
int i = 0;
|
||||
for (auto [key, link_sheet] : rom()->link_graphics()) {
|
||||
for (auto [key, link_sheet] : *rom()->mutable_link_graphics()) {
|
||||
int x_offset = 0;
|
||||
int y_offset = core::kTilesheetHeight * i * 4;
|
||||
link_canvas_.DrawContextMenu(&link_sheet);
|
||||
link_canvas_.DrawBitmap(link_sheet, x_offset, y_offset, 4);
|
||||
i++;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include "app/gui/input.h"
|
||||
#include "app/gui/pipeline.h"
|
||||
#include "app/gui/style.h"
|
||||
#include "app/gui/widgets.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/overworld/overworld.h"
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "app/core/constants.h"
|
||||
#include "app/core/platform/file_dialog.h"
|
||||
#include "app/editor/code/assembly_editor.h"
|
||||
#include "app/editor/dungeon_editor.h"
|
||||
#include "app/editor/dungeon/dungeon_editor.h"
|
||||
#include "app/editor/graphics/graphics_editor.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/editor/graphics/screen_editor.h"
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "app/gui/input.h"
|
||||
#include "app/gui/pipeline.h"
|
||||
#include "app/gui/style.h"
|
||||
#include "app/gui/widgets.h"
|
||||
#include "app/rom.h"
|
||||
|
||||
namespace yaze {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "app/core/project.h"
|
||||
#include "app/editor/code/assembly_editor.h"
|
||||
#include "app/editor/code/memory_editor.h"
|
||||
#include "app/editor/dungeon_editor.h"
|
||||
#include "app/editor/dungeon/dungeon_editor.h"
|
||||
#include "app/editor/graphics/graphics_editor.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/editor/graphics/screen_editor.h"
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "app/gui/input.h"
|
||||
#include "app/gui/pipeline.h"
|
||||
#include "app/gui/style.h"
|
||||
#include "app/gui/widgets.h"
|
||||
#include "app/gui/zeml.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/overworld/overworld.h"
|
||||
|
||||
@@ -517,6 +517,95 @@ void ColorsYaze() {
|
||||
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);
|
||||
}
|
||||
|
||||
void RenderTabItem(const std::string& title,
|
||||
const std::function<void()>& render_func) {
|
||||
if (ImGui::BeginTabItem(title.c_str())) {
|
||||
render_func();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// 65816 LanguageDefinition
|
||||
// ============================================================================
|
||||
|
||||
static const char* const kKeywords[] = {
|
||||
"ADC", "AND", "ASL", "BCC", "BCS", "BEQ", "BIT", "BMI", "BNE",
|
||||
"BPL", "BRA", "BRL", "BVC", "BVS", "CLC", "CLD", "CLI", "CLV",
|
||||
"CMP", "CPX", "CPY", "DEC", "DEX", "DEY", "EOR", "INC", "INX",
|
||||
"INY", "JMP", "JSR", "JSL", "LDA", "LDX", "LDY", "LSR", "MVN",
|
||||
"NOP", "ORA", "PEA", "PER", "PHA", "PHB", "PHD", "PHP", "PHX",
|
||||
"PHY", "PLA", "PLB", "PLD", "PLP", "PLX", "PLY", "REP", "ROL",
|
||||
"ROR", "RTI", "RTL", "RTS", "SBC", "SEC", "SEI", "SEP", "STA",
|
||||
"STP", "STX", "STY", "STZ", "TAX", "TAY", "TCD", "TCS", "TDC",
|
||||
"TRB", "TSB", "TSC", "TSX", "TXA", "TXS", "TXY", "TYA", "TYX",
|
||||
"WAI", "WDM", "XBA", "XCE", "ORG", "LOROM", "HIROM", "NAMESPACE", "DB"};
|
||||
|
||||
static const char* const kIdentifiers[] = {
|
||||
"abort", "abs", "acos", "asin", "atan", "atexit",
|
||||
"atof", "atoi", "atol", "ceil", "clock", "cosh",
|
||||
"ctime", "div", "exit", "fabs", "floor", "fmod",
|
||||
"getchar", "getenv", "isalnum", "isalpha", "isdigit", "isgraph",
|
||||
"ispunct", "isspace", "isupper", "kbhit", "log10", "log2",
|
||||
"log", "memcmp", "modf", "pow", "putchar", "putenv",
|
||||
"puts", "rand", "remove", "rename", "sinh", "sqrt",
|
||||
"srand", "strcat", "strcmp", "strerror", "time", "tolower",
|
||||
"toupper"};
|
||||
|
||||
TextEditor::LanguageDefinition GetAssemblyLanguageDef() {
|
||||
TextEditor::LanguageDefinition language_65816;
|
||||
for (auto& k : kKeywords) language_65816.mKeywords.emplace(k);
|
||||
|
||||
for (auto& k : kIdentifiers) {
|
||||
TextEditor::Identifier id;
|
||||
id.mDeclaration = "Built-in function";
|
||||
language_65816.mIdentifiers.insert(std::make_pair(std::string(k), id));
|
||||
}
|
||||
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"[ \\t]*#[ \\t]*[a-zA-Z_]+", TextEditor::PaletteIndex::Preprocessor));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"L?\\\"(\\\\.|[^\\\"])*\\\"", TextEditor::PaletteIndex::String));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"\\'\\\\?[^\\']\\'", TextEditor::PaletteIndex::CharLiteral));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?",
|
||||
TextEditor::PaletteIndex::Number));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"[+-]?[0-9]+[Uu]?[lL]?[lL]?", TextEditor::PaletteIndex::Number));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"0[0-7]+[Uu]?[lL]?[lL]?", TextEditor::PaletteIndex::Number));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?",
|
||||
TextEditor::PaletteIndex::Number));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"[a-zA-Z_][a-zA-Z0-9_]*", TextEditor::PaletteIndex::Identifier));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/"
|
||||
"\\;\\,\\.]",
|
||||
TextEditor::PaletteIndex::Punctuation));
|
||||
|
||||
language_65816.mCommentStart = "/*";
|
||||
language_65816.mCommentEnd = "*/";
|
||||
language_65816.mSingleLineComment = ";";
|
||||
|
||||
language_65816.mCaseSensitive = false;
|
||||
language_65816.mAutoIndentation = true;
|
||||
|
||||
language_65816.mName = "65816";
|
||||
|
||||
return language_65816;
|
||||
}
|
||||
|
||||
} // namespace gui
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
@@ -1,9 +1,17 @@
|
||||
#ifndef YAZE_APP_CORE_STYLE_H
|
||||
#define YAZE_APP_CORE_STYLE_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 "absl/strings/string_view.h"
|
||||
#include "app/core/constants.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
@@ -21,7 +29,7 @@ void EndPadding();
|
||||
void BeginNoPadding();
|
||||
void EndNoPadding();
|
||||
|
||||
void BeginChildWithScrollbar(const char *str_id);
|
||||
void BeginChildWithScrollbar(const char* str_id);
|
||||
|
||||
void BeginChildBothScrollbars(int id);
|
||||
|
||||
@@ -31,6 +39,111 @@ void TextWithSeparators(const absl::string_view& text);
|
||||
|
||||
void ColorsYaze();
|
||||
|
||||
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, float scale = 1.0f) {
|
||||
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() * scale,
|
||||
current_bitmap.height() * scale);
|
||||
// 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_;
|
||||
};
|
||||
|
||||
// ============================================================================
|
||||
|
||||
static const char* ExampleNames[] = {
|
||||
"Artichoke", "Arugula", "Asparagus", "Avocado",
|
||||
"Bamboo Shoots", "Bean Sprouts", "Beans", "Beet",
|
||||
"Belgian Endive", "Bell Pepper", "Bitter Gourd", "Bok Choy",
|
||||
"Broccoli", "Brussels Sprouts", "Burdock Root", "Cabbage",
|
||||
"Calabash", "Capers", "Carrot", "Cassava",
|
||||
"Cauliflower", "Celery", "Celery Root", "Celcuce",
|
||||
"Chayote", "Chinese Broccoli", "Corn", "Cucumber"};
|
||||
|
||||
struct MultiSelectWithClipper {
|
||||
const int ITEMS_COUNT = 10000;
|
||||
void Update() {
|
||||
// Use default selection.Adapter: Pass index to
|
||||
// SetNextItemSelectionUserData(), store index in Selection
|
||||
static ImGuiSelectionBasicStorage selection;
|
||||
|
||||
ImGui::Text("Selection: %d/%d", selection.Size, ITEMS_COUNT);
|
||||
if (ImGui::BeginChild(
|
||||
"##Basket", ImVec2(-FLT_MIN, ImGui::GetFontSize() * 20),
|
||||
ImGuiChildFlags_FrameStyle | ImGuiChildFlags_ResizeY)) {
|
||||
ImGuiMultiSelectFlags flags = ImGuiMultiSelectFlags_ClearOnEscape |
|
||||
ImGuiMultiSelectFlags_BoxSelect1d;
|
||||
ImGuiMultiSelectIO* ms_io =
|
||||
ImGui::BeginMultiSelect(flags, selection.Size, ITEMS_COUNT);
|
||||
selection.ApplyRequests(ms_io);
|
||||
|
||||
ImGuiListClipper clipper;
|
||||
clipper.Begin(ITEMS_COUNT);
|
||||
if (ms_io->RangeSrcItem != -1)
|
||||
clipper.IncludeItemByIndex(
|
||||
(int)ms_io->RangeSrcItem); // Ensure RangeSrc item is not clipped.
|
||||
while (clipper.Step()) {
|
||||
for (int n = clipper.DisplayStart; n < clipper.DisplayEnd; n++) {
|
||||
char label[64];
|
||||
// sprintf(label, "Object %05d: %s", n,
|
||||
// ExampleNames[n % IM_ARRAYSIZE(ExampleNames)]);
|
||||
bool item_is_selected = selection.Contains((ImGuiID)n);
|
||||
ImGui::SetNextItemSelectionUserData(n);
|
||||
ImGui::Selectable(label, item_is_selected);
|
||||
}
|
||||
}
|
||||
|
||||
ms_io = ImGui::EndMultiSelect();
|
||||
selection.ApplyRequests(ms_io);
|
||||
}
|
||||
ImGui::EndChild();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
#include "widgets.h"
|
||||
|
||||
#include <ImGuiColorTextEdit/TextEditor.h>
|
||||
#include <imgui_memory_editor.h>
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "app/core/constants.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
namespace gui {
|
||||
|
||||
void RenderTabItem(const std::string &title,
|
||||
const std::function<void()> &render_func) {
|
||||
if (ImGui::BeginTabItem(title.c_str())) {
|
||||
render_func();
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// 65816 LanguageDefinition
|
||||
// ============================================================================
|
||||
|
||||
static const char *const kKeywords[] = {
|
||||
"ADC", "AND", "ASL", "BCC", "BCS", "BEQ", "BIT", "BMI", "BNE",
|
||||
"BPL", "BRA", "BRL", "BVC", "BVS", "CLC", "CLD", "CLI", "CLV",
|
||||
"CMP", "CPX", "CPY", "DEC", "DEX", "DEY", "EOR", "INC", "INX",
|
||||
"INY", "JMP", "JSR", "JSL", "LDA", "LDX", "LDY", "LSR", "MVN",
|
||||
"NOP", "ORA", "PEA", "PER", "PHA", "PHB", "PHD", "PHP", "PHX",
|
||||
"PHY", "PLA", "PLB", "PLD", "PLP", "PLX", "PLY", "REP", "ROL",
|
||||
"ROR", "RTI", "RTL", "RTS", "SBC", "SEC", "SEI", "SEP", "STA",
|
||||
"STP", "STX", "STY", "STZ", "TAX", "TAY", "TCD", "TCS", "TDC",
|
||||
"TRB", "TSB", "TSC", "TSX", "TXA", "TXS", "TXY", "TYA", "TYX",
|
||||
"WAI", "WDM", "XBA", "XCE", "ORG", "LOROM", "HIROM", "NAMESPACE", "DB"};
|
||||
|
||||
static const char *const kIdentifiers[] = {
|
||||
"abort", "abs", "acos", "asin", "atan", "atexit",
|
||||
"atof", "atoi", "atol", "ceil", "clock", "cosh",
|
||||
"ctime", "div", "exit", "fabs", "floor", "fmod",
|
||||
"getchar", "getenv", "isalnum", "isalpha", "isdigit", "isgraph",
|
||||
"ispunct", "isspace", "isupper", "kbhit", "log10", "log2",
|
||||
"log", "memcmp", "modf", "pow", "putchar", "putenv",
|
||||
"puts", "rand", "remove", "rename", "sinh", "sqrt",
|
||||
"srand", "strcat", "strcmp", "strerror", "time", "tolower",
|
||||
"toupper"};
|
||||
|
||||
TextEditor::LanguageDefinition GetAssemblyLanguageDef() {
|
||||
TextEditor::LanguageDefinition language_65816;
|
||||
for (auto &k : kKeywords) language_65816.mKeywords.emplace(k);
|
||||
|
||||
for (auto &k : kIdentifiers) {
|
||||
TextEditor::Identifier id;
|
||||
id.mDeclaration = "Built-in function";
|
||||
language_65816.mIdentifiers.insert(std::make_pair(std::string(k), id));
|
||||
}
|
||||
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"[ \\t]*#[ \\t]*[a-zA-Z_]+", TextEditor::PaletteIndex::Preprocessor));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"L?\\\"(\\\\.|[^\\\"])*\\\"", TextEditor::PaletteIndex::String));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"\\'\\\\?[^\\']\\'", TextEditor::PaletteIndex::CharLiteral));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"[+-]?([0-9]+([.][0-9]*)?|[.][0-9]+)([eE][+-]?[0-9]+)?[fF]?",
|
||||
TextEditor::PaletteIndex::Number));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"[+-]?[0-9]+[Uu]?[lL]?[lL]?", TextEditor::PaletteIndex::Number));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"0[0-7]+[Uu]?[lL]?[lL]?", TextEditor::PaletteIndex::Number));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"0[xX][0-9a-fA-F]+[uU]?[lL]?[lL]?",
|
||||
TextEditor::PaletteIndex::Number));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"[a-zA-Z_][a-zA-Z0-9_]*", TextEditor::PaletteIndex::Identifier));
|
||||
language_65816.mTokenRegexStrings.push_back(
|
||||
std::make_pair<std::string, TextEditor::PaletteIndex>(
|
||||
"[\\[\\]\\{\\}\\!\\%\\^\\&\\*\\(\\)\\-\\+\\=\\~\\|\\<\\>\\?\\/"
|
||||
"\\;\\,\\.]",
|
||||
TextEditor::PaletteIndex::Punctuation));
|
||||
|
||||
language_65816.mCommentStart = "/*";
|
||||
language_65816.mCommentEnd = "*/";
|
||||
language_65816.mSingleLineComment = ";";
|
||||
|
||||
language_65816.mCaseSensitive = false;
|
||||
language_65816.mAutoIndentation = true;
|
||||
|
||||
language_65816.mName = "65816";
|
||||
|
||||
return language_65816;
|
||||
}
|
||||
|
||||
} // namespace gui
|
||||
} // namespace app
|
||||
} // namespace yaze
|
||||
@@ -1,78 +0,0 @@
|
||||
#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, float scale = 1.0f) {
|
||||
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() * scale,
|
||||
current_bitmap.height() * scale);
|
||||
// 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
|
||||
@@ -179,8 +179,9 @@ absl::Status Rom::LoadFontGraphicsData() {
|
||||
sheet_position += 0x400;
|
||||
}
|
||||
|
||||
font_gfx_data_.reserve(0x4000);
|
||||
for (int i = 0; i < 0x4000; i++) {
|
||||
font_gfx_data_[i] = new_data[i];
|
||||
font_gfx_data_.push_back(new_data[i]);
|
||||
}
|
||||
|
||||
return absl::OkStatus();
|
||||
|
||||
@@ -466,6 +466,7 @@ class Rom : public core::ExperimentFlags {
|
||||
auto bitmap_manager() { return graphics_manager_; }
|
||||
auto mutable_bitmap_manager() { return &graphics_manager_; }
|
||||
auto link_graphics() { return link_graphics_; }
|
||||
auto mutable_link_graphics() { return &link_graphics_; }
|
||||
|
||||
auto title() const { return title_; }
|
||||
auto size() const { return size_; }
|
||||
|
||||
Reference in New Issue
Block a user