yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::app::editor::SpriteEditor Class Reference

Allows the user to edit sprites. More...

#include <sprite_editor.h>

Inheritance diagram for yaze::app::editor::SpriteEditor:
Collaboration diagram for yaze::app::editor::SpriteEditor:

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< Romshared_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::ZSpritecustom_sprites_
 
absl::Status status_
 

Additional Inherited Members

- Static Public Attributes inherited from yaze::app::SharedRom
static std::shared_ptr< Romshared_rom_ = nullptr
 
- Protected Attributes inherited from yaze::app::editor::Editor
EditorType type_
 
EditorContext context_
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SpriteEditor()

yaze::app::editor::SpriteEditor::SpriteEditor ( )
inline

Definition at line 36 of file sprite_editor.h.

References yaze::app::editor::kSprite, and yaze::app::editor::Editor::type_.

Member Function Documentation

◆ Update()

absl::Status yaze::app::editor::SpriteEditor::Update ( )
overridevirtual

Updates the sprite editor.

Returns
An absl::Status indicating the success or failure of the update.

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().

Here is the call graph for this function:

◆ Undo()

absl::Status yaze::app::editor::SpriteEditor::Undo ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 45 of file sprite_editor.h.

◆ Redo()

absl::Status yaze::app::editor::SpriteEditor::Redo ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 46 of file sprite_editor.h.

◆ Cut()

absl::Status yaze::app::editor::SpriteEditor::Cut ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 47 of file sprite_editor.h.

◆ Copy()

absl::Status yaze::app::editor::SpriteEditor::Copy ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 48 of file sprite_editor.h.

◆ Paste()

absl::Status yaze::app::editor::SpriteEditor::Paste ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 49 of file sprite_editor.h.

◆ Find()

absl::Status yaze::app::editor::SpriteEditor::Find ( )
inlineoverridevirtual

Implements yaze::app::editor::Editor.

Definition at line 50 of file sprite_editor.h.

◆ DrawVanillaSpriteEditor()

void yaze::app::editor::SpriteEditor::DrawVanillaSpriteEditor ( )
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().

Here is the call graph for this function:

◆ DrawSpritesList()

void yaze::app::editor::SpriteEditor::DrawSpritesList ( )
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().

Here is the call graph for this function:

◆ DrawSpriteCanvas()

◆ DrawCurrentSheets()

◆ DrawCustomSprites()

void yaze::app::editor::SpriteEditor::DrawCustomSprites ( )
private

Definition at line 217 of file sprite_editor.cc.

References DrawCurrentSheets(), DrawCustomSpritesMetadata(), and DrawSpriteCanvas().

Referenced by Update().

Here is the call graph for this function:

◆ DrawCustomSpritesMetadata()

void yaze::app::editor::SpriteEditor::DrawCustomSpritesMetadata ( )
private

◆ DrawAnimationFrames()

void yaze::app::editor::SpriteEditor::DrawAnimationFrames ( )
private

Draws the animation frames manager.

Definition at line 208 of file sprite_editor.cc.

Referenced by DrawSpriteCanvas().

Member Data Documentation

◆ active_sprites_

ImVector<int> yaze::app::editor::SpriteEditor::active_sprites_
private

Active sprites.

Definition at line 79 of file sprite_editor.h.

Referenced by DrawCustomSpritesMetadata(), DrawSpritesList(), and DrawVanillaSpriteEditor().

◆ current_sprite_id_

int yaze::app::editor::SpriteEditor::current_sprite_id_
private

Current sprite ID.

Definition at line 81 of file sprite_editor.h.

Referenced by DrawCustomSpritesMetadata(), DrawSpritesList(), and DrawVanillaSpriteEditor().

◆ current_sheets_

uint8_t yaze::app::editor::SpriteEditor::current_sheets_[8] = {0x00, 0x0A, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00}
private

Definition at line 82 of file sprite_editor.h.

Referenced by DrawCurrentSheets().

◆ sheets_loaded_

bool yaze::app::editor::SpriteEditor::sheets_loaded_
private
Initial value:
=
false

Flag indicating whether the sheets are loaded or not.

Definition at line 83 of file sprite_editor.h.

Referenced by DrawVanillaSpriteEditor(), and Update().

◆ oam_config_

OAMConfig yaze::app::editor::SpriteEditor::oam_config_
private

OAM configuration.

Definition at line 97 of file sprite_editor.h.

Referenced by DrawSpriteCanvas().

◆ oam_bitmap_

gui::Bitmap yaze::app::editor::SpriteEditor::oam_bitmap_
private

OAM bitmap.

Definition at line 98 of file sprite_editor.h.

◆ sprite_canvas_

gui::Canvas yaze::app::editor::SpriteEditor::sprite_canvas_
private
Initial value:
{
"SpriteCanvas", ImVec2(0x200, 0x200),

Sprite canvas.

Definition at line 100 of file sprite_editor.h.

Referenced by DrawSpriteCanvas().

◆ graphics_sheet_canvas_

gui::Canvas yaze::app::editor::SpriteEditor::graphics_sheet_canvas_
private
Initial value:
{
"GraphicsSheetCanvas", ImVec2(0x80 * 2 + 2, 0x40 * 8 + 2),

Graphics sheet canvas.

Definition at line 104 of file sprite_editor.h.

Referenced by DrawCurrentSheets().

◆ custom_sprites_

std::vector<zsprite::ZSprite> yaze::app::editor::SpriteEditor::custom_sprites_
private

Sprites.

Definition at line 108 of file sprite_editor.h.

Referenced by DrawCustomSpritesMetadata().

◆ status_

absl::Status yaze::app::editor::SpriteEditor::status_
private

Status.

Definition at line 110 of file sprite_editor.h.

Referenced by DrawCustomSpritesMetadata(), and Update().


The documentation for this class was generated from the following files: