Allows the user to edit sprites. More...
#include <sprite_editor.h>
Classes | |
struct | OAMConfig |
Public Member Functions | |
SpriteEditor (Rom *rom=nullptr) | |
void | Initialize () override |
absl::Status | Load () override |
absl::Status | Update () override |
absl::Status | Undo () override |
absl::Status | Redo () override |
absl::Status | Cut () override |
absl::Status | Copy () override |
absl::Status | Paste () override |
absl::Status | Find () override |
absl::Status | Save () override |
void | set_rom (Rom *rom) |
Rom * | rom () const |
![]() | |
Editor ()=default | |
virtual | ~Editor ()=default |
virtual absl::Status | Clear () |
EditorType | type () const |
void | set_context (EditorContext *context) |
bool * | active () |
void | set_active (bool active) |
virtual bool | IsRomLoaded () const |
virtual std::string | GetRomStatus () const |
Private Member Functions | |
void | DrawVanillaSpriteEditor () |
void | DrawSpritesList () |
Draws the sprites list. | |
void | DrawSpriteCanvas () |
Draws the sprite canvas. | |
void | DrawCurrentSheets () |
Draws the current sheets. | |
void | DrawCustomSprites () |
void | DrawCustomSpritesMetadata () |
void | DrawAnimationFrames () |
Draws the animation frames manager. | |
void | DrawToolset () |
Private Attributes | |
bool | show_vanilla_editor_ = false |
bool | show_custom_editor_ = false |
ImVector< int > | active_sprites_ |
int | current_sprite_id_ |
uint8_t | current_sheets_ [8] = {0x00, 0x0A, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00} |
bool | sheets_loaded_ |
OAMConfig | oam_config_ |
gui::Bitmap | oam_bitmap_ |
gui::Canvas | sprite_canvas_ |
gui::Canvas | graphics_sheet_canvas_ |
std::vector< zsprite::ZSprite > | custom_sprites_ |
absl::Status | status_ |
Rom * | rom_ |
Additional Inherited Members | |
![]() | |
std::string | MakeCardTitle (const std::string &base_title) const |
template<typename T > | |
absl::StatusOr< T > | SafeRomAccess (std::function< T()> accessor, const std::string &operation="") const |
![]() | |
bool | active_ = false |
EditorType | type_ |
EditorContext * | context_ = nullptr |
Allows the user to edit sprites.
This class provides functionality for updating the sprite editor, drawing the editor table, drawing the sprite canvas, and drawing the current sheets.
Definition at line 38 of file sprite_editor.h.
|
inlineexplicit |
Definition at line 40 of file sprite_editor.h.
References yaze::editor::kSprite, and yaze::editor::Editor::type_.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 27 of file sprite_editor.cc.
References yaze::gui::EditorCardManager::Get(), ICON_MD_ADD_CIRCLE, ICON_MD_SMART_TOY, show_custom_editor_, and show_vanilla_editor_.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 52 of file sprite_editor.cc.
Referenced by yaze::editor::EditorManager::LoadAssets().
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 57 of file sprite_editor.cc.
References yaze::gui::EditorCard::Begin(), DrawCustomSprites(), DrawToolset(), DrawVanillaSpriteEditor(), yaze::gui::EditorCard::End(), ICON_MD_ADD_MODERATOR, ICON_MD_PEST_CONTROL_RODENT, yaze::editor::Editor::MakeCardTitle(), rom(), sheets_loaded_, show_custom_editor_, show_vanilla_editor_, status_, and yaze::gui::VerticalSpacing().
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 47 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 48 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 49 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 50 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 51 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 52 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 53 of file sprite_editor.h.
|
inline |
|
inline |
Definition at line 59 of file sprite_editor.h.
References rom_.
Referenced by DrawSpritesList(), set_rom(), and Update().
|
private |
Definition at line 102 of file sprite_editor.cc.
References active_sprites_, current_sprite_id_, DrawCurrentSheets(), DrawSpriteCanvas(), DrawSpritesList(), ICON_MD_ADD, yaze::editor::kSpriteTabBarFlags, and sheets_loaded_.
Referenced by Update().
|
private |
Draws the sprites list.
Definition at line 245 of file sprite_editor.cc.
References active_sprites_, current_sprite_id_, yaze::gui::GetID(), yaze::util::HexByte(), yaze::Rom::resource_label(), rom(), and yaze::core::ResourceLabelManager::SelectableLabelWithNameEdit().
Referenced by DrawVanillaSpriteEditor().
|
private |
Draws the sprite canvas.
Definition at line 161 of file sprite_editor.cc.
References DrawAnimationFrames(), yaze::gui::Canvas::DrawBackground(), yaze::gui::Canvas::DrawContextMenu(), DrawCustomSpritesMetadata(), yaze::gui::Canvas::DrawGrid(), yaze::gui::Canvas::DrawOverlay(), yaze::editor::SpriteEditor::OAMConfig::flip_x, yaze::editor::SpriteEditor::OAMConfig::flip_y, yaze::gui::GetID(), yaze::gui::InputHexByte(), yaze::gui::InputHexWord(), oam_config_, yaze::editor::SpriteEditor::OAMConfig::palette, yaze::editor::SpriteEditor::OAMConfig::priority, sprite_canvas_, yaze::editor::SpriteEditor::OAMConfig::tile, yaze::editor::SpriteEditor::OAMConfig::x, and yaze::editor::SpriteEditor::OAMConfig::y.
Referenced by DrawCustomSprites(), and DrawVanillaSpriteEditor().
|
private |
Draws the current sheets.
Definition at line 221 of file sprite_editor.cc.
References current_sheets_, yaze::gui::Canvas::DrawBackground(), yaze::gui::Canvas::DrawBitmap(), yaze::gui::Canvas::DrawContextMenu(), yaze::gui::Canvas::DrawGrid(), yaze::gui::Canvas::DrawOverlay(), yaze::gui::Canvas::DrawTileSelector(), yaze::gfx::Arena::Get(), yaze::gui::GetID(), graphics_sheet_canvas_, and yaze::gui::InputHexByte().
Referenced by DrawCustomSprites(), and DrawVanillaSpriteEditor().
|
private |
Definition at line 275 of file sprite_editor.cc.
References DrawCurrentSheets(), DrawCustomSpritesMetadata(), and DrawSpriteCanvas().
Referenced by Update().
|
private |
Definition at line 301 of file sprite_editor.cc.
References active_sprites_, current_sprite_id_, custom_sprites_, yaze::editor::zsprite::ZSprite::Load(), yaze::util::FileDialogWrapper::ShowOpenFileDialog(), and status_.
Referenced by DrawCustomSprites(), and DrawSpriteCanvas().
|
private |
Draws the animation frames manager.
Definition at line 266 of file sprite_editor.cc.
Referenced by DrawSpriteCanvas().
|
private |
Definition at line 87 of file sprite_editor.cc.
References yaze::gui::Toolset::AddAction(), yaze::gui::Toolset::Begin(), yaze::gui::Toolset::End(), ICON_MD_ADD_MODERATOR, ICON_MD_PEST_CONTROL_RODENT, show_custom_editor_, and show_vanilla_editor_.
Referenced by Update().
|
private |
Definition at line 89 of file sprite_editor.h.
Referenced by DrawToolset(), Initialize(), and Update().
|
private |
Definition at line 90 of file sprite_editor.h.
Referenced by DrawToolset(), Initialize(), and Update().
|
private |
Active sprites.
Definition at line 92 of file sprite_editor.h.
Referenced by DrawCustomSpritesMetadata(), DrawSpritesList(), and DrawVanillaSpriteEditor().
|
private |
Current sprite ID.
Definition at line 94 of file sprite_editor.h.
Referenced by DrawCustomSpritesMetadata(), DrawSpritesList(), and DrawVanillaSpriteEditor().
|
private |
Definition at line 95 of file sprite_editor.h.
Referenced by DrawCurrentSheets().
|
private |
Flag indicating whether the sheets are loaded or not.
Definition at line 96 of file sprite_editor.h.
Referenced by DrawVanillaSpriteEditor(), and Update().
|
private |
OAM configuration.
Definition at line 110 of file sprite_editor.h.
Referenced by DrawSpriteCanvas().
|
private |
OAM bitmap.
Definition at line 111 of file sprite_editor.h.
|
private |
Sprite canvas.
Definition at line 113 of file sprite_editor.h.
Referenced by DrawSpriteCanvas().
|
private |
Graphics sheet canvas.
Definition at line 117 of file sprite_editor.h.
Referenced by DrawCurrentSheets().
|
private |
|
private |
Status.
Definition at line 123 of file sprite_editor.h.
Referenced by DrawCustomSpritesMetadata(), and Update().
|
private |
Definition at line 125 of file sprite_editor.h.