Allows the user to edit sprites. More...
#include <sprite_editor.h>
Classes | |
struct | OAMConfig |
Public Member Functions | |
SpriteEditor () | |
absl::Status | Update () override |
Updates the sprite editor. | |
absl::Status | Undo () override |
absl::Status | Redo () override |
absl::Status | Cut () override |
absl::Status | Copy () override |
absl::Status | Paste () override |
absl::Status | Find () override |
Public Member Functions inherited from yaze::app::SharedRom | |
SharedRom ()=default | |
virtual | ~SharedRom ()=default |
std::shared_ptr< Rom > | shared_rom () |
auto | rom () |
Public Member Functions inherited from yaze::app::editor::Editor | |
Editor ()=default | |
virtual | ~Editor ()=default |
EditorType | type () 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. | |
Private Attributes | |
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_ |
Additional Inherited Members | |
Static Public Attributes inherited from yaze::app::SharedRom | |
static std::shared_ptr< Rom > | shared_rom_ = nullptr |
Protected Attributes inherited from yaze::app::editor::Editor | |
EditorType | type_ |
EditorContext | context_ |
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 34 of file sprite_editor.h.
|
inline |
Definition at line 36 of file sprite_editor.h.
References yaze::app::editor::kSprite, and yaze::app::editor::Editor::type_.
|
overridevirtual |
Updates the sprite editor.
Implements yaze::app::editor::Editor.
Definition at line 24 of file sprite_editor.cc.
References DrawCustomSprites(), DrawVanillaSpriteEditor(), yaze::app::SharedRom::rom(), sheets_loaded_, and status_.
Referenced by yaze::app::editor::EditorManager::ManageActiveEditors().
|
inlineoverridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 45 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 46 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 47 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 48 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 49 of file sprite_editor.h.
|
inlineoverridevirtual |
Implements yaze::app::editor::Editor.
Definition at line 50 of file sprite_editor.h.
|
private |
Definition at line 45 of file sprite_editor.cc.
References active_sprites_, current_sprite_id_, DrawCurrentSheets(), DrawSpriteCanvas(), DrawSpritesList(), ICON_MD_ADD, yaze::app::editor::kSpriteTabBarFlags, and sheets_loaded_.
Referenced by Update().
|
private |
Draws the sprites list.
Definition at line 187 of file sprite_editor.cc.
References active_sprites_, current_sprite_id_, yaze::app::gui::GetID(), yaze::app::SharedRom::rom(), and yaze::app::core::UppercaseHexByte().
Referenced by DrawVanillaSpriteEditor().
|
private |
Draws the sprite canvas.
Definition at line 104 of file sprite_editor.cc.
References DrawAnimationFrames(), yaze::app::gui::Canvas::DrawBackground(), yaze::app::gui::Canvas::DrawContextMenu(), DrawCustomSpritesMetadata(), yaze::app::gui::Canvas::DrawGrid(), yaze::app::gui::Canvas::DrawOverlay(), yaze::app::editor::SpriteEditor::OAMConfig::flip_x, yaze::app::editor::SpriteEditor::OAMConfig::flip_y, yaze::app::gui::GetID(), yaze::app::gui::InputHexByte(), yaze::app::gui::InputHexWord(), oam_config_, yaze::app::editor::SpriteEditor::OAMConfig::palette, yaze::app::editor::SpriteEditor::OAMConfig::priority, sprite_canvas_, yaze::app::editor::SpriteEditor::OAMConfig::tile, yaze::app::editor::SpriteEditor::OAMConfig::x, and yaze::app::editor::SpriteEditor::OAMConfig::y.
Referenced by DrawCustomSprites(), and DrawVanillaSpriteEditor().
|
private |
Draws the current sheets.
Definition at line 164 of file sprite_editor.cc.
References current_sheets_, yaze::app::gui::Canvas::DrawBackground(), yaze::app::gui::Canvas::DrawBitmap(), yaze::app::gui::Canvas::DrawContextMenu(), yaze::app::gui::Canvas::DrawGrid(), yaze::app::gui::Canvas::DrawOverlay(), yaze::app::gui::Canvas::DrawTileSelector(), yaze::app::gui::GetID(), graphics_sheet_canvas_, yaze::app::gui::InputHexByte(), and yaze::app::SharedRom::rom().
Referenced by DrawCustomSprites(), and DrawVanillaSpriteEditor().
|
private |
Definition at line 217 of file sprite_editor.cc.
References DrawCurrentSheets(), DrawCustomSpritesMetadata(), and DrawSpriteCanvas().
Referenced by Update().
|
private |
Definition at line 243 of file sprite_editor.cc.
References active_sprites_, current_sprite_id_, custom_sprites_, yaze::app::editor::zsprite::ZSprite::Load(), yaze::app::core::FileDialogWrapper::ShowOpenFileDialog(), and status_.
Referenced by DrawCustomSprites(), and DrawSpriteCanvas().
|
private |
Draws the animation frames manager.
Definition at line 208 of file sprite_editor.cc.
Referenced by DrawSpriteCanvas().
|
private |
Active sprites.
Definition at line 79 of file sprite_editor.h.
Referenced by DrawCustomSpritesMetadata(), DrawSpritesList(), and DrawVanillaSpriteEditor().
|
private |
Current sprite ID.
Definition at line 81 of file sprite_editor.h.
Referenced by DrawCustomSpritesMetadata(), DrawSpritesList(), and DrawVanillaSpriteEditor().
|
private |
Definition at line 82 of file sprite_editor.h.
Referenced by DrawCurrentSheets().
|
private |
Flag indicating whether the sheets are loaded or not.
Definition at line 83 of file sprite_editor.h.
Referenced by DrawVanillaSpriteEditor(), and Update().
|
private |
|
private |
OAM bitmap.
Definition at line 98 of file sprite_editor.h.
|
private |
Sprite canvas.
Definition at line 100 of file sprite_editor.h.
Referenced by DrawSpriteCanvas().
|
private |
Graphics sheet canvas.
Definition at line 104 of file sprite_editor.h.
Referenced by DrawCurrentSheets().
|
private |
|
private |
Status.
Definition at line 110 of file sprite_editor.h.
Referenced by DrawCustomSpritesMetadata(), and Update().