yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
screen_editor.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_SCREEN_EDITOR_H
2#define YAZE_APP_EDITOR_SCREEN_EDITOR_H
3
4#include <array>
5
6#include "absl/status/status.h"
7#include "app/editor/editor.h"
8#include "app/gfx/bitmap.h"
10#include "app/gfx/tilesheet.h"
11#include "app/gui/canvas.h"
12#include "app/rom.h"
15#include "imgui/imgui.h"
16
17namespace yaze {
18namespace app {
19namespace editor {
20
35class ScreenEditor : public SharedRom, public Editor {
36public:
41
42 absl::Status Update() override;
43
44 absl::Status Undo() override { return absl::UnimplementedError("Undo"); }
45 absl::Status Redo() override { return absl::UnimplementedError("Redo"); }
46 absl::Status Cut() override { return absl::UnimplementedError("Cut"); }
47 absl::Status Copy() override { return absl::UnimplementedError("Copy"); }
48 absl::Status Paste() override { return absl::UnimplementedError("Paste"); }
49 absl::Status Find() override { return absl::UnimplementedError("Find"); }
50
51 absl::Status SaveDungeonMaps();
52
53private:
57
59 void DrawToolset();
61
62 absl::Status LoadDungeonMaps();
63 absl::Status LoadDungeonMapTile16(const std::vector<uint8_t> &gfx_data,
64 bool bin_mode = false);
65 absl::Status SaveDungeonMapTile16();
68
69 void LoadBinaryGfx();
70
71 enum class EditingMode { DRAW, EDIT };
72
74
76 bool binary_gfx_loaded_ = false;
77
78 uint8_t selected_room = 0;
79 uint8_t boss_room = 0;
80
84 int floor_number = 1;
85
86 bool copy_button_pressed = false;
88
89 std::vector<uint8_t> all_gfx_;
90 std::unordered_map<int, gfx::Bitmap> tile16_individual_;
91 std::vector<zelda3::screen::DungeonMap> dungeon_maps_;
92 std::vector<std::vector<std::array<std::string, 25>>> dungeon_map_labels_;
93 std::array<uint16_t, 4> current_tile16_data_;
94 std::vector<uint8_t> gfx_bin_data_;
95
96 absl::Status status_;
97
102
103 gui::Canvas current_tile_canvas_{"##CurrentTileCanvas"};
106 gui::Canvas tilemap_canvas_{"##TilemapCanvas",
107 ImVec2(128 + 2, (192) + 4),
109
111};
112
113} // namespace editor
114} // namespace app
115} // namespace yaze
116
117#endif
A class to hold a shared pointer to a Rom object.
Definition rom.h:576
Interface for editor classes.
Definition editor.h:54
The ScreenEditor class allows the user to edit a variety of screens in the game or create a custom me...
std::vector< std::vector< std::array< std::string, 25 > > > dungeon_map_labels_
absl::Status LoadDungeonMapTile16(const std::vector< uint8_t > &gfx_data, bool bin_mode=false)
absl::Status Update() override
absl::Status Cut() override
std::vector< uint8_t > gfx_bin_data_
absl::Status Redo() override
zelda3::screen::Inventory inventory_
gfx::InternalTile16 current_tile16_info
absl::Status Paste() override
std::array< uint16_t, 4 > current_tile16_data_
absl::Status Undo() override
absl::Status Copy() override
std::vector< zelda3::screen::DungeonMap > dungeon_maps_
std::vector< uint8_t > all_gfx_
std::unordered_map< int, gfx::Bitmap > tile16_individual_
absl::Status Find() override
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Represents a tilesheet, which is a collection of tiles stored in a bitmap.
Definition tilesheet.h:30
Represents a canvas for drawing and manipulating graphics.
Definition canvas.h:34
void SetCanvasSize(ImVec2 canvas_size)
Definition canvas.h:144
std::unordered_map< int, gfx::Bitmap > BitmapTable
Definition bitmap.h:214
Definition common.cc:22