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"
12#include "app/rom.h"
18#include "imgui/imgui.h"
19
20namespace yaze {
21namespace editor {
22
35class ScreenEditor : public Editor {
36 public:
37 explicit ScreenEditor(Rom* rom = nullptr) : rom_(rom) {
38 screen_canvas_.SetCanvasSize(ImVec2(512, 512));
40 }
41
42 void Initialize() override;
43 absl::Status Load() override;
44 absl::Status Update() override;
45 absl::Status Undo() override { return absl::UnimplementedError("Undo"); }
46 absl::Status Redo() override { return absl::UnimplementedError("Redo"); }
47 absl::Status Cut() override { return absl::UnimplementedError("Cut"); }
48 absl::Status Copy() override { return absl::UnimplementedError("Copy"); }
49 absl::Status Paste() override { return absl::UnimplementedError("Paste"); }
50 absl::Status Find() override { return absl::UnimplementedError("Find"); }
51 absl::Status Save() override { return absl::UnimplementedError("Save"); }
52 void set_rom(Rom* rom) { rom_ = rom; }
53 Rom* rom() const { return rom_; }
54
55 std::vector<zelda3::DungeonMap> dungeon_maps_;
56
57 private:
61
64 void DrawToolset();
67
68 // Title screen layer editing
73
74 absl::Status LoadDungeonMapTile16(const std::vector<uint8_t>& gfx_data,
75 bool bin_mode = false);
76 absl::Status SaveDungeonMapTile16();
77
78 void DrawDungeonMapScreen(int i);
82
83 void LoadBinaryGfx();
84
85 enum class EditingMode { DRAW, EDIT };
86
88
89 bool binary_gfx_loaded_ = false;
90
91 uint8_t selected_room = 0;
92
96 int floor_number = 1;
97
98 bool copy_button_pressed = false;
100
102
106 gfx::Tilemap tile8_tilemap_; // Tilemap for 8x8 tiles with on-demand caching
107 std::array<gfx::TileInfo, 4> current_tile16_info;
108
109 gui::Canvas current_tile_canvas_{"##CurrentTileCanvas", ImVec2(32, 32),
113 gui::Canvas tilemap_canvas_{"##TilemapCanvas", ImVec2(128 + 2, (192) + 4),
115
116 // Title screen canvases
117 // Title screen is 32x32 tiles at 8x8 pixels = 256x256 pixels total
118 gui::Canvas title_bg1_canvas_{"##TitleBG1Canvas", ImVec2(256, 256),
120 gui::Canvas title_bg2_canvas_{"##TitleBG2Canvas", ImVec2(256, 256),
122 // Blockset is 128 pixels wide x 512 pixels tall (16x64 8x8 tiles)
123 gui::Canvas title_blockset_canvas_{"##TitleBlocksetCanvas",
124 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.
Definition rom.h:74
Interface for editor classes.
Definition editor.h:122
EditorType type_
Definition editor.h:164
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:59
void SetCanvasSize(ImVec2 canvas_size)
Definition canvas.h:309
Inventory manages the inventory screen graphics and layout.
Definition inventory.h:35
OverworldMapScreen manages the overworld map (pause menu) graphics.
TitleScreen manages the title screen graphics and tilemap data.
std::unordered_map< int, gfx::Bitmap > BitmapTable
Definition bitmap.h:365
std::array< std::vector< std::array< std::string, kNumRooms > >, kNumDungeons > DungeonMapLabels
Definition dungeon_map.h:60
Main namespace for the application.
Definition controller.cc:20
Tilemap structure for SNES tile-based graphics management.
Definition tilemap.h:109