yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
link_sprite_panel.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_GRAPHICS_LINK_SPRITE_PANEL_H
2#define YAZE_APP_EDITOR_GRAPHICS_LINK_SPRITE_PANEL_H
3
4#include <array>
5#include <string>
6
7#include "absl/status/status.h"
10#include "app/gfx/core/bitmap.h"
13#include "app/gui/core/icons.h"
14
15namespace yaze {
16
17class Rom;
18
19namespace editor {
20
32 public:
33 static constexpr int kNumLinkSheets = 14;
34
38 enum class PaletteType {
39 kGreenMail = 0,
40 kBlueMail = 1,
41 kRedMail = 2,
42 kBunny = 3
43 };
44
46
47 // ==========================================================================
48 // EditorPanel Identity
49 // ==========================================================================
50
51 std::string GetId() const override { return "graphics.link_sprite"; }
52 std::string GetDisplayName() const override { return "Link Sprite"; }
53 std::string GetIcon() const override { return ICON_MD_PERSON; }
54 std::string GetEditorCategory() const override { return "Graphics"; }
55 int GetPriority() const override { return 40; }
56
57 // ==========================================================================
58 // EditorPanel Lifecycle
59 // ==========================================================================
60
64 void Initialize();
65
69 void Draw(bool* p_open) override;
70
75 absl::Status Update();
76
80 bool HasUnsavedChanges() const { return has_unsaved_changes_; }
81
82 private:
86 void DrawToolbar();
87
91 void DrawSheetGrid();
92
96 void DrawSheetThumbnail(int sheet_index);
97
101 void DrawPreviewCanvas();
102
106 void DrawPaletteSelector();
107
111 void DrawInfoPanel();
112
116 void ImportZspr();
117
121 void ResetToVanilla();
122
127
131 absl::Status LoadLinkSheets();
132
137
141 static const char* GetPaletteName(PaletteType type);
142
145
146 // Link sheets loaded from ROM
147 std::array<gfx::Bitmap, kNumLinkSheets> link_sheets_;
148 bool sheets_loaded_ = false;
149
150 // UI state
154
155 // Preview canvas
157 float preview_zoom_ = 4.0f;
158
159 // Currently loaded ZSPR (if any)
160 std::optional<gfx::ZsprData> loaded_zspr_;
161
162 // Thumbnail size
163 static constexpr float kThumbnailSize = 64.0f;
164 static constexpr float kThumbnailPadding = 4.0f;
165};
166
167} // namespace editor
168} // namespace yaze
169
170#endif // YAZE_APP_EDITOR_GRAPHICS_LINK_SPRITE_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:24
Base interface for all logical panel components.
Shared state between GraphicsEditor panel components.
Dedicated panel for editing Link's 14 graphics sheets.
static constexpr float kThumbnailPadding
PaletteType
Link sprite palette types.
absl::Status LoadLinkSheets()
Load Link graphics sheets from ROM.
void Draw(bool *p_open) override
Draw the panel UI (EditorPanel interface)
void Initialize()
Initialize the panel and load Link sheets.
void OpenSheetInPixelEditor()
Open selected sheet in the main pixel editor.
absl::Status Update()
Legacy Update method for backward compatibility.
std::optional< gfx::ZsprData > loaded_zspr_
void ApplySelectedPalette()
Apply the selected palette to Link sheets for display.
bool HasUnsavedChanges() const
Check if the panel has unsaved changes.
std::string GetEditorCategory() const override
Editor category this panel belongs to.
std::string GetIcon() const override
Material Design icon for this panel.
void ImportZspr()
Handle ZSPR file import.
int GetPriority() const override
Get display priority for menu ordering.
void DrawSheetGrid()
Draw the 4x4 sheet selection grid.
static constexpr int kNumLinkSheets
void DrawPreviewCanvas()
Draw the preview canvas for selected sheet.
void DrawInfoPanel()
Draw info panel with stats.
static const char * GetPaletteName(PaletteType type)
Get the name of a palette type.
void DrawPaletteSelector()
Draw the palette selector dropdown.
std::array< gfx::Bitmap, kNumLinkSheets > link_sheets_
LinkSpritePanel(GraphicsEditorState *state, Rom *rom)
void DrawToolbar()
Draw the toolbar with Import/Reset buttons.
void ResetToVanilla()
Reset Link sheets to vanilla ROM data.
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
void DrawSheetThumbnail(int sheet_index)
Draw a single Link sheet thumbnail.
static constexpr float kThumbnailSize
std::string GetId() const override
Unique identifier for this panel.
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:150
#define ICON_MD_PERSON
Definition icons.h:1415