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"
8#include "app/gfx/bitmap.h"
11#include "app/gfx/tilemap.h"
12#include "app/gui/canvas.h"
13#include "app/rom.h"
17#include "imgui/imgui.h"
18
19namespace yaze {
20namespace editor {
21
34class ScreenEditor : public Editor {
35 public:
36 explicit ScreenEditor(Rom* rom = nullptr) : rom_(rom) {
37 screen_canvas_.SetCanvasSize(ImVec2(512, 512));
39 }
40
41 void Initialize() override;
42 absl::Status Load() override;
43 absl::Status Update() override;
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 absl::Status Save() override { return absl::UnimplementedError("Save"); }
51 void set_rom(Rom* rom) { rom_ = rom; }
52 Rom* rom() const { return rom_; }
53
54 std::vector<zelda3::DungeonMap> dungeon_maps_;
55
56 private:
60
62 void DrawToolset();
65
66 absl::Status LoadDungeonMapTile16(const std::vector<uint8_t>& gfx_data,
67 bool bin_mode = false);
68 absl::Status SaveDungeonMapTile16();
69
70 void DrawDungeonMapScreen(int i);
74
75 void LoadBinaryGfx();
76
77 enum class EditingMode { DRAW, EDIT };
78
80
81 // Card visibility - ALL FALSE by default to prevent crash on ROM load
82 // Cards only shown when user explicitly opens them via View menu or shortcuts
83 bool show_dungeon_maps_ = false;
85 bool show_overworld_map_ = false;
86 bool show_title_screen_ = false;
87 bool show_naming_screen_ = false;
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
101 std::vector<gfx::Bitmap> tile8_individual_;
103
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
118 absl::Status status_;
119};
120
121} // namespace editor
122} // namespace yaze
123
124#endif
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:71
Interface for editor classes.
Definition editor.h:82
EditorType type_
Definition editor.h:123
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.
std::vector< gfx::Bitmap > tile8_individual_
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
void DrawDungeonMapsEditor()
Draw dungeon maps editor with enhanced ROM hacking features.
absl::Status Redo() override
ScreenEditor(Rom *rom=nullptr)
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:54
void SetCanvasSize(ImVec2 canvas_size)
Definition canvas.h:325
std::unordered_map< int, gfx::Bitmap > BitmapTable
Definition bitmap.h:333
std::array< std::vector< std::array< std::string, kNumRooms > >, kNumDungeons > DungeonMapLabels
Definition dungeon_map.h:60
Main namespace for the application.
Tilemap structure for SNES tile-based graphics management.
Definition tilemap.h:109