Popout PaletteEditor, general housekeeping
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "assembly_editor.h"
|
||||
|
||||
#include "core/constants.h"
|
||||
#include "gui/widgets.h"
|
||||
#include "app/gui/widgets.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
@@ -12,8 +12,8 @@ AssemblyEditor::AssemblyEditor() {
|
||||
text_editor_.SetPalette(TextEditor::GetDarkPalette());
|
||||
}
|
||||
|
||||
void AssemblyEditor::Update() {
|
||||
ImGui::Begin("Assembly Editor", &file_is_loaded_);
|
||||
void AssemblyEditor::Update(bool &is_loaded) {
|
||||
ImGui::Begin("Assembly Editor", &is_loaded);
|
||||
MENU_BAR()
|
||||
DrawFileMenu();
|
||||
DrawEditMenu();
|
||||
|
||||
@@ -16,7 +16,7 @@ class AssemblyEditor {
|
||||
public:
|
||||
AssemblyEditor();
|
||||
|
||||
void Update();
|
||||
void Update(bool &is_loaded);
|
||||
void InlineUpdate();
|
||||
void ChangeActiveFile(const std::string &);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "dungeon_editor.h"
|
||||
|
||||
#include "gui/icons.h"
|
||||
#include "app/gui/icons.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
#include <imgui/imgui.h>
|
||||
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/icons.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "rom.h"
|
||||
#include "zelda3/dungeon/room.h"
|
||||
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/rom.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/icons.h"
|
||||
#include "gui/input.h"
|
||||
#include "gui/widgets.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
#include "app/gui/widgets.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
@@ -213,6 +213,7 @@ void MasterEditor::DrawViewMenu() {
|
||||
static bool show_asm_editor = false;
|
||||
static bool show_imgui_demo = false;
|
||||
static bool show_memory_viewer = false;
|
||||
static bool show_palette_editor = false;
|
||||
|
||||
if (show_imgui_metrics) {
|
||||
ImGui::ShowMetricsWindow(&show_imgui_metrics);
|
||||
@@ -228,7 +229,13 @@ void MasterEditor::DrawViewMenu() {
|
||||
}
|
||||
|
||||
if (show_asm_editor) {
|
||||
assembly_editor_.Update();
|
||||
assembly_editor_.Update(show_asm_editor);
|
||||
}
|
||||
|
||||
if (show_palette_editor) {
|
||||
ImGui::Begin("Palette Editor", &show_palette_editor);
|
||||
palette_editor_.Update();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
if (show_imgui_style_editor) {
|
||||
@@ -263,6 +270,7 @@ void MasterEditor::DrawViewMenu() {
|
||||
if (ImGui::BeginMenu("View")) {
|
||||
ImGui::MenuItem("HEX Editor", nullptr, &show_memory_editor);
|
||||
ImGui::MenuItem("ASM Editor", nullptr, &show_asm_editor);
|
||||
ImGui::MenuItem("Palette Editor", nullptr, &show_palette_editor);
|
||||
ImGui::MenuItem("Memory Viewer", nullptr, &show_memory_viewer);
|
||||
ImGui::MenuItem("ImGui Demo", nullptr, &show_imgui_demo);
|
||||
ImGui::Separator();
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/rom.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/icons.h"
|
||||
#include "gui/input.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "app/editor/assembly_editor.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/icons.h"
|
||||
#include "gui/input.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
#include "snes_spc/demo/demo_util.h"
|
||||
#include "snes_spc/demo/wave_writer.h"
|
||||
#include "snes_spc/snes_spc/spc.h"
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "app/editor/assembly_editor.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/tracker.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/icons.h"
|
||||
#include "gui/input.h"
|
||||
#include "app/zelda3/music/tracker.h"
|
||||
#include "snes_spc/demo/demo_util.h"
|
||||
#include "snes_spc/demo/wave_writer.h"
|
||||
#include "snes_spc/snes_spc/spc.h"
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/overworld.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/icons.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
@@ -196,9 +196,8 @@ void OverworldEditor::DrawOverworldCanvas() {
|
||||
if (!blockset_canvas_.Points().empty()) {
|
||||
int x = blockset_canvas_.Points().front().x / 32;
|
||||
int y = blockset_canvas_.Points().front().y / 32;
|
||||
// std::cout << x << " " << y << std::endl;
|
||||
current_tile16_ = x + (y * 8);
|
||||
// std::cout << current_tile16_ << std::endl;
|
||||
current_tile16_ = x + (y * 0x10);
|
||||
|
||||
if (ow_map_canvas_.DrawTilePainter(tile16_individual_[current_tile16_],
|
||||
16)) {
|
||||
// Update the overworld map.
|
||||
@@ -326,12 +325,12 @@ absl::Status OverworldEditor::LoadGraphics() {
|
||||
for (int i = 0; i < 4096; i++) {
|
||||
// Create a new vector for the pixel data of the current tile
|
||||
Bytes tile_data;
|
||||
for (int j = 0; j < 32 * 32; j++) tile_data.push_back(0x00);
|
||||
for (int j = 0; j < 16 * 16; j++) tile_data.push_back(0x00);
|
||||
|
||||
// Copy the pixel data for the current tile into the vector
|
||||
for (int ty = 0; ty < 32; ty++) {
|
||||
for (int tx = 0; tx < 32; tx++) {
|
||||
int position = (tx + (ty * 0x20));
|
||||
for (int ty = 0; ty < 16; ty++) {
|
||||
for (int tx = 0; tx < 16; tx++) {
|
||||
int position = (tx + (ty * 0x10));
|
||||
uchar value = tile16_data[i + tx + (ty * 0x80)];
|
||||
tile_data[position] = value;
|
||||
}
|
||||
@@ -343,8 +342,7 @@ absl::Status OverworldEditor::LoadGraphics() {
|
||||
|
||||
// Render the bitmaps of each tile.
|
||||
for (int id = 0; id < 4096; id++) {
|
||||
gfx::Bitmap new_tile16;
|
||||
tile16_individual_.emplace_back(new_tile16);
|
||||
tile16_individual_.emplace_back();
|
||||
tile16_individual_[id].Create(0x10, 0x10, 0x80,
|
||||
tile16_individual_data_[id]);
|
||||
tile16_individual_[id].ApplyPalette(palette_);
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/overworld.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/icons.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#include "absl/status/status.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/icons.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
|
||||
static inline float ImSaturate(float f) {
|
||||
return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f;
|
||||
@@ -41,17 +41,9 @@ using namespace ImGui;
|
||||
} // namespace
|
||||
|
||||
void PaletteEditor::DrawPaletteGroup(int i) {
|
||||
const int palettesPerRow = 4;
|
||||
ImGui::BeginTable("palette_table", palettesPerRow,
|
||||
ImGuiTableFlags_BordersOuter | ImGuiTableFlags_Resizable);
|
||||
|
||||
auto size = rom_.GetPaletteGroup(kPaletteGroupNames[i].data()).size();
|
||||
auto palettes = rom_.GetPaletteGroup(kPaletteGroupNames[i].data());
|
||||
for (int j = 0; j < size; j++) {
|
||||
if (j % palettesPerRow == 0) {
|
||||
ImGui::TableNextRow();
|
||||
}
|
||||
ImGui::TableSetColumnIndex(j % palettesPerRow);
|
||||
ImGui::Text("%d", j);
|
||||
|
||||
auto palette = palettes[j];
|
||||
@@ -106,8 +98,6 @@ void PaletteEditor::DrawPaletteGroup(int i) {
|
||||
ImGui::PopID();
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
|
||||
absl::Status PaletteEditor::Update() {
|
||||
@@ -159,6 +149,10 @@ void PaletteEditor::DisplayPalette(gfx::SNESPalette& palette, bool loaded) {
|
||||
ImGui::SameLine();
|
||||
ImGui::Text("Previous");
|
||||
|
||||
if (ImGui::Button("Update Map Palette")) {
|
||||
|
||||
}
|
||||
|
||||
ImGui::ColorButton(
|
||||
"##current", color,
|
||||
ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf,
|
||||
@@ -170,6 +164,8 @@ void PaletteEditor::DisplayPalette(gfx::SNESPalette& palette, bool loaded) {
|
||||
ImGuiColorEditFlags_NoPicker | ImGuiColorEditFlags_AlphaPreviewHalf,
|
||||
ImVec2(60, 40)))
|
||||
color = backup_color;
|
||||
|
||||
// List of Colors in Overworld Palette
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Palette");
|
||||
for (int n = 0; n < IM_ARRAYSIZE(saved_palette_); n++) {
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
#include "absl/status/status.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/rom.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/icons.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#include "app/core/constants.h"
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/icons.h"
|
||||
#include "gui/input.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/gui/input.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
@@ -9,11 +9,11 @@
|
||||
#include "app/gfx/bitmap.h"
|
||||
#include "app/gfx/snes_palette.h"
|
||||
#include "app/gfx/snes_tile.h"
|
||||
#include "app/gui/canvas.h"
|
||||
#include "app/gui/color.h"
|
||||
#include "app/gui/icons.h"
|
||||
#include "app/rom.h"
|
||||
#include "app/zelda3/inventory.h"
|
||||
#include "gui/canvas.h"
|
||||
#include "gui/color.h"
|
||||
#include "gui/icons.h"
|
||||
#include "app/zelda3/screen/inventory.h"
|
||||
|
||||
namespace yaze {
|
||||
namespace app {
|
||||
|
||||
Reference in New Issue
Block a user