Move editor interface to editor/utils
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "app/core/common.h"
|
#include "app/core/common.h"
|
||||||
#include "app/core/editor.h"
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/editor/master_editor.h"
|
#include "app/editor/master_editor.h"
|
||||||
#include "app/gui/icons.h"
|
#include "app/gui/icons.h"
|
||||||
#include "app/gui/style.h"
|
#include "app/gui/style.h"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#import "app/core/controller.h"
|
#import "app/core/controller.h"
|
||||||
#import "app/core/editor.h"
|
#import "app/editor/utils/editor.h"
|
||||||
#import "app/core/platform/app_delegate.h"
|
#import "app/core/platform/app_delegate.h"
|
||||||
#import "app/core/platform/file_dialog.h"
|
#import "app/core/platform/file_dialog.h"
|
||||||
#import "app/rom.h"
|
#import "app/rom.h"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "app/core/editor.h"
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/editor/modules/palette_editor.h"
|
#include "app/editor/modules/palette_editor.h"
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "app/core/editor.h"
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/editor/modules/palette_editor.h"
|
#include "app/editor/modules/palette_editor.h"
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
#include <imgui/imgui.h>
|
#include <imgui/imgui.h>
|
||||||
|
|
||||||
#include "app/core/common.h"
|
#include "app/core/common.h"
|
||||||
#include "app/core/editor.h"
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/core/labeling.h"
|
#include "app/core/labeling.h"
|
||||||
#include "app/editor/modules/gfx_group_editor.h"
|
#include "app/editor/modules/gfx_group_editor.h"
|
||||||
#include "app/editor/modules/palette_editor.h"
|
#include "app/editor/modules/palette_editor.h"
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ constexpr ImGuiTableFlags kGfxEditFlags = ImGuiTableFlags_Reorderable |
|
|||||||
/**
|
/**
|
||||||
* @class GraphicsEditor
|
* @class GraphicsEditor
|
||||||
* @brief Allows the user to edit graphics sheets from the game or view
|
* @brief Allows the user to edit graphics sheets from the game or view
|
||||||
* prototype graphics of Link to the Past from the CGX, SCR, and OBJ formats.
|
* prototype graphics.
|
||||||
*
|
*
|
||||||
* The GraphicsEditor class is responsible for providing functionality to edit
|
* The GraphicsEditor class is responsible for providing functionality to edit
|
||||||
* graphics sheets from the game or view prototype graphics of Link to the Past
|
* graphics sheets from the game or view prototype graphics of Link to the Past
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class AssemblyEditor
|
||||||
|
* @brief Text editor for modifying assembly code.
|
||||||
|
*/
|
||||||
class AssemblyEditor {
|
class AssemblyEditor {
|
||||||
public:
|
public:
|
||||||
AssemblyEditor();
|
AssemblyEditor();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
#include "app/core/editor.h"
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/editor/modules/palette_editor.h"
|
#include "app/editor/modules/palette_editor.h"
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
#include "app/core/editor.h"
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/editor/modules/palette_editor.h"
|
#include "app/editor/modules/palette_editor.h"
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
@@ -23,6 +23,10 @@ namespace yaze {
|
|||||||
namespace app {
|
namespace app {
|
||||||
namespace editor {
|
namespace editor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class GfxGroupEditor
|
||||||
|
* @brief Manage graphics group configurations in a ROM.
|
||||||
|
*/
|
||||||
class GfxGroupEditor : public SharedROM {
|
class GfxGroupEditor : public SharedROM {
|
||||||
public:
|
public:
|
||||||
absl::Status Update();
|
absl::Status Update();
|
||||||
|
|||||||
@@ -54,6 +54,11 @@ static const char* kGameSongs[] = {"Title",
|
|||||||
static constexpr absl::string_view kSongNotes[] = {
|
static constexpr absl::string_view kSongNotes[] = {
|
||||||
"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C",
|
"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C",
|
||||||
"C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C"};
|
"C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class MusicEditor
|
||||||
|
* @brief A class for editing music data in a ROM.
|
||||||
|
*/
|
||||||
class MusicEditor : public SharedROM {
|
class MusicEditor : public SharedROM {
|
||||||
public:
|
public:
|
||||||
void Update();
|
void Update();
|
||||||
|
|||||||
@@ -77,6 +77,10 @@ class PaletteEditorHistory {
|
|||||||
};
|
};
|
||||||
} // namespace palette_internal
|
} // namespace palette_internal
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class PaletteEditor
|
||||||
|
* @brief Allows the user to view and edit in game palettes.
|
||||||
|
*/
|
||||||
class PaletteEditor : public SharedROM {
|
class PaletteEditor : public SharedROM {
|
||||||
public:
|
public:
|
||||||
absl::Status Update();
|
absl::Status Update();
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
#include "app/core/editor.h"
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/editor/modules/palette_editor.h"
|
#include "app/editor/modules/palette_editor.h"
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
#include "app/core/editor.h"
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/editor/context/gfx_context.h"
|
#include "app/editor/context/gfx_context.h"
|
||||||
#include "app/editor/modules/palette_editor.h"
|
#include "app/editor/modules/palette_editor.h"
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
|
|||||||
@@ -697,8 +697,6 @@ void OverworldEditor::CheckForMousePan() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overworld Editor canvas
|
|
||||||
// Allows the user to make changes to the overworld map.
|
|
||||||
void OverworldEditor::DrawOverworldCanvas() {
|
void OverworldEditor::DrawOverworldCanvas() {
|
||||||
if (all_gfx_loaded_) {
|
if (all_gfx_loaded_) {
|
||||||
DrawOverworldMapSettings();
|
DrawOverworldMapSettings();
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
#include "absl/strings/str_format.h"
|
#include "absl/strings/str_format.h"
|
||||||
#include "app/core/common.h"
|
#include "app/core/common.h"
|
||||||
#include "app/core/editor.h"
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/editor/context/entrance_context.h"
|
#include "app/editor/context/entrance_context.h"
|
||||||
#include "app/editor/context/gfx_context.h"
|
#include "app/editor/context/gfx_context.h"
|
||||||
#include "app/editor/modules/gfx_group_editor.h"
|
#include "app/editor/modules/gfx_group_editor.h"
|
||||||
@@ -88,6 +88,9 @@ class OverworldEditor : public Editor,
|
|||||||
|
|
||||||
auto overworld() { return &overworld_; }
|
auto overworld() { return &overworld_; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
*/
|
||||||
int jump_to_tab() { return jump_to_tab_; }
|
int jump_to_tab() { return jump_to_tab_; }
|
||||||
int jump_to_tab_ = -1;
|
int jump_to_tab_ = -1;
|
||||||
|
|
||||||
@@ -139,6 +142,10 @@ class OverworldEditor : public Editor,
|
|||||||
void CheckForSelectRectangle();
|
void CheckForSelectRectangle();
|
||||||
absl::Status CheckForCurrentMap();
|
absl::Status CheckForCurrentMap();
|
||||||
void CheckForMousePan();
|
void CheckForMousePan();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Allows the user to make changes to the overworld map.
|
||||||
|
*/
|
||||||
void DrawOverworldCanvas();
|
void DrawOverworldCanvas();
|
||||||
|
|
||||||
absl::Status DrawTile16Selector();
|
absl::Status DrawTile16Selector();
|
||||||
|
|||||||
@@ -3,6 +3,21 @@
|
|||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
|
|
||||||
|
namespace yaze {
|
||||||
|
namespace app {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @namespace editor
|
||||||
|
* @brief Editors are the view controllers for the application.
|
||||||
|
*/
|
||||||
|
namespace editor {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Editor
|
||||||
|
* @brief Interface for editor classes.
|
||||||
|
*
|
||||||
|
* Provides basic editing operations that each editor should implement.
|
||||||
|
*/
|
||||||
class Editor {
|
class Editor {
|
||||||
public:
|
public:
|
||||||
Editor() = default;
|
Editor() = default;
|
||||||
@@ -18,4 +33,8 @@ class Editor {
|
|||||||
virtual absl::Status Update() = 0;
|
virtual absl::Status Update() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace editor
|
||||||
|
} // namespace app
|
||||||
|
} // namespace yaze
|
||||||
|
|
||||||
#endif // YAZE_APP_CORE_EDITOR_H
|
#endif // YAZE_APP_CORE_EDITOR_H
|
||||||
@@ -311,11 +311,11 @@ absl::Status Overworld::LoadOverworldMaps() {
|
|||||||
} else if (i >= 0x80) {
|
} else if (i >= 0x80) {
|
||||||
world_type = 2;
|
world_type = 2;
|
||||||
}
|
}
|
||||||
futures.emplace_back(
|
auto task_function = [this, i, size, world_type]() {
|
||||||
std::async(std::launch::async, [this, i, size, world_type]() {
|
return overworld_maps_[i].BuildMap(size, game_state_, world_type,
|
||||||
return overworld_maps_[i].BuildMap(size, game_state_, world_type,
|
GetMapTiles(world_type));
|
||||||
GetMapTiles(world_type));
|
};
|
||||||
}));
|
futures.emplace_back(std::async(std::launch::async, task_function));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for all tasks to complete and check their results
|
// Wait for all tasks to complete and check their results
|
||||||
|
|||||||
@@ -13,12 +13,15 @@
|
|||||||
namespace yaze_test {
|
namespace yaze_test {
|
||||||
namespace zelda3_test {
|
namespace zelda3_test {
|
||||||
|
|
||||||
|
using yaze::app::ROM;
|
||||||
|
using yaze::app::zelda3::dungeon::DungeonObjectRenderer;
|
||||||
|
|
||||||
TEST(DungeonObjectTest, RenderObjectsAsBitmaps) {
|
TEST(DungeonObjectTest, RenderObjectsAsBitmaps) {
|
||||||
app::ROM rom;
|
ROM rom;
|
||||||
// rom.LoadFromFile("/Users/scawful/Code/yaze/build/bin/zelda3.sfc"));
|
// rom.LoadFromFile("/Users/scawful/Code/yaze/build/bin/zelda3.sfc"));
|
||||||
// EXPECT_EQ(rom_status, absl::Status::ok());
|
// EXPECT_EQ(rom_status, absl::Status::ok());
|
||||||
|
|
||||||
app::zelda3::dungeon::DungeonObjectRenderer renderer;
|
DungeonObjectRenderer renderer;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace zelda3_test
|
} // namespace zelda3_test
|
||||||
|
|||||||
Reference in New Issue
Block a user