Add context menu options for editable palette in Canvas; implement BeginCanvas and EndCanvas functions for improved canvas management.
This commit is contained in:
@@ -167,6 +167,11 @@ void Canvas::DrawContextMenu() {
|
|||||||
}
|
}
|
||||||
EndMenu();
|
EndMenu();
|
||||||
}
|
}
|
||||||
|
if (BeginMenu("View Palette")) {
|
||||||
|
DisplayEditablePalette(*bitmap_->mutable_palette(), "Palette", true, 8);
|
||||||
|
EndMenu();
|
||||||
|
}
|
||||||
|
|
||||||
if (BeginMenu("Bitmap Palette")) {
|
if (BeginMenu("Bitmap Palette")) {
|
||||||
if (rom()->is_loaded()) {
|
if (rom()->is_loaded()) {
|
||||||
gui::TextWithSeparators("ROM Palette");
|
gui::TextWithSeparators("ROM Palette");
|
||||||
@@ -801,6 +806,20 @@ void Canvas::DrawLayeredElements() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BeginCanvas(Canvas &canvas, ImVec2 child_size) {
|
||||||
|
gui::BeginPadding(1);
|
||||||
|
ImGui::BeginChild(canvas.canvas_id().c_str(), child_size, true);
|
||||||
|
canvas.DrawBackground();
|
||||||
|
gui::EndPadding();
|
||||||
|
canvas.DrawContextMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EndCanvas(Canvas &canvas) {
|
||||||
|
canvas.DrawGrid();
|
||||||
|
canvas.DrawOverlay();
|
||||||
|
ImGui::EndChild();
|
||||||
|
}
|
||||||
|
|
||||||
void GraphicsBinCanvasPipeline(int width, int height, int tile_size,
|
void GraphicsBinCanvasPipeline(int width, int height, int tile_size,
|
||||||
int num_sheets_to_load, int canvas_id,
|
int num_sheets_to_load, int canvas_id,
|
||||||
bool is_loaded, gfx::BitmapTable &graphics_bin) {
|
bool is_loaded, gfx::BitmapTable &graphics_bin) {
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ class Canvas : public SharedRom {
|
|||||||
auto width() const { return canvas_sz_.x; }
|
auto width() const { return canvas_sz_.x; }
|
||||||
auto height() const { return canvas_sz_.y; }
|
auto height() const { return canvas_sz_.y; }
|
||||||
auto set_draggable(bool value) { draggable_ = value; }
|
auto set_draggable(bool value) { draggable_ = value; }
|
||||||
|
auto canvas_id() const { return canvas_id_; }
|
||||||
auto labels(int i) {
|
auto labels(int i) {
|
||||||
if (i >= labels_.size()) {
|
if (i >= labels_.size()) {
|
||||||
labels_.push_back(ImVector<std::string>());
|
labels_.push_back(ImVector<std::string>());
|
||||||
@@ -245,6 +245,9 @@ class Canvas : public SharedRom {
|
|||||||
std::vector<ImVec2> selected_tiles_;
|
std::vector<ImVec2> selected_tiles_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void BeginCanvas(Canvas &canvas, ImVec2 child_size = ImVec2(0, 0));
|
||||||
|
void EndCanvas(Canvas &canvas);
|
||||||
|
|
||||||
void GraphicsBinCanvasPipeline(int width, int height, int tile_size,
|
void GraphicsBinCanvasPipeline(int width, int height, int tile_size,
|
||||||
int num_sheets_to_load, int canvas_id,
|
int num_sheets_to_load, int canvas_id,
|
||||||
bool is_loaded, BitmapTable &graphics_bin);
|
bool is_loaded, BitmapTable &graphics_bin);
|
||||||
|
|||||||
Reference in New Issue
Block a user