Rename Editor class to MasterEditor
This commit is contained in:
@@ -40,7 +40,7 @@ add_executable(
|
|||||||
gui/style.cc
|
gui/style.cc
|
||||||
gui/widgets.cc
|
gui/widgets.cc
|
||||||
gui/canvas.cc
|
gui/canvas.cc
|
||||||
app/editor/editor.cc
|
app/editor/master_editor.cc
|
||||||
app/editor/assembly_editor.cc
|
app/editor/assembly_editor.cc
|
||||||
app/editor/dungeon_editor.cc
|
app/editor/dungeon_editor.cc
|
||||||
app/editor/overworld_editor.cc
|
app/editor/overworld_editor.cc
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "app/editor/editor.h"
|
#include "app/editor/master_editor.h"
|
||||||
#include "gui/icons.h"
|
#include "gui/icons.h"
|
||||||
#include "gui/style.h"
|
#include "gui/style.h"
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ void Controller::onEntry() {
|
|||||||
CreateWindow();
|
CreateWindow();
|
||||||
CreateRenderer();
|
CreateRenderer();
|
||||||
CreateGuiContext();
|
CreateGuiContext();
|
||||||
editor_.SetupScreen(sdl_renderer_);
|
master_editor_.SetupScreen(sdl_renderer_);
|
||||||
ImGuiIO &io = ImGui::GetIO();
|
ImGuiIO &io = ImGui::GetIO();
|
||||||
io.KeyMap[ImGuiKey_Backspace] = SDL_GetScancodeFromKey(SDLK_BACKSPACE);
|
io.KeyMap[ImGuiKey_Backspace] = SDL_GetScancodeFromKey(SDLK_BACKSPACE);
|
||||||
io.KeyMap[ImGuiKey_Enter] = SDL_GetScancodeFromKey(SDLK_RETURN);
|
io.KeyMap[ImGuiKey_Enter] = SDL_GetScancodeFromKey(SDLK_RETURN);
|
||||||
@@ -98,7 +98,7 @@ void Controller::onInput() {
|
|||||||
io.MouseWheel = static_cast<float>(wheel);
|
io.MouseWheel = static_cast<float>(wheel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::onLoad() { editor_.UpdateScreen(); }
|
void Controller::onLoad() { master_editor_.UpdateScreen(); }
|
||||||
|
|
||||||
void Controller::doRender() const {
|
void Controller::doRender() const {
|
||||||
SDL_RenderClear(sdl_renderer_.get());
|
SDL_RenderClear(sdl_renderer_.get());
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "app/editor/editor.h"
|
#include "app/editor/master_editor.h"
|
||||||
#include "gui/icons.h"
|
#include "gui/icons.h"
|
||||||
#include "gui/style.h"
|
#include "gui/style.h"
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ class Controller {
|
|||||||
};
|
};
|
||||||
|
|
||||||
bool active_;
|
bool active_;
|
||||||
editor::Editor editor_;
|
editor::MasterEditor master_editor_;
|
||||||
std::shared_ptr<SDL_Window> sdl_window_;
|
std::shared_ptr<SDL_Window> sdl_window_;
|
||||||
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "editor.h"
|
#include "master_editor.h"
|
||||||
|
|
||||||
#include <ImGuiColorTextEdit/TextEditor.h>
|
#include <ImGuiColorTextEdit/TextEditor.h>
|
||||||
#include <ImGuiFileDialog/ImGuiFileDialog.h>
|
#include <ImGuiFileDialog/ImGuiFileDialog.h>
|
||||||
@@ -22,7 +22,7 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
Editor::Editor() {
|
MasterEditor::MasterEditor() {
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
current_palette_[i].x = (i * 0.21f);
|
current_palette_[i].x = (i * 0.21f);
|
||||||
current_palette_[i].y = (i * 0.21f);
|
current_palette_[i].y = (i * 0.21f);
|
||||||
@@ -31,19 +31,14 @@ Editor::Editor() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor::~Editor() {
|
MasterEditor::~MasterEditor() { rom_.Close(); }
|
||||||
for (auto &each : image_cache_) {
|
|
||||||
SDL_DestroyTexture(each.second);
|
|
||||||
}
|
|
||||||
rom_.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Editor::SetupScreen(std::shared_ptr<SDL_Renderer> renderer) {
|
void MasterEditor::SetupScreen(std::shared_ptr<SDL_Renderer> renderer) {
|
||||||
sdl_renderer_ = renderer;
|
sdl_renderer_ = renderer;
|
||||||
rom_.SetupRenderer(renderer);
|
rom_.SetupRenderer(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::UpdateScreen() {
|
void MasterEditor::UpdateScreen() {
|
||||||
const ImGuiIO &io = ImGui::GetIO();
|
const ImGuiIO &io = ImGui::GetIO();
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
ImGui::SetNextWindowPos(ImVec2(0, 0));
|
ImGui::SetNextWindowPos(ImVec2(0, 0));
|
||||||
@@ -67,7 +62,7 @@ void Editor::UpdateScreen() {
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawYazeMenu() {
|
void MasterEditor::DrawYazeMenu() {
|
||||||
MENU_BAR()
|
MENU_BAR()
|
||||||
DrawFileMenu();
|
DrawFileMenu();
|
||||||
DrawEditMenu();
|
DrawEditMenu();
|
||||||
@@ -86,7 +81,7 @@ void Editor::DrawYazeMenu() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawFileMenu() const {
|
void MasterEditor::DrawFileMenu() const {
|
||||||
if (ImGui::BeginMenu("File")) {
|
if (ImGui::BeginMenu("File")) {
|
||||||
if (ImGui::MenuItem("Open", "Ctrl+O")) {
|
if (ImGui::MenuItem("Open", "Ctrl+O")) {
|
||||||
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Open ROM",
|
ImGuiFileDialog::Instance()->OpenDialog("ChooseFileDlgKey", "Open ROM",
|
||||||
@@ -119,7 +114,7 @@ void Editor::DrawFileMenu() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawEditMenu() const {
|
void MasterEditor::DrawEditMenu() const {
|
||||||
if (ImGui::BeginMenu("Edit")) {
|
if (ImGui::BeginMenu("Edit")) {
|
||||||
if (ImGui::MenuItem("Undo", "Ctrl+Z")) {
|
if (ImGui::MenuItem("Undo", "Ctrl+Z")) {
|
||||||
// TODO: Implement this
|
// TODO: Implement this
|
||||||
@@ -145,7 +140,7 @@ void Editor::DrawEditMenu() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawViewMenu() {
|
void MasterEditor::DrawViewMenu() {
|
||||||
static bool show_imgui_metrics = false;
|
static bool show_imgui_metrics = false;
|
||||||
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;
|
||||||
@@ -191,7 +186,7 @@ void Editor::DrawViewMenu() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawHelpMenu() const {
|
void MasterEditor::DrawHelpMenu() const {
|
||||||
if (ImGui::BeginMenu("Help")) {
|
if (ImGui::BeginMenu("Help")) {
|
||||||
if (ImGui::MenuItem("About")) {
|
if (ImGui::MenuItem("About")) {
|
||||||
// insert the about window here
|
// insert the about window here
|
||||||
@@ -202,25 +197,25 @@ void Editor::DrawHelpMenu() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawOverworldEditor() {
|
void MasterEditor::DrawOverworldEditor() {
|
||||||
TAB_ITEM("Overworld")
|
TAB_ITEM("Overworld")
|
||||||
overworld_editor_.Update();
|
overworld_editor_.Update();
|
||||||
END_TAB_ITEM()
|
END_TAB_ITEM()
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawDungeonEditor() {
|
void MasterEditor::DrawDungeonEditor() {
|
||||||
TAB_ITEM("Dungeon")
|
TAB_ITEM("Dungeon")
|
||||||
dungeon_editor_.Update();
|
dungeon_editor_.Update();
|
||||||
END_TAB_ITEM()
|
END_TAB_ITEM()
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawScreenEditor() {
|
void MasterEditor::DrawScreenEditor() {
|
||||||
TAB_ITEM("Screens")
|
TAB_ITEM("Screens")
|
||||||
screen_editor_.Update();
|
screen_editor_.Update();
|
||||||
END_TAB_ITEM()
|
END_TAB_ITEM()
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::DrawSpriteEditor() {
|
void MasterEditor::DrawSpriteEditor() {
|
||||||
TAB_ITEM("Sprites")
|
TAB_ITEM("Sprites")
|
||||||
END_TAB_ITEM()
|
END_TAB_ITEM()
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef YAZE_APP_VIEW_EDITOR_H
|
#ifndef YAZE_APP_EDITOR_MASTER_EDITOR_H
|
||||||
#define YAZE_APP_VIEW_EDITOR_H
|
#define YAZE_APP_EDITOR_MASTER_EDITOR_H
|
||||||
|
|
||||||
#include <ImGuiColorTextEdit/TextEditor.h>
|
#include <ImGuiColorTextEdit/TextEditor.h>
|
||||||
#include <ImGuiFileDialog/ImGuiFileDialog.h>
|
#include <ImGuiFileDialog/ImGuiFileDialog.h>
|
||||||
@@ -23,10 +23,10 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
class Editor {
|
class MasterEditor {
|
||||||
public:
|
public:
|
||||||
Editor();
|
MasterEditor();
|
||||||
~Editor();
|
~MasterEditor();
|
||||||
void SetupScreen(std::shared_ptr<SDL_Renderer> renderer);
|
void SetupScreen(std::shared_ptr<SDL_Renderer> renderer);
|
||||||
void UpdateScreen();
|
void UpdateScreen();
|
||||||
|
|
||||||
@@ -42,17 +42,11 @@ class Editor {
|
|||||||
void DrawScreenEditor();
|
void DrawScreenEditor();
|
||||||
void DrawSpriteEditor();
|
void DrawSpriteEditor();
|
||||||
|
|
||||||
bool is_loaded_ = true;
|
|
||||||
bool asm_is_loaded = false;
|
|
||||||
|
|
||||||
ROM rom_;
|
ROM rom_;
|
||||||
gui::Canvas canvas_;
|
|
||||||
AssemblyEditor assembly_editor_;
|
AssemblyEditor assembly_editor_;
|
||||||
OverworldEditor overworld_editor_;
|
OverworldEditor overworld_editor_;
|
||||||
DungeonEditor dungeon_editor_;
|
DungeonEditor dungeon_editor_;
|
||||||
ScreenEditor screen_editor_;
|
ScreenEditor screen_editor_;
|
||||||
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
|
||||||
std::unordered_map<uint, SDL_Texture *> image_cache_;
|
|
||||||
|
|
||||||
ImVec4 current_palette_[8];
|
ImVec4 current_palette_[8];
|
||||||
|
|
||||||
@@ -61,10 +55,12 @@ class Editor {
|
|||||||
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_MenuBar |
|
ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_MenuBar |
|
||||||
ImGuiWindowFlags_NoTitleBar;
|
ImGuiWindowFlags_NoTitleBar;
|
||||||
ImGuiTableFlags toolset_table_flags_ = ImGuiTableFlags_SizingFixedFit;
|
ImGuiTableFlags toolset_table_flags_ = ImGuiTableFlags_SizingFixedFit;
|
||||||
|
|
||||||
|
std::shared_ptr<SDL_Renderer> sdl_renderer_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace editor
|
} // namespace editor
|
||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|
||||||
#endif // YAZE_APP_VIEW_EDITOR_H
|
#endif // YAZE_APP_EDITOR_MASTER_EDITOR_H
|
||||||
Reference in New Issue
Block a user