Added new tabs to the Editor main area
This commit is contained in:
@@ -8,18 +8,17 @@ Editor::Editor() {
|
|||||||
static bool inited = false;
|
static bool inited = false;
|
||||||
if (!inited) {
|
if (!inited) {
|
||||||
static const char *const keywords[] = {
|
static const char *const keywords[] = {
|
||||||
"ADC", "AND", "ASL", "BCC", "BCS", "BEQ", "BIT", "BMI", "BNE",
|
"ADC", "AND", "ASL", "BCC", "BCS", "BEQ", "BIT", "BMI", "BNE",
|
||||||
"BPL", "BRA", "BRL", "BVC", "BVS", "CLC", "CLD", "CLI", "CLV",
|
"BPL", "BRA", "BRL", "BVC", "BVS", "CLC", "CLD", "CLI", "CLV",
|
||||||
"CMP", "CPX", "CPY", "DEC", "DEX", "DEY", "EOR", "INC", "INX",
|
"CMP", "CPX", "CPY", "DEC", "DEX", "DEY", "EOR", "INC", "INX",
|
||||||
"INY", "JMP", "JSR", "JSL", "LDA", "LDX", "LDY", "LSR", "MVN", "NOP",
|
"INY", "JMP", "JSR", "JSL", "LDA", "LDX", "LDY", "LSR", "MVN",
|
||||||
"ORA", "PEA", "PER", "PHA", "PHB", "PHD", "PHP", "PHX", "PHY",
|
"NOP", "ORA", "PEA", "PER", "PHA", "PHB", "PHD", "PHP", "PHX",
|
||||||
"PLA", "PLB", "PLD", "PLP", "PLX", "PLY", "REP", "ROL", "ROR",
|
"PHY", "PLA", "PLB", "PLD", "PLP", "PLX", "PLY", "REP", "ROL",
|
||||||
"RTI", "RTL", "RTS", "SBC", "SEC", "SEI", "SEP", "STA", "STP",
|
"ROR", "RTI", "RTL", "RTS", "SBC", "SEC", "SEI", "SEP", "STA",
|
||||||
"STX", "STY", "STZ", "TAX", "TAY", "TCD", "TCS", "TDC", "TRB",
|
"STP", "STX", "STY", "STZ", "TAX", "TAY", "TCD", "TCS", "TDC",
|
||||||
"TSB", "TSC", "TSX", "TXA", "TXS", "TXY", "TYA", "TYX", "WAI",
|
"TRB", "TSB", "TSC", "TSX", "TXA", "TXS", "TXY", "TYA", "TYX",
|
||||||
"WDM", "XBA", "XCE", "ORG", "LOROM", "HIROM", "NAMESPACE", "DB" };
|
"WAI", "WDM", "XBA", "XCE", "ORG", "LOROM", "HIROM", "NAMESPACE", "DB"};
|
||||||
for (auto &k : keywords)
|
for (auto &k : keywords) language65816Def.mKeywords.emplace(k);
|
||||||
language65816Def.mKeywords.insert(k);
|
|
||||||
|
|
||||||
static const char *const identifiers[] = {
|
static const char *const identifiers[] = {
|
||||||
"abort", "abs", "acos", "asin", "atan", "atexit",
|
"abort", "abs", "acos", "asin", "atan", "atexit",
|
||||||
@@ -30,7 +29,7 @@ Editor::Editor() {
|
|||||||
"log", "memcmp", "modf", "pow", "putchar", "putenv",
|
"log", "memcmp", "modf", "pow", "putchar", "putenv",
|
||||||
"puts", "rand", "remove", "rename", "sinh", "sqrt",
|
"puts", "rand", "remove", "rename", "sinh", "sqrt",
|
||||||
"srand", "strcat", "strcmp", "strerror", "time", "tolower",
|
"srand", "strcat", "strcmp", "strerror", "time", "tolower",
|
||||||
"toupper" };
|
"toupper"};
|
||||||
for (auto &k : identifiers) {
|
for (auto &k : identifiers) {
|
||||||
TextEditor::Identifier id;
|
TextEditor::Identifier id;
|
||||||
id.mDeclaration = "Built-in function";
|
id.mDeclaration = "Built-in function";
|
||||||
@@ -94,9 +93,9 @@ void Editor::UpdateScreen() {
|
|||||||
ImGuiWindowFlags flags =
|
ImGuiWindowFlags flags =
|
||||||
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse |
|
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse |
|
||||||
ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoScrollbar |
|
ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoScrollbar |
|
||||||
ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoTitleBar;
|
ImGuiWindowFlags_MenuBar;
|
||||||
|
|
||||||
if (!ImGui::Begin("#yaze", nullptr, flags)) {
|
if (!ImGui::Begin(title_.c_str(), nullptr, flags)) {
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -106,12 +105,12 @@ void Editor::UpdateScreen() {
|
|||||||
if (ImGui::BeginTabBar("##TabBar")) {
|
if (ImGui::BeginTabBar("##TabBar")) {
|
||||||
DrawOverworldEditor();
|
DrawOverworldEditor();
|
||||||
DrawDungeonEditor();
|
DrawDungeonEditor();
|
||||||
|
DrawGraphicsEditor();
|
||||||
DrawSpriteEditor();
|
DrawSpriteEditor();
|
||||||
DrawScreenEditor();
|
DrawScreenEditor();
|
||||||
DrawROMInfo();
|
DrawROMInfo();
|
||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
}
|
}
|
||||||
// ImGui::ShowDemoWindow();
|
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
@@ -131,6 +130,7 @@ void Editor::DrawYazeMenu() {
|
|||||||
if (ImGuiFileDialog::Instance()->IsOk()) {
|
if (ImGuiFileDialog::Instance()->IsOk()) {
|
||||||
std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName();
|
std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName();
|
||||||
std::string filePath = ImGuiFileDialog::Instance()->GetCurrentPath();
|
std::string filePath = ImGuiFileDialog::Instance()->GetCurrentPath();
|
||||||
|
title_ = ImGuiFileDialog::Instance()->GetCurrentFileName();
|
||||||
rom.LoadFromFile(filePathName);
|
rom.LoadFromFile(filePathName);
|
||||||
overworld_editor_.SetRom(rom);
|
overworld_editor_.SetRom(rom);
|
||||||
rom_data_ = (void *)rom.GetRawData();
|
rom_data_ = (void *)rom.GetRawData();
|
||||||
@@ -167,8 +167,7 @@ void Editor::DrawFileMenu() const {
|
|||||||
static bool enabled = true;
|
static bool enabled = true;
|
||||||
ImGui::MenuItem("Enabled", "", &enabled);
|
ImGui::MenuItem("Enabled", "", &enabled);
|
||||||
ImGui::BeginChild("child", ImVec2(0, 60), true);
|
ImGui::BeginChild("child", ImVec2(0, 60), true);
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++) ImGui::Text("Scrolling Text %d", i);
|
||||||
ImGui::Text("Scrolling Text %d", i);
|
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
static float f = 0.5f;
|
static float f = 0.5f;
|
||||||
static int n = 0;
|
static int n = 0;
|
||||||
@@ -212,6 +211,7 @@ void Editor::DrawViewMenu() {
|
|||||||
static bool show_imgui_style_editor = false;
|
static bool show_imgui_style_editor = false;
|
||||||
static bool show_memory_editor = false;
|
static bool show_memory_editor = false;
|
||||||
static bool show_asm_editor = false;
|
static bool show_asm_editor = false;
|
||||||
|
static bool show_imgui_demo = false;
|
||||||
|
|
||||||
if (show_imgui_metrics) {
|
if (show_imgui_metrics) {
|
||||||
ImGui::ShowMetricsWindow(&show_imgui_metrics);
|
ImGui::ShowMetricsWindow(&show_imgui_metrics);
|
||||||
@@ -222,6 +222,10 @@ void Editor::DrawViewMenu() {
|
|||||||
mem_edit.DrawWindow("Memory Editor", rom_data_, rom.getSize());
|
mem_edit.DrawWindow("Memory Editor", rom_data_, rom.getSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (show_imgui_demo) {
|
||||||
|
ImGui::ShowDemoWindow();
|
||||||
|
}
|
||||||
|
|
||||||
if (show_asm_editor) {
|
if (show_asm_editor) {
|
||||||
static bool asm_is_loaded = false;
|
static bool asm_is_loaded = false;
|
||||||
auto cpos = asm_editor_.GetCursorPosition();
|
auto cpos = asm_editor_.GetCursorPosition();
|
||||||
@@ -254,14 +258,9 @@ void Editor::DrawViewMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginMenu("View")) {
|
if (ImGui::BeginMenu("View")) {
|
||||||
if (ImGui::BeginMenu("Appearance")) {
|
ImGui::MenuItem("HEX Editor", nullptr, &MemoryEditor::Open);
|
||||||
if (ImGui::MenuItem("Fullscreen")) {
|
|
||||||
}
|
|
||||||
ImGui::EndMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::MenuItem("HEX Editor", nullptr, &show_memory_editor);
|
|
||||||
ImGui::MenuItem("ASM Editor", nullptr, &show_asm_editor);
|
ImGui::MenuItem("ASM Editor", nullptr, &show_asm_editor);
|
||||||
|
ImGui::MenuItem("ImGui Demo", nullptr, &show_imgui_demo);
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
if (ImGui::BeginMenu("GUI Tools")) {
|
if (ImGui::BeginMenu("GUI Tools")) {
|
||||||
@@ -352,6 +351,12 @@ void Editor::DrawDungeonEditor() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::DrawGraphicsEditor() {
|
||||||
|
if (ImGui::BeginTabItem("Graphics")) {
|
||||||
|
ImGui::EndTabItem();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Editor::DrawSpriteEditor() {
|
void Editor::DrawSpriteEditor() {
|
||||||
if (ImGui::BeginTabItem("Sprites")) {
|
if (ImGui::BeginTabItem("Sprites")) {
|
||||||
ImGui::EndTabItem();
|
ImGui::EndTabItem();
|
||||||
@@ -376,6 +381,6 @@ void Editor::DrawROMInfo() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Editor
|
} // namespace Editor
|
||||||
} // namespace Application
|
} // namespace Application
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
@@ -20,11 +20,11 @@ namespace Application {
|
|||||||
namespace Editor {
|
namespace Editor {
|
||||||
|
|
||||||
class Editor {
|
class Editor {
|
||||||
public:
|
public:
|
||||||
Editor();
|
Editor();
|
||||||
void UpdateScreen();
|
void UpdateScreen();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DrawYazeMenu();
|
void DrawYazeMenu();
|
||||||
void DrawFileMenu() const;
|
void DrawFileMenu() const;
|
||||||
void DrawEditMenu() const;
|
void DrawEditMenu() const;
|
||||||
@@ -33,13 +33,16 @@ private:
|
|||||||
|
|
||||||
void DrawOverworldEditor();
|
void DrawOverworldEditor();
|
||||||
void DrawDungeonEditor();
|
void DrawDungeonEditor();
|
||||||
|
void DrawGraphicsEditor();
|
||||||
void DrawSpriteEditor();
|
void DrawSpriteEditor();
|
||||||
void DrawScreenEditor();
|
void DrawScreenEditor();
|
||||||
void DrawROMInfo();
|
void DrawROMInfo();
|
||||||
|
|
||||||
void *rom_data_;
|
void *rom_data_;
|
||||||
bool isLoaded = true;
|
bool isLoaded = true;
|
||||||
|
|
||||||
|
std::string title_ = "YAZE";
|
||||||
|
|
||||||
Utils::ROM rom;
|
Utils::ROM rom;
|
||||||
TextEditor asm_editor_;
|
TextEditor asm_editor_;
|
||||||
TextEditor::LanguageDefinition language65816Def;
|
TextEditor::LanguageDefinition language65816Def;
|
||||||
@@ -48,8 +51,8 @@ private:
|
|||||||
ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit;
|
ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Editor
|
} // namespace Editor
|
||||||
} // namespace Application
|
} // namespace Application
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
#endif // YAZE_APPLICATION_VIEW_EDITOR_H
|
#endif // YAZE_APPLICATION_VIEW_EDITOR_H
|
||||||
Reference in New Issue
Block a user