yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
object_tile_editor_panel.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_DUNGEON_PANELS_OBJECT_TILE_EDITOR_PANEL_H_
2#define YAZE_APP_EDITOR_DUNGEON_PANELS_OBJECT_TILE_EDITOR_PANEL_H_
3
4#include <array>
5#include <functional>
6#include <memory>
7#include <string>
8
12#include "app/gfx/core/bitmap.h"
15#include "app/gui/core/icons.h"
16#include "rom/rom.h"
18#include "zelda3/dungeon/room.h"
19
20namespace yaze {
21namespace editor {
22
23struct ObjectTileEditorPanelTestAccess;
24
36 public:
38
39 std::string GetId() const override { return "dungeon.object_tile_editor"; }
40 std::string GetDisplayName() const override { return "Object Tile Editor"; }
41 std::string GetIcon() const override { return ICON_MD_GRID_ON; }
42 std::string GetEditorCategory() const override { return "Dungeon"; }
43 int GetPriority() const override { return 65; }
44 float GetPreferredWidth() const override { return 550.0f; }
45
46 void Draw(bool* p_open) override;
47
48 void OpenForObject(int16_t object_id, int room_id, DungeonRoomStore* rooms);
49 void OpenForNewObject(int width, int height, const std::string& filename,
50 int16_t object_id, int room_id,
51 DungeonRoomStore* rooms);
52 void Close();
53 bool IsOpen() const { return is_open_; }
54
56
57 // Callback fired on first successful save of a new object
59 std::function<void(int, const std::string&)> cb) {
60 on_object_created_ = std::move(cb);
61 }
62
63 private:
64 enum class ActionStatusTone {
65 kNone,
68 kError,
69 };
70
72 void ClearActionStatus();
73 void SetActionStatus(ActionStatusTone tone, std::string message);
75 std::string BuildWindowTitle() const;
78 bool HasSharedTileDataConflict() const;
79 bool HasRenderableRoomContext() const;
81
82 void DrawTileGrid();
83 void DrawSourceSheet();
84 void DrawTileProperties();
85 void DrawActionBar();
87
89 void RenderTile8Atlas();
91
92 // Apply: write back, re-render room, reset modified flags.
93 // If confirm_shared is true and tile data is shared, opens confirmation modal
94 // instead of applying immediately.
95 void ApplyChanges(bool confirm_shared = true);
96
97 // State
99 std::unique_ptr<zelda3::ObjectTileEditor> tile_editor_;
104
105 // Canvases
106 gui::Canvas tile_grid_canvas_{"##ObjTileGrid", ImVec2(256, 256)};
107 gui::Canvas source_sheet_canvas_{"##ObjTileSource", ImVec2(256, 512)};
108
109 // Bitmaps
112 bool preview_dirty_ = true;
113 bool atlas_dirty_ = true;
114
115 // Shared tile data confirmation
118 int shared_tile_data_usage_override_ = -1; // Test seam; production keeps -1.
121
122 // New object creation state
123 bool is_new_object_ = false;
124 std::function<void(int, const std::string&)> on_object_created_;
125
126 // Context
130 int16_t current_object_id_ = -1;
133 bool is_open_ = false;
134};
135
136} // namespace editor
137} // namespace yaze
138
139#endif // YAZE_APP_EDITOR_DUNGEON_PANELS_OBJECT_TILE_EDITOR_PANEL_H_
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:28
Panel for editing the tile8 composition of dungeon objects.
void ApplyChanges(bool confirm_shared=true)
void SetCurrentPaletteGroup(const gfx::PaletteGroup &group)
int GetPriority() const override
Get display priority for menu ordering.
ObjectTileEditorPanel(gfx::IRenderer *renderer, Rom *rom)
void OpenForObject(int16_t object_id, int room_id, DungeonRoomStore *rooms)
void SetObjectCreatedCallback(std::function< void(int, const std::string &)> cb)
std::unique_ptr< zelda3::ObjectTileEditor > tile_editor_
std::function< void(int, const std::string &) on_object_created_)
float GetPreferredWidth() const override
Get preferred width for this panel (optional)
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
std::string GetEditorCategory() const override
Editor category this panel belongs to.
std::string GetIcon() const override
Material Design icon for this panel.
void Draw(bool *p_open) override
Draw the panel content.
void OpenForNewObject(int width, int height, const std::string &filename, int16_t object_id, int room_id, DungeonRoomStore *rooms)
std::string GetId() const override
Unique identifier for this panel.
void SetActionStatus(ActionStatusTone tone, std::string message)
Base interface for all logical window content components.
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
Defines an abstract interface for all rendering operations.
Definition irenderer.h:60
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:64
#define ICON_MD_GRID_ON
Definition icons.h:896
Represents a group of palettes.
Editable tile8 layout captured from an object's draw trace.