yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::gui::PaletteEditorWidget Class Reference

#include <palette_editor_widget.h>

Collaboration diagram for yaze::gui::PaletteEditorWidget:

Public Member Functions

 PaletteEditorWidget ()=default
 
void Initialize (Rom *rom)
 
void Draw ()
 
void ShowPaletteEditor (gfx::SnesPalette &palette, const std::string &title="Palette Editor")
 
void ShowROMPaletteManager ()
 
void ShowColorAnalysis (const gfx::Bitmap &bitmap, const std::string &title="Color Analysis")
 
bool ApplyROMPalette (gfx::Bitmap *bitmap, int group_index, int palette_index)
 
const gfx::SnesPaletteGetSelectedROMPalette () const
 
void SavePaletteBackup (const gfx::SnesPalette &palette)
 
bool RestorePaletteBackup (gfx::SnesPalette &palette)
 
void SetOnPaletteChanged (std::function< void(int palette_id)> callback)
 
int GetCurrentPaletteId () const
 
void SetCurrentPaletteId (int id)
 
bool IsROMLoaded () const
 
int GetCurrentGroupIndex () const
 
void DrawROMPaletteSelector ()
 

Private Member Functions

void DrawPaletteGrid (gfx::SnesPalette &palette, int cols=15)
 
void DrawColorEditControls (gfx::SnesColor &color, int color_index)
 
void DrawPaletteAnalysis (const gfx::SnesPalette &palette)
 
void LoadROMPalettes ()
 
void DrawPaletteSelector ()
 
void DrawColorPicker ()
 

Private Attributes

Romrom_ = nullptr
 
std::vector< gfx::SnesPaletterom_palette_groups_
 
std::vector< std::string > palette_group_names_
 
gfx::SnesPalette backup_palette_
 
int current_group_index_ = 0
 
int current_palette_index_ = 0
 
bool rom_palettes_loaded_ = false
 
bool show_color_analysis_ = false
 
bool show_rom_manager_ = false
 
int current_palette_id_ = 0
 
int selected_color_index_ = -1
 
ImVec4 editing_color_ {0, 0, 0, 1}
 
std::function< void(int palette_id)> on_palette_changed_
 
int editing_color_index_ = -1
 
ImVec4 temp_color_ = ImVec4(0, 0, 0, 1)
 

Detailed Description

Definition at line 16 of file palette_editor_widget.h.

Constructor & Destructor Documentation

◆ PaletteEditorWidget()

yaze::gui::PaletteEditorWidget::PaletteEditorWidget ( )
default

Member Function Documentation

◆ Initialize()

void yaze::gui::PaletteEditorWidget::Initialize ( Rom rom)

Definition at line 16 of file palette_editor_widget.cc.

References current_palette_id_, LoadROMPalettes(), rom_, rom_palettes_loaded_, and selected_color_index_.

Referenced by yaze::editor::DungeonEditorV2::Load().

Here is the call graph for this function:

◆ Draw()

◆ ShowPaletteEditor()

void yaze::gui::PaletteEditorWidget::ShowPaletteEditor ( gfx::SnesPalette palette,
const std::string &  title = "Palette Editor" 
)

◆ ShowROMPaletteManager()

void yaze::gui::PaletteEditorWidget::ShowROMPaletteManager ( )

◆ ShowColorAnalysis()

void yaze::gui::PaletteEditorWidget::ShowColorAnalysis ( const gfx::Bitmap bitmap,
const std::string &  title = "Color Analysis" 
)

◆ ApplyROMPalette()

◆ GetSelectedROMPalette()

const gfx::SnesPalette * yaze::gui::PaletteEditorWidget::GetSelectedROMPalette ( ) const

◆ SavePaletteBackup()

void yaze::gui::PaletteEditorWidget::SavePaletteBackup ( const gfx::SnesPalette palette)

Definition at line 283 of file palette_editor_widget.cc.

References backup_palette_.

Referenced by ApplyROMPalette(), and ShowPaletteEditor().

◆ RestorePaletteBackup()

bool yaze::gui::PaletteEditorWidget::RestorePaletteBackup ( gfx::SnesPalette palette)

Definition at line 287 of file palette_editor_widget.cc.

References backup_palette_, and yaze::gfx::SnesPalette::size().

Referenced by ShowPaletteEditor().

Here is the call graph for this function:

◆ SetOnPaletteChanged()

void yaze::gui::PaletteEditorWidget::SetOnPaletteChanged ( std::function< void(int palette_id)>  callback)
inline

Definition at line 38 of file palette_editor_widget.h.

References on_palette_changed_.

Referenced by yaze::editor::DungeonEditorV2::Load().

◆ GetCurrentPaletteId()

int yaze::gui::PaletteEditorWidget::GetCurrentPaletteId ( ) const
inline

Definition at line 43 of file palette_editor_widget.h.

References current_palette_id_.

◆ SetCurrentPaletteId()

void yaze::gui::PaletteEditorWidget::SetCurrentPaletteId ( int  id)
inline

Definition at line 44 of file palette_editor_widget.h.

References current_palette_id_.

◆ IsROMLoaded()

bool yaze::gui::PaletteEditorWidget::IsROMLoaded ( ) const
inline

Definition at line 46 of file palette_editor_widget.h.

References rom_.

◆ GetCurrentGroupIndex()

int yaze::gui::PaletteEditorWidget::GetCurrentGroupIndex ( ) const
inline

