Added new tabs to the Editor main area
This commit is contained in:
@@ -8,18 +8,17 @@ Editor::Editor() {
|
||||
static bool inited = false;
|
||||
if (!inited) {
|
||||
static const char *const keywords[] = {
|
||||
"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" };
|
||||
for (auto &k : keywords)
|
||||
language65816Def.mKeywords.insert(k);
|
||||
"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"};
|
||||
for (auto &k : keywords) language65816Def.mKeywords.emplace(k);
|
||||
|
||||
static const char *const identifiers[] = {
|
||||
"abort", "abs", "acos", "asin", "atan", "atexit",
|
||||
@@ -30,7 +29,7 @@ Editor::Editor() {
|
||||
"log", "memcmp", "modf", "pow", "putchar", "putenv",
|
||||
"puts", "rand", "remove", "rename", "sinh", "sqrt",
|
||||
"srand", "strcat", "strcmp", "strerror", "time", "tolower",
|
||||
"toupper" };
|
||||
"toupper"};
|
||||
for (auto &k : identifiers) {
|
||||
TextEditor::Identifier id;
|
||||
id.mDeclaration = "Built-in function";
|
||||
@@ -94,9 +93,9 @@ void Editor::UpdateScreen() {
|
||||
ImGuiWindowFlags flags =
|
||||
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse |
|
||||
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();
|
||||
return;
|
||||
}
|
||||
@@ -106,12 +105,12 @@ void Editor::UpdateScreen() {
|
||||
if (ImGui::BeginTabBar("##TabBar")) {
|
||||
DrawOverworldEditor();
|
||||
DrawDungeonEditor();
|
||||
DrawGraphicsEditor();
|
||||
DrawSpriteEditor();
|
||||
DrawScreenEditor();
|
||||
DrawROMInfo();
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
// ImGui::ShowDemoWindow();
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
@@ -131,6 +130,7 @@ void Editor::DrawYazeMenu() {
|
||||
if (ImGuiFileDialog::Instance()->IsOk()) {
|
||||
std::string filePathName = ImGuiFileDialog::Instance()->GetFilePathName();
|
||||
std::string filePath = ImGuiFileDialog::Instance()->GetCurrentPath();
|
||||
title_ = ImGuiFileDialog::Instance()->GetCurrentFileName();
|
||||
rom.LoadFromFile(filePathName);
|
||||
overworld_editor_.SetRom(rom);
|
||||
rom_data_ = (void *)rom.GetRawData();
|
||||
@@ -167,8 +167,7 @@ void Editor::DrawFileMenu() const {
|
||||
static bool enabled = true;
|
||||
ImGui::MenuItem("Enabled", "", &enabled);
|
||||
ImGui::BeginChild("child", ImVec2(0, 60), true);
|
||||
for (int i = 0; i < 10; i++)
|
||||
ImGui::Text("Scrolling Text %d", i);
|
||||
for (int i = 0; i < 10; i++) ImGui::Text("Scrolling Text %d", i);
|
||||
ImGui::EndChild();
|
||||
static float f = 0.5f;
|
||||
static int n = 0;
|
||||
@@ -212,6 +211,7 @@ void Editor::DrawViewMenu() {
|
||||
static bool show_imgui_style_editor = false;
|
||||
static bool show_memory_editor = false;
|
||||
static bool show_asm_editor = false;
|
||||
static bool show_imgui_demo = false;
|
||||
|
||||
if (show_imgui_metrics) {
|
||||
ImGui::ShowMetricsWindow(&show_imgui_metrics);
|
||||
@@ -222,6 +222,10 @@ void Editor::DrawViewMenu() {
|
||||
mem_edit.DrawWindow("Memory Editor", rom_data_, rom.getSize());
|
||||
}
|
||||
|
||||
if (show_imgui_demo) {
|
||||
ImGui::ShowDemoWindow();
|
||||
}
|
||||
|
||||
if (show_asm_editor) {
|
||||
static bool asm_is_loaded = false;
|
||||
auto cpos = asm_editor_.GetCursorPosition();
|
||||
@@ -254,14 +258,9 @@ void Editor::DrawViewMenu() {
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("View")) {
|
||||
if (ImGui::BeginMenu("Appearance")) {
|
||||
if (ImGui::MenuItem("Fullscreen")) {
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ImGui::MenuItem("HEX Editor", nullptr, &show_memory_editor);
|
||||
ImGui::MenuItem("HEX Editor", nullptr, &MemoryEditor::Open);
|
||||
ImGui::MenuItem("ASM Editor", nullptr, &show_asm_editor);
|
||||
ImGui::MenuItem("ImGui Demo", nullptr, &show_imgui_demo);
|
||||
|
||||
ImGui::Separator();
|
||||
if (ImGui::BeginMenu("GUI Tools")) {
|
||||
@@ -352,6 +351,12 @@ void Editor::DrawDungeonEditor() {
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::DrawGraphicsEditor() {
|
||||
if (ImGui::BeginTabItem("Graphics")) {
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::DrawSpriteEditor() {
|
||||
if (ImGui::BeginTabItem("Sprites")) {
|
||||
ImGui::EndTabItem();
|
||||
@@ -376,6 +381,6 @@ void Editor::DrawROMInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Editor
|
||||
} // namespace Application
|
||||
} // namespace yaze
|
||||
} // namespace Editor
|
||||
} // namespace Application
|
||||
} // namespace yaze
|
||||
@@ -20,11 +20,11 @@ namespace Application {
|
||||
namespace Editor {
|
||||
|
||||
class Editor {
|
||||
public:
|
||||
public:
|
||||
Editor();
|
||||
void UpdateScreen();
|
||||
|
||||
private:
|
||||
private:
|
||||
void DrawYazeMenu();
|
||||
void DrawFileMenu() const;
|
||||
void DrawEditMenu() const;
|
||||
@@ -33,13 +33,16 @@ private:
|
||||
|
||||
void DrawOverworldEditor();
|
||||
void DrawDungeonEditor();
|
||||
void DrawGraphicsEditor();
|
||||
void DrawSpriteEditor();
|
||||
void DrawScreenEditor();
|
||||
void DrawROMInfo();
|
||||
|
||||
|
||||
void *rom_data_;
|
||||
bool isLoaded = true;
|
||||
|
||||
bool isLoaded = true;
|
||||
|
||||
std::string title_ = "YAZE";
|
||||
|
||||
Utils::ROM rom;
|
||||
TextEditor asm_editor_;
|
||||
TextEditor::LanguageDefinition language65816Def;
|
||||
@@ -48,8 +51,8 @@ private:
|
||||
ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit;
|
||||
};
|
||||
|
||||
} // namespace Editor
|
||||
} // namespace Application
|
||||
} // namespace yaze
|
||||
} // namespace Editor
|
||||
} // namespace Application
|
||||
} // namespace yaze
|
||||
|
||||
#endif // YAZE_APPLICATION_VIEW_EDITOR_H
|
||||
#endif // YAZE_APPLICATION_VIEW_EDITOR_H
|
||||
Reference in New Issue
Block a user