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

Simple visual palette editor with color picker. More...

#include <palette_editor_widget.h>

Collaboration diagram for yaze::gui::PaletteEditorWidget:

Public Member Functions

 PaletteEditorWidget ()=default
 
void Initialize (Rom *rom)
 
void Draw ()
 
void SetOnPaletteChanged (std::function< void(int palette_id)> callback)
 
int current_palette_id () const
 
void set_current_palette_id (int id)
 

Private Member Functions

void DrawPaletteSelector ()
 
void DrawColorGrid ()
 
void DrawColorPicker ()
 

Private Attributes

Romrom_ = nullptr
 
int current_palette_id_ = 0
 
int selected_color_index_ = -1
 
std::function< void(int palette_id)> on_palette_changed_
 
ImVec4 editing_color_ {0, 0, 0, 1}
 

Detailed Description

Simple visual palette editor with color picker.

Displays dungeon palettes in a grid, allows editing colors, and notifies when palettes change so rooms can re-render.

Definition at line 20 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)

◆ Draw()

void yaze::gui::PaletteEditorWidget::Draw ( )

Definition at line 15 of file palette_editor_widget.cc.

References DrawColorGrid(), DrawColorPicker(), DrawPaletteSelector(), yaze::Rom::is_loaded(), rom_, and selected_color_index_.

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

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 28 of file palette_editor_widget.h.

References on_palette_changed_.

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

◆ current_palette_id()

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

Definition at line 33 of file palette_editor_widget.h.

References current_palette_id_.

◆ set_current_palette_id()

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

Definition at line 34 of file palette_editor_widget.h.

References current_palette_id_.

◆ DrawPaletteSelector()

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

Definition at line 43 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:

◆ DrawColorGrid()

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

Definition at line 66 of file palette_editor_widget.cc.

References current_palette_id_, editing_color_, 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 128 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

◆ current_palette_id_

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

◆ selected_color_index_

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

◆ on_palette_changed_

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

Definition at line 46 of file palette_editor_widget.h.

Referenced by DrawColorPicker(), and SetOnPaletteChanged().

◆ editing_color_

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

Definition at line 49 of file palette_editor_widget.h.

Referenced by DrawColorGrid(), and DrawColorPicker().


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