Definition at line 47 of file palette_editor_widget.h.

References current_group_index_.

◆ DrawROMPaletteSelector()

void yaze::gui::PaletteEditorWidget::DrawROMPaletteSelector ( )

◆ DrawPaletteGrid()

void yaze::gui::PaletteEditorWidget::DrawPaletteGrid ( gfx::SnesPalette palette,
int  cols = 15 
)
private

Definition at line 296 of file palette_editor_widget.cc.

References editing_color_, editing_color_index_, selected_color_index_, yaze::gfx::SnesPalette::size(), and temp_color_.

Referenced by Draw(), ShowPaletteEditor(), and ShowROMPaletteManager().

Here is the call graph for this function:

◆ DrawColorEditControls()

void yaze::gui::PaletteEditorWidget::DrawColorEditControls ( gfx::SnesColor color,
int  color_index 
)
private

Definition at line 403 of file palette_editor_widget.cc.

References yaze::gfx::SnesColor::rgb(), and yaze::gfx::SnesColor::snes().

Here is the call graph for this function:

◆ DrawPaletteAnalysis()

void yaze::gui::PaletteEditorWidget::DrawPaletteAnalysis ( const gfx::SnesPalette palette)
private

Definition at line 437 of file palette_editor_widget.cc.

References yaze::gfx::SnesColor::rgb(), and yaze::gfx::SnesPalette::size().

Referenced by ShowPaletteEditor(), and ShowROMPaletteManager().

Here is the call graph for this function:

◆ LoadROMPalettes()

void yaze::gui::PaletteEditorWidget::LoadROMPalettes ( )
private

Definition at line 489 of file palette_editor_widget.cc.

References LOG_ERROR, yaze::Rom::palette_group(), palette_group_names_, rom_, rom_palette_groups_, and rom_palettes_loaded_.

Referenced by DrawROMPaletteSelector(), Initialize(), and ShowROMPaletteManager().

Here is the call graph for this function:

◆ DrawPaletteSelector()

void yaze::gui::PaletteEditorWidget::DrawPaletteSelector ( )
private

Definition at line 57 of file palette_editor_widget.cc.

References current_palette_id_, yaze::Rom::mutable_palette_group(), rom_, and selected_color_index_.

Referenced by Draw().

Here is the call graph for this function:

◆ DrawColorPicker()

void yaze::gui::PaletteEditorWidget::DrawColorPicker ( )
private

Definition at line 82 of file palette_editor_widget.cc.

References current_palette_id_, editing_color_, yaze::Rom::mutable_palette_group(), on_palette_changed_, rom_, and selected_color_index_.

Referenced by Draw().

Here is the call graph for this function:

Member Data Documentation

◆ rom_

Rom* yaze::gui::PaletteEditorWidget::rom_ = nullptr
private

◆ rom_palette_groups_

std::vector<gfx::SnesPalette> yaze::gui::PaletteEditorWidget::rom_palette_groups_
private

◆ palette_group_names_

std::vector<std::string> yaze::gui::PaletteEditorWidget::palette_group_names_
private

◆ backup_palette_

gfx::SnesPalette yaze::gui::PaletteEditorWidget::backup_palette_
private

Definition at line 63 of file palette_editor_widget.h.

Referenced by RestorePaletteBackup(), and SavePaletteBackup().

◆ current_group_index_

int yaze::gui::PaletteEditorWidget::current_group_index_ = 0
private

◆ current_palette_index_

int yaze::gui::PaletteEditorWidget::current_palette_index_ = 0
private

Definition at line 66 of file palette_editor_widget.h.

Referenced by ApplyROMPalette(), and DrawROMPaletteSelector().

◆ rom_palettes_loaded_

bool yaze::gui::PaletteEditorWidget::rom_palettes_loaded_ = false
private

◆ show_color_analysis_

bool yaze::gui::PaletteEditorWidget::show_color_analysis_ = false
private

Definition at line 68 of file palette_editor_widget.h.

Referenced by ShowColorAnalysis().

◆ show_rom_manager_

bool yaze::gui::PaletteEditorWidget::show_rom_manager_ = false
private

Definition at line 69 of file palette_editor_widget.h.

Referenced by ShowROMPaletteManager().

◆ current_palette_id_

int yaze::gui::PaletteEditorWidget::current_palette_id_ = 0
private

◆ selected_color_index_

int yaze::gui::PaletteEditorWidget::selected_color_index_ = -1
private

◆ editing_color_

ImVec4 yaze::gui::PaletteEditorWidget::editing_color_ {0, 0, 0, 1}
private

Definition at line 74 of file palette_editor_widget.h.

Referenced by DrawColorPicker(), and DrawPaletteGrid().

◆ on_palette_changed_

std::function<void(int palette_id)> yaze::gui::PaletteEditorWidget::on_palette_changed_
private

Definition at line 77 of file palette_editor_widget.h.

Referenced by DrawColorPicker(), and SetOnPaletteChanged().

◆ editing_color_index_

int yaze::gui::PaletteEditorWidget::editing_color_index_ = -1
private

Definition at line 80 of file palette_editor_widget.h.

Referenced by DrawPaletteGrid().

◆ temp_color_

ImVec4 yaze::gui::PaletteEditorWidget::temp_color_ = ImVec4(0, 0, 0, 1)
private

Definition at line 81 of file palette_editor_widget.h.

Referenced by DrawPaletteGrid().


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