yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
link_sprite_view.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_GRAPHICS_LINK_SPRITE_VIEW_H
2#define YAZE_APP_EDITOR_GRAPHICS_LINK_SPRITE_VIEW_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 // WindowContent Identity
49 // ==========================================================================
50
51 std::string GetId() const override { return "graphics.link_sprite_editor"; }
52 std::string GetDisplayName() const override { return "Link Sprite Editor"; }
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 float GetPreferredWidth() const override { return 600.0f; }
57
58 // ==========================================================================
59 // WindowContent Lifecycle
60 // ==========================================================================
61
65 void Initialize();
66
70 void Draw(bool* p_open) override;
71
76 absl::Status Update();
77
81 bool HasUnsavedChanges() const { return has_unsaved_changes_; }
82
83 private:
87 void DrawToolbar();
88
92 void DrawSheetGrid();
93
97 void DrawSheetThumbnail(int sheet_index);
98
102 void DrawPreviewCanvas();
103
107 void DrawPaletteSelector();
108
112 void DrawInfoPanel();
113
117 void ImportZspr();
118
122 void ResetToVanilla();
123
128
132 absl::Status LoadLinkSheets();
133
138
142 static const char* GetPaletteName(PaletteType type);
143
146
147 // Link sheets loaded from ROM
148 std::array<gfx::Bitmap, kNumLinkSheets> link_sheets_;
149 bool sheets_loaded_ = false;
150
151 // UI state
155
156 // Preview canvas
158 float preview_zoom_ = 4.0f;
159
160 // Currently loaded ZSPR (if any)
161 std::optional<gfx::ZsprData> loaded_zspr_;
162
163 // Thumbnail size
164 static constexpr float kThumbnailSize = 64.0f;
165 static constexpr float kThumbnailPadding = 4.0f;
166};
167
168} // namespace editor
169} // namespace yaze
170
171#endif // YAZE_APP_EDITOR_GRAPHICS_LINK_SPRITE_VIEW_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
Shared state between GraphicsEditor panel components.
Dedicated view for editing Link's 14 graphics sheets.
void ApplySelectedPalette()
Apply the selected palette to Link sheets for display.
float GetPreferredWidth() const override
Get preferred width for this panel (optional)
void ResetToVanilla()
Reset Link sheets to vanilla ROM data.
static constexpr float kThumbnailPadding
static const char * GetPaletteName(PaletteType type)
Get the name of a palette type.
bool HasUnsavedChanges() const
Check if the view has unsaved changes.
std::array< gfx::Bitmap, kNumLinkSheets > link_sheets_
int GetPriority() const override
Get display priority for menu ordering.
void Draw(bool *p_open) override
Draw the view UI (WindowContent interface)
LinkSpriteView(GraphicsEditorState *state, Rom *rom)
void DrawPreviewCanvas()
Draw the preview canvas for selected sheet.
void DrawPaletteSelector()
Draw the palette selector dropdown.
void ImportZspr()
Handle ZSPR file import.
std::optional< gfx::ZsprData > loaded_zspr_
absl::Status LoadLinkSheets()
Load Link graphics sheets from ROM.
void DrawSheetGrid()
Draw the 4x4 sheet selection grid.
std::string GetId() const override
Unique identifier for this panel.
void Initialize()
Initialize the view and load Link sheets.
std::string GetEditorCategory() const override
Editor category this panel belongs to.
void DrawToolbar()
Draw the toolbar with Import/Reset buttons.
void DrawSheetThumbnail(int sheet_index)
Draw a single Link sheet thumbnail.
std::string GetIcon() const override
Material Design icon for this panel.
GraphicsEditorState * state_
void DrawInfoPanel()
Draw info panel with stats.
void OpenSheetInPixelEditor()
Open selected sheet in the main pixel editor.
static constexpr float kThumbnailSize
PaletteType
Link sprite palette types.
static constexpr int kNumLinkSheets
std::string GetDisplayName() const override
Human-readable name shown in menus and title bars.
absl::Status Update()
Legacy Update method for backward compatibility.
Base interface for all logical window content components.
Modern, robust canvas for drawing and manipulating graphics.
Definition canvas.h:150
#define ICON_MD_PERSON
Definition icons.h:1415