Allows the user to view and edit in game palettes. More...
#include <palette_editor.h>
Public Member Functions | |
PaletteEditor (Rom *rom=nullptr) | |
void | Initialize () override |
absl::Status | Load () override |
absl::Status | Update () override |
absl::Status | Cut () override |
absl::Status | Copy () override |
absl::Status | Paste () override |
absl::Status | Undo () override |
absl::Status | Redo () override |
absl::Status | Find () override |
absl::Status | Save () override |
void | DrawQuickAccessTab () |
void | DrawCustomPalette () |
Draw custom palette editor with enhanced ROM hacking features. | |
absl::Status | DrawPaletteGroup (int category, bool right_side=false) |
absl::Status | EditColorInPalette (gfx::SnesPalette &palette, int index) |
absl::Status | ResetColorToOriginal (gfx::SnesPalette &palette, int index, const gfx::SnesPalette &originalPalette) |
void | AddRecentlyUsedColor (const gfx::SnesColor &color) |
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 | |
absl::Status | HandleColorPopup (gfx::SnesPalette &palette, int i, int j, int n) |
Private Attributes | |
absl::Status | status_ |
gfx::SnesColor | current_color_ |
GfxGroupEditor | gfx_group_editor_ |
std::vector< gfx::SnesColor > | custom_palette_ |
std::vector< gfx::SnesColor > | recently_used_colors_ |
int | edit_palette_index_ = -1 |
ImVec4 | saved_palette_ [256] = {} |
palette_internal::PaletteEditorHistory | history_ |
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 view and edit in game palettes.
Definition at line 81 of file palette_editor.h.
|
inlineexplicit |
Definition at line 83 of file palette_editor.h.
References custom_palette_, yaze::editor::kPalette, and yaze::editor::Editor::type_.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 189 of file palette_editor.cc.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 192 of file palette_editor.cc.
References yaze::core::ResourceLabelManager::CreateOrGetLabel(), yaze::editor::kNumPalettes, yaze::Rom::resource_label(), and rom().
Referenced by yaze::editor::EditorManager::LoadAssets().
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 208 of file palette_editor.cc.
References DrawPaletteGroup(), DrawQuickAccessTab(), yaze::editor::kNumPalettes, yaze::editor::kPaletteTableFlags, rom(), and status_.
Referenced by yaze::editor::EditorManager::DrawMenuBar().
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 91 of file palette_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 92 of file palette_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 93 of file palette_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 94 of file palette_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 95 of file palette_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 96 of file palette_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 97 of file palette_editor.h.
void yaze::editor::PaletteEditor::DrawQuickAccessTab | ( | ) |
Definition at line 254 of file palette_editor.cc.
References yaze::gui::ConvertSnesColorToImVec4(), current_color_, DrawCustomPalette(), F32_TO_INT8_SAT, yaze::editor::kColorPopupFlags, recently_used_colors_, yaze::gfx::SnesColor::rgb(), yaze::gfx::SnesColor::snes(), and yaze::gui::SnesColorEdit4().
Referenced by Update().
void yaze::editor::PaletteEditor::DrawCustomPalette | ( | ) |
Draw custom palette editor with enhanced ROM hacking features.
Enhanced Features:
Performance Notes:
Definition at line 320 of file palette_editor.cc.
References AddRecentlyUsedColor(), yaze::gui::ConvertSnesColorToImVec4(), current_color_, custom_palette_, edit_palette_index_, yaze::editor::kColorPopupFlags, and yaze::gui::SnesColorEdit4().
Referenced by DrawQuickAccessTab().
absl::Status yaze::editor::PaletteEditor::DrawPaletteGroup | ( | int | category, |
bool | right_side = false |
||
) |
Definition at line 405 of file palette_editor.cc.
References AddRecentlyUsedColor(), yaze::gui::ConvertSnesColorToImVec4(), current_color_, HandleColorPopup(), yaze::gfx::PaletteGroup::mutable_palette(), yaze::Rom::mutable_palette_group(), yaze::Rom::resource_label(), RETURN_IF_ERROR, rom(), yaze::core::ResourceLabelManager::SelectableLabelWithNameEdit(), yaze::gfx::SnesPalette::size(), and yaze::gfx::PaletteGroup::size().
Referenced by Update().
absl::Status yaze::editor::PaletteEditor::EditColorInPalette | ( | gfx::SnesPalette & | palette, |
int | index | ||
) |
Definition at line 531 of file palette_editor.cc.
References AddRecentlyUsedColor(), yaze::gui::ConvertImVec4ToSnesColor(), and yaze::gfx::SnesPalette::size().
absl::Status yaze::editor::PaletteEditor::ResetColorToOriginal | ( | gfx::SnesPalette & | palette, |
int | index, | ||
const gfx::SnesPalette & | originalPalette | ||
) |
Definition at line 550 of file palette_editor.cc.
References yaze::gui::ConvertImVec4ToSnesColor(), and yaze::gfx::SnesPalette::size().
void yaze::editor::PaletteEditor::AddRecentlyUsedColor | ( | const gfx::SnesColor & | color | ) |
Definition at line 456 of file palette_editor.cc.
References recently_used_colors_.
Referenced by DrawCustomPalette(), DrawPaletteGroup(), EditColorInPalette(), and HandleColorPopup().
|
inline |
|
inline |
Definition at line 110 of file palette_editor.h.
References rom_.
Referenced by DrawPaletteGroup(), Load(), set_rom(), and Update().
|
private |
Definition at line 476 of file palette_editor.cc.
References AddRecentlyUsedColor(), yaze::gfx::ConvertRgbToSnes(), custom_palette_, F32_TO_INT8_SAT, history_, yaze::editor::kColorPopupFlags, yaze::editor::palette_internal::PaletteEditorHistory::RecordChange(), yaze::gui::SnesColorEdit4(), and yaze::gfx::ToFloatArray().
Referenced by DrawPaletteGroup().
|
private |
Definition at line 115 of file palette_editor.h.
Referenced by Update().
|
private |
Definition at line 116 of file palette_editor.h.
Referenced by DrawCustomPalette(), DrawPaletteGroup(), and DrawQuickAccessTab().
|
private |
Definition at line 118 of file palette_editor.h.
|
private |
Definition at line 120 of file palette_editor.h.
Referenced by DrawCustomPalette(), HandleColorPopup(), and PaletteEditor().
|
private |
Definition at line 121 of file palette_editor.h.
Referenced by AddRecentlyUsedColor(), and DrawQuickAccessTab().
|
private |
Definition at line 123 of file palette_editor.h.
Referenced by DrawCustomPalette().
|
private |
Definition at line 125 of file palette_editor.h.
|
private |
Definition at line 127 of file palette_editor.h.
Referenced by HandleColorPopup().
|
private |
Definition at line 129 of file palette_editor.h.