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

Allows the user to edit sprites. More...

#include <sprite_editor.h>

Inheritance diagram for yaze::editor::SpriteEditor:

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)
 
Romrom () const
 
- Public Member Functions inherited from yaze::editor::Editor
 Editor ()=default
 
virtual ~Editor ()=default
 
virtual absl::Status Clear ()
 
EditorType type () const
 
void set_context (EditorContext *context)
 
bool * active ()
 
void set_active (bool active)
 

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_
 
Romrom_
 

Additional Inherited Members

- Protected Attributes inherited from yaze::editor::Editor
bool active_ = false
 
EditorType type_
 
EditorContextcontext_ = nullptr
 

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 36 of file sprite_editor.h.

Constructor & Destructor Documentation

◆ SpriteEditor()

yaze::editor::SpriteEditor::SpriteEditor ( Rom * rom = nullptr)
inlineexplicit

Definition at line 38 of file sprite_editor.h.

References yaze::editor::kSprite, rom(), rom_, and yaze::editor::Editor::type_.

Here is the call graph for this function:

Member Function Documentation

◆ Initialize()

void yaze::editor::SpriteEditor::Initialize ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 25 of file sprite_editor.cc.

◆ Load()

absl::Status yaze::editor::SpriteEditor::Load ( )
overridevirtual

Implements yaze::editor::Editor.

Definition at line 27 of file sprite_editor.cc.

◆ Update()

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

Implements yaze::editor::Editor.

Definition at line 29 of file sprite_editor.cc.

References DrawCustomSprites(), DrawVanillaSpriteEditor(), rom(), sheets_loaded_, and status_.

Here is the call graph for this function:

◆ Undo()

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

Implements yaze::editor::Editor.

Definition at line 45 of file sprite_editor.h.

◆ Redo()

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

Implements yaze::editor::Editor.

Definition at line 46 of file sprite_editor.h.

◆ Cut()

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

Implements yaze::editor::Editor.

Definition at line 47 of file sprite_editor.h.

◆ Copy()

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

Implements yaze::editor::Editor.

Definition at line 48 of file sprite_editor.h.

◆ Paste()

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

Implements yaze::editor::Editor.

Definition at line 49 of file sprite_editor.h.

◆ Find()

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

Implements yaze::editor::Editor.

Definition at line 50 of file sprite_editor.h.

◆ Save()

absl::Status yaze::editor::SpriteEditor::Save ( )
inlineoverridevirtual

Implements yaze::editor::Editor.

Definition at line 51 of file sprite_editor.h.

◆ set_rom()

void yaze::editor::SpriteEditor::set_rom ( Rom * rom)
inline

Definition at line 54 of file sprite_editor.h.

References rom(), and rom_.

Here is the call graph for this function:

◆ rom()

Rom * yaze::editor::SpriteEditor::rom ( ) const
inline

Definition at line 57 of file sprite_editor.h.

References rom_.

Referenced by DrawSpritesList(), set_rom(), SpriteEditor(), and Update().

◆ DrawVanillaSpriteEditor()

void yaze::editor::SpriteEditor::DrawVanillaSpriteEditor ( )
private

Definition at line 50 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().

Here is the call graph for this function:

◆ DrawSpritesList()

void yaze::editor::SpriteEditor::DrawSpritesList ( )
private

◆ DrawSpriteCanvas()

void yaze::editor::SpriteEditor::DrawSpriteCanvas ( )
private

◆ DrawCurrentSheets()

void yaze::editor::SpriteEditor::DrawCurrentSheets ( )
private

Draws the current sheets.

Definition at line 169 of file sprite_editor.cc.

References current_sheets_, yaze::gfx::Arena::Get(), yaze::gui::GetID(), graphics_sheet_canvas_, and yaze::gui::InputHexByte().

Referenced by DrawCustomSprites(), and DrawVanillaSpriteEditor().

Here is the call graph for this function:

◆ DrawCustomSprites()

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

Definition at line 223 of file sprite_editor.cc.

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

Referenced by Update().

Here is the call graph for this function:

◆ DrawCustomSpritesMetadata()

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

Definition at line 249 of file sprite_editor.cc.

References active_sprites_, current_sprite_id_, custom_sprites_, yaze::core::FileDialogWrapper::ShowOpenFileDialog(), and status_.

Referenced by DrawCustomSprites(), and DrawSpriteCanvas().

Here is the call graph for this function:

◆ DrawAnimationFrames()

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

Draws the animation frames manager.

Definition at line 214 of file sprite_editor.cc.

Referenced by DrawSpriteCanvas().

Member Data Documentation

◆ active_sprites_

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

Active sprites.

Definition at line 84 of file sprite_editor.h.

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

◆ current_sprite_id_

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

Current sprite ID.

Definition at line 86 of file sprite_editor.h.

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

◆ current_sheets_

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

Definition at line 87 of file sprite_editor.h.

Referenced by DrawCurrentSheets().

◆ sheets_loaded_

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

Flag indicating whether the sheets are loaded or not.

Definition at line 88 of file sprite_editor.h.

Referenced by DrawVanillaSpriteEditor(), and Update().

◆ oam_config_

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

OAM configuration.

Definition at line 102 of file sprite_editor.h.

Referenced by DrawSpriteCanvas().

◆ oam_bitmap_

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

OAM bitmap.

Definition at line 103 of file sprite_editor.h.

◆ sprite_canvas_

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

Sprite canvas.

Definition at line 105 of file sprite_editor.h.

Referenced by DrawSpriteCanvas().

◆ graphics_sheet_canvas_

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

Graphics sheet canvas.

Definition at line 109 of file sprite_editor.h.

Referenced by DrawCurrentSheets().

◆ custom_sprites_

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

Sprites.

Definition at line 113 of file sprite_editor.h.

Referenced by DrawCustomSpritesMetadata().

◆ status_

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

Status.

Definition at line 115 of file sprite_editor.h.

Referenced by DrawCustomSpritesMetadata(), and Update().

◆ rom_

Rom* yaze::editor::SpriteEditor::rom_
private

Definition at line 117 of file sprite_editor.h.

Referenced by rom(), set_rom(), and SpriteEditor().


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