Refactor includes in graphics editors for consistency; remove unused headers and improve clarity
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
|
#include "absl/strings/str_cat.h"
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
#include "app/gui/canvas.h"
|
#include "app/gui/canvas.h"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "palette_editor.h"
|
#include "palette_editor.h"
|
||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
|
#include "absl/strings/str_cat.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
#include "app/gui/color.h"
|
#include "app/gui/color.h"
|
||||||
#include "app/gui/style.h"
|
#include "app/gui/style.h"
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
#include "screen_editor.h"
|
#include "screen_editor.h"
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "absl/status/statusor.h"
|
|
||||||
#include "absl/strings/str_format.h"
|
#include "absl/strings/str_format.h"
|
||||||
#include "absl/strings/string_view.h"
|
#include "absl/strings/string_view.h"
|
||||||
#include "app/core/constants.h"
|
#include "app/core/constants.h"
|
||||||
@@ -18,7 +15,6 @@
|
|||||||
#include "app/gui/canvas.h"
|
#include "app/gui/canvas.h"
|
||||||
#include "app/gui/icons.h"
|
#include "app/gui/icons.h"
|
||||||
#include "app/gui/input.h"
|
#include "app/gui/input.h"
|
||||||
#include "app/zelda3/dungeon/room.h"
|
|
||||||
#include "imgui/imgui.h"
|
#include "imgui/imgui.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
@@ -384,19 +380,20 @@ void ScreenEditor::DrawDungeonMapsTabs() {
|
|||||||
|
|
||||||
void ScreenEditor::DrawDungeonMapsEditor() {
|
void ScreenEditor::DrawDungeonMapsEditor() {
|
||||||
if (!dungeon_maps_loaded_) {
|
if (!dungeon_maps_loaded_) {
|
||||||
if (LoadDungeonMaps().ok()) {
|
if (!LoadDungeonMaps().ok()) {
|
||||||
if (LoadDungeonMapTile16(rom()->graphics_buffer()).ok()) {
|
|
||||||
sheets_.emplace(0, rom()->gfx_sheets()[212]);
|
|
||||||
sheets_.emplace(1, rom()->gfx_sheets()[213]);
|
|
||||||
sheets_.emplace(2, rom()->gfx_sheets()[214]);
|
|
||||||
sheets_.emplace(3, rom()->gfx_sheets()[215]);
|
|
||||||
dungeon_maps_loaded_ = true;
|
|
||||||
} else {
|
|
||||||
ImGui::Text("Failed to load dungeon map tile16");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ImGui::Text("Failed to load dungeon maps");
|
ImGui::Text("Failed to load dungeon maps");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LoadDungeonMapTile16(rom()->graphics_buffer()).ok()) {
|
||||||
|
// TODO: Load roomset gfx based on dungeon ID
|
||||||
|
sheets_.emplace(0, rom()->gfx_sheets()[212]);
|
||||||
|
sheets_.emplace(1, rom()->gfx_sheets()[213]);
|
||||||
|
sheets_.emplace(2, rom()->gfx_sheets()[214]);
|
||||||
|
sheets_.emplace(3, rom()->gfx_sheets()[215]);
|
||||||
|
dungeon_maps_loaded_ = true;
|
||||||
|
} else {
|
||||||
|
ImGui::Text("Failed to load dungeon map tile16");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<std::string> dungeon_names = {
|
static std::vector<std::string> dungeon_names = {
|
||||||
@@ -461,22 +458,23 @@ void ScreenEditor::DrawDungeonMapsEditor() {
|
|||||||
current_tile_canvas_.DrawGrid(16.f);
|
current_tile_canvas_.DrawGrid(16.f);
|
||||||
current_tile_canvas_.DrawOverlay();
|
current_tile_canvas_.DrawOverlay();
|
||||||
|
|
||||||
static bool modified = false;
|
gui::InputTileInfo("TL", ¤t_tile16_info.tiles[0]);
|
||||||
modified |= gui::InputTileInfo("TL", ¤t_tile16_info.tiles[0]);
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
modified |= gui::InputTileInfo("TR", ¤t_tile16_info.tiles[1]);
|
gui::InputTileInfo("TR", ¤t_tile16_info.tiles[1]);
|
||||||
modified |= gui::InputTileInfo("BL", ¤t_tile16_info.tiles[2]);
|
gui::InputTileInfo("BL", ¤t_tile16_info.tiles[2]);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
modified |= gui::InputTileInfo("BR", ¤t_tile16_info.tiles[3]);
|
gui::InputTileInfo("BR", ¤t_tile16_info.tiles[3]);
|
||||||
|
|
||||||
if (modified) {
|
if (ImGui::Button("Modify Tile16")) {
|
||||||
tile16_sheet_.ModifyTile16(
|
tile16_sheet_.ModifyTile16(
|
||||||
rom()->graphics_buffer(), current_tile16_info.tiles[0],
|
rom()->graphics_buffer(), current_tile16_info.tiles[0],
|
||||||
current_tile16_info.tiles[1], current_tile16_info.tiles[2],
|
current_tile16_info.tiles[1], current_tile16_info.tiles[2],
|
||||||
current_tile16_info.tiles[3], selected_tile16_, 212);
|
current_tile16_info.tiles[3], selected_tile16_, 212);
|
||||||
Renderer::GetInstance().RenderBitmap(
|
tile16_individual_[selected_tile16_] = tile16_sheet_.GetTile16(selected_tile16_);
|
||||||
&tile16_individual_[selected_tile16_]);
|
RETURN_VOID_IF_ERROR(tile16_individual_[selected_tile16_].ApplyPalette(
|
||||||
modified = false;
|
*rom()->mutable_dungeon_palette(3)));
|
||||||
|
Renderer::GetInstance().UpdateBitmap(
|
||||||
|
&tile16_individual_[selected_tile16_], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::EndChild();
|
ImGui::EndChild();
|
||||||
|
|||||||
@@ -4,15 +4,11 @@
|
|||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "app/core/constants.h"
|
|
||||||
#include "app/editor/utils/editor.h"
|
#include "app/editor/utils/editor.h"
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
#include "app/gfx/snes_tile.h"
|
|
||||||
#include "app/gfx/tilesheet.h"
|
#include "app/gfx/tilesheet.h"
|
||||||
#include "app/gui/canvas.h"
|
#include "app/gui/canvas.h"
|
||||||
#include "app/gui/color.h"
|
|
||||||
#include "app/gui/icons.h"
|
|
||||||
#include "app/rom.h"
|
#include "app/rom.h"
|
||||||
#include "app/zelda3/screen/dungeon_map.h"
|
#include "app/zelda3/screen/dungeon_map.h"
|
||||||
#include "app/zelda3/screen/inventory.h"
|
#include "app/zelda3/screen/inventory.h"
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ absl::Status Tile16Editor::InitBlockset(
|
|||||||
tile16_blockset_bmp_ = tile16_blockset_bmp;
|
tile16_blockset_bmp_ = tile16_blockset_bmp;
|
||||||
tile16_individual_ = tile16_individual;
|
tile16_individual_ = tile16_individual;
|
||||||
current_gfx_bmp_ = current_gfx_bmp;
|
current_gfx_bmp_ = current_gfx_bmp;
|
||||||
tile8_gfx_data_ = current_gfx_bmp_.vector();
|
|
||||||
RETURN_IF_ERROR(LoadTile8());
|
RETURN_IF_ERROR(LoadTile8());
|
||||||
ImVector<std::string> tile16_names;
|
ImVector<std::string> tile16_names;
|
||||||
for (int i = 0; i < 0x200; ++i) {
|
for (int i = 0; i < 0x200; ++i) {
|
||||||
|
|||||||
@@ -1,20 +1,14 @@
|
|||||||
#ifndef YAZE_APP_EDITOR_TILE16EDITOR_H
|
#ifndef YAZE_APP_EDITOR_TILE16EDITOR_H
|
||||||
#define YAZE_APP_EDITOR_TILE16EDITOR_H
|
#define YAZE_APP_EDITOR_TILE16EDITOR_H
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
#include "absl/status/status.h"
|
#include "absl/status/status.h"
|
||||||
#include "absl/status/statusor.h"
|
|
||||||
#include "app/core/common.h"
|
#include "app/core/common.h"
|
||||||
#include "app/editor/graphics/palette_editor.h"
|
#include "app/editor/graphics/palette_editor.h"
|
||||||
#include "app/editor/utils/editor.h"
|
|
||||||
#include "app/editor/utils/gfx_context.h"
|
#include "app/editor/utils/gfx_context.h"
|
||||||
#include "app/gfx/bitmap.h"
|
#include "app/gfx/bitmap.h"
|
||||||
#include "app/gfx/snes_palette.h"
|
#include "app/gfx/snes_palette.h"
|
||||||
#include "app/gfx/snes_tile.h"
|
#include "app/gfx/snes_tile.h"
|
||||||
#include "app/gfx/tilesheet.h"
|
|
||||||
#include "app/gui/canvas.h"
|
#include "app/gui/canvas.h"
|
||||||
#include "app/gui/icons.h"
|
|
||||||
#include "app/rom.h"
|
#include "app/rom.h"
|
||||||
#include "app/zelda3/overworld/overworld.h"
|
#include "app/zelda3/overworld/overworld.h"
|
||||||
#include "imgui/imgui.h"
|
#include "imgui/imgui.h"
|
||||||
@@ -92,15 +86,9 @@ class Tile16Editor : public context::GfxContext, public SharedRom {
|
|||||||
gui::Canvas transfer_canvas_;
|
gui::Canvas transfer_canvas_;
|
||||||
gfx::Bitmap transfer_blockset_bmp_;
|
gfx::Bitmap transfer_blockset_bmp_;
|
||||||
|
|
||||||
std::vector<std::vector<uint8_t>> tile16_individual_data_;
|
|
||||||
std::vector<gfx::Bitmap> tile16_individual_;
|
std::vector<gfx::Bitmap> tile16_individual_;
|
||||||
|
|
||||||
std::vector<gfx::Bitmap> current_gfx_individual_;
|
std::vector<gfx::Bitmap> current_gfx_individual_;
|
||||||
|
|
||||||
std::vector<uint8_t> current_tile16_data_;
|
|
||||||
|
|
||||||
std::vector<uint8_t> tile8_gfx_data_;
|
|
||||||
|
|
||||||
PaletteEditor palette_editor_;
|
PaletteEditor palette_editor_;
|
||||||
|
|
||||||
gfx::SnesPalette palette_;
|
gfx::SnesPalette palette_;
|
||||||
@@ -115,4 +103,4 @@ class Tile16Editor : public context::GfxContext, public SharedRom {
|
|||||||
} // namespace editor
|
} // namespace editor
|
||||||
} // namespace app
|
} // namespace app
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
#endif // YAZE_APP_EDITOR_TILE16EDITOR_H
|
#endif // YAZE_APP_EDITOR_TILE16EDITOR_H
|
||||||
|
|||||||
Reference in New Issue
Block a user