yaze 0.3.2
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"
14#include "rom/rom.h"
15#include "imgui/imgui.h"
20
21namespace yaze {
22namespace editor {
23
36class ScreenEditor : public Editor {
37 public:
38 explicit ScreenEditor(Rom* rom = nullptr) : rom_(rom) {
39 screen_canvas_.SetCanvasSize(ImVec2(512, 512));
41 }
42
43 void Initialize() override;
44 absl::Status Load() override;
45 absl::Status Update() override;
46 absl::Status Undo() override { return absl::UnimplementedError("Undo"); }
47 absl::Status Redo() override { return absl::UnimplementedError("Redo"); }
48 absl::Status Cut() override { return absl::UnimplementedError("Cut"); }
49 absl::Status Copy() override { return absl::UnimplementedError("Copy"); }
50 absl::Status Paste() override { return absl::UnimplementedError("Paste"); }
51 absl::Status Find() override { return absl::UnimplementedError("Find"); }
52 absl::Status Save() override { return absl::UnimplementedError("Save"); }
53 void set_rom(Rom* rom) { rom_ = rom; }
54 Rom* rom() const { return rom_; }
55
56 std::vector<zelda3::DungeonMap> dungeon_maps_;
57
58 private:
62
65 void DrawToolset();
68
69 // Title screen layer editing
74
75 absl::Status LoadDungeonMapTile16(const std::vector<uint8_t>& gfx_data,
76 bool bin_mode = false);
77 absl::Status SaveDungeonMapTile16();
78
79 void DrawDungeonMapScreen(int i);
83
84 void LoadBinaryGfx();
85
86 enum class EditingMode { DRAW, EDIT };
87
89
90 bool binary_gfx_loaded_ = false;
91
92 uint8_t selected_room = 0;
93
97 int floor_number = 1;
98
99 bool copy_button_pressed = false;
101
103
107 gfx::Tilemap tile8_tilemap_; // Tilemap for 8x8 tiles with on-demand caching
108 std::array<gfx::TileInfo, 4> current_tile16_info;
109
110 gui::Canvas current_tile_canvas_{"##CurrentTileCanvas", ImVec2(32, 32),
114 gui::Canvas tilemap_canvas_{"##TilemapCanvas", ImVec2(128 + 2, (192) + 4),
116
117 // Title screen canvases
118 // Title screen is 32x32 tiles at 8x8 pixels = 256x256 pixels total
119 gui::Canvas title_bg1_canvas_{"##TitleBG1Canvas", ImVec2(256, 256),
121 gui::Canvas title_bg2_canvas_{"##TitleBG2Canvas", ImVec2(256, 256),
123 // Blockset is 128 pixels wide x 512 pixels tall (16x64 8x8 tiles)
124 gui::Canvas title_blockset_canvas_{"##TitleBlocksetCanvas", ImVec2(128, 512),
126
130
131 // Title screen state
134 bool title_h_flip_ = false;
135 bool title_v_flip_ = false;
137 bool show_title_bg1_ = true;
138 bool show_title_bg2_ = true;
139
140 // Overworld map screen state
142 bool ow_map_loaded_ = false;
144
145 // Overworld map canvases
146 gui::Canvas ow_map_canvas_{"##OWMapCanvas", ImVec2(512, 512),
148 gui::Canvas ow_tileset_canvas_{"##OWTilesetCanvas", ImVec2(128, 128),
150
152 absl::Status status_;
153};
154
155} // namespace editor
156} // namespace yaze
157
158#endif
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
Interface for editor classes.
Definition editor.h:179
EditorType type_
Definition editor.h:236
The ScreenEditor class allows the user to edit a variety of screens in the game or create a custom me...
absl::Status LoadDungeonMapTile16(const std::vector< uint8_t > &gfx_data, bool bin_mode=false)
void DrawDungeonMapsRoomGfx()
Draw dungeon room graphics editor with enhanced tile16 editing.
absl::Status Undo() override
absl::Status SaveDungeonMapTile16()
absl::Status Paste() override
absl::Status Cut() override
std::array< gfx::TileInfo, 4 > current_tile16_info
absl::Status Save() override
absl::Status Load() override
absl::Status Update() override
absl::Status Copy() override
absl::Status Find() override
zelda3::OverworldMapScreen ow_map_screen_
void DrawDungeonMapsEditor()
Draw dungeon maps editor with enhanced ROM hacking features.
absl::Status Redo() override
ScreenEditor(Rom *rom=nullptr)
zelda3::TitleScreen title_screen_
zelda3::Inventory inventory_
zelda3::DungeonMapLabels dungeon_map_labels_
std::vector< zelda3::DungeonMap > dungeon_maps_
Represents a palette of colors for the Super Nintendo Entertainment System (SNES).
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:150
void SetCanvasSize(ImVec2 canvas_size)
Definition canvas.h:469
Inventory manages the inventory screen graphics and layout.
Definition inventory.h:36
OverworldMapScreen manages the overworld map (pause menu) graphics.
TitleScreen manages the title screen graphics and tilemap data.
std::unordered_map< int, std::unique_ptr< gfx::Bitmap > > BitmapTable
Definition bitmap.h:497
std::array< std::vector< std::array< std::string, kNumRooms > >, kNumDungeons > DungeonMapLabels
Definition dungeon_map.h:61
Tilemap structure for SNES tile-based graphics management.
Definition tilemap.h:118