yaze 0.2.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"
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 editor {
19
32class ScreenEditor : public Editor {
33 public:
34 explicit ScreenEditor(Rom* rom = nullptr) : rom_(rom) {
35 screen_canvas_.SetCanvasSize(ImVec2(512, 512));
37 }
38
39 void Initialize() override;
40 absl::Status Load() override;
41 absl::Status Update() override;
42 absl::Status Undo() override { return absl::UnimplementedError("Undo"); }
43 absl::Status Redo() override { return absl::UnimplementedError("Redo"); }
44 absl::Status Cut() override { return absl::UnimplementedError("Cut"); }
45 absl::Status Copy() override { return absl::UnimplementedError("Copy"); }
46 absl::Status Paste() override { return absl::UnimplementedError("Paste"); }
47 absl::Status Find() override { return absl::UnimplementedError("Find"); }
48 absl::Status Save() override { return absl::UnimplementedError("Save"); }
49
50 // Set the ROM pointer
51 void set_rom(Rom* rom) { rom_ = rom; }
52
53 // Get the ROM pointer
54 Rom* rom() const { return rom_; }
55
56 absl::Status SaveDungeonMaps();
57
58 private:
63
65 void DrawToolset();
67
68 absl::Status LoadDungeonMaps();
69 absl::Status LoadDungeonMapTile16(const std::vector<uint8_t> &gfx_data,
70 bool bin_mode = false);
71 absl::Status SaveDungeonMapTile16();
72
76
77 void LoadBinaryGfx();
78
79 enum class EditingMode { DRAW, EDIT };
80
82
84 bool binary_gfx_loaded_ = false;
85
86 uint8_t selected_room = 0;
87 uint8_t boss_room = 0;
88
92 int floor_number = 1;
93
94 bool copy_button_pressed = false;
96
97 std::array<uint16_t, 4> current_tile16_data_;
98 std::unordered_map<int, gfx::Bitmap> tile16_individual_;
99 std::vector<gfx::Bitmap> tile8_individual_;
100 std::vector<uint8_t> all_gfx_;
101 std::vector<uint8_t> gfx_bin_data_;
102 std::vector<zelda3::DungeonMap> dungeon_maps_;
103 std::vector<std::vector<std::array<std::string, 25>>> dungeon_map_labels_;
104
105 absl::Status status_;
106
111
112 gui::Canvas current_tile_canvas_{"##CurrentTileCanvas", ImVec2(32, 32),
116 gui::Canvas tilemap_canvas_{"##TilemapCanvas", ImVec2(128 + 2, (192) + 4),
118
120};
121
122} // namespace editor
123} // namespace yaze
124
125#endif
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:59
EditorType type_
Definition editor.h:92
absl::Status LoadDungeonMapTile16(const std::vector< uint8_t > &gfx_data, bool bin_mode=false)
std::vector< gfx::Bitmap > tile8_individual_
absl::Status Undo() override
absl::Status SaveDungeonMapTile16()
absl::Status Paste() override
absl::Status Cut() override
absl::Status Save() override
absl::Status Load() override
absl::Status Update() override
absl::Status Copy() override
absl::Status Find() override
std::vector< uint8_t > gfx_bin_data_
absl::Status Redo() override
ScreenEditor(Rom *rom=nullptr)
std::array< uint16_t, 4 > current_tile16_data_
std::vector< std::vector< std::array< std::string, 25 > > > dungeon_map_labels_
zelda3::Inventory inventory_
std::vector< uint8_t > all_gfx_
std::vector< zelda3::DungeonMap > dungeon_maps_
std::unordered_map< int, gfx::Bitmap > tile16_individual_
gfx::InternalTile16 current_tile16_info
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:28
Represents a canvas for drawing and manipulating graphics.
Definition canvas.h:36
Editors are the view controllers for the application.
std::unordered_map< int, gfx::Bitmap > BitmapTable
Definition bitmap.h:254
Main namespace for the application.
Definition controller.cc:18