GraphicsEditor housekeeping

This commit is contained in:
scawful
2023-11-18 00:02:35 -05:00
parent b5ce6b96d7
commit 4494472467
2 changed files with 23 additions and 22 deletions

View File

@@ -19,12 +19,15 @@
#include "app/gui/style.h"
#include "app/rom.h"
//
namespace yaze {
namespace app {
namespace editor {
using ImGui::Button;
using ImGui::InputInt;
using ImGui::InputText;
using ImGui::SameLine;
absl::Status GraphicsEditor::Update() {
TAB_BAR("##TabBar")
status_ = UpdateScadView();
@@ -123,7 +126,7 @@ absl::Status GraphicsEditor::DrawToolset() {
ImGui::TableSetupColumn(name.data());
ImGui::TableNextColumn();
if (ImGui::Button(ICON_MD_MEMORY)) {
if (Button(ICON_MD_MEMORY)) {
if (!open_memory_editor_) {
open_memory_editor_ = true;
} else {
@@ -140,10 +143,10 @@ absl::Status GraphicsEditor::DrawToolset() {
absl::Status GraphicsEditor::DrawCgxImport() {
gui::TextWithSeparators("Cgx Import");
ImGui::InputInt("BPP", &current_bpp_);
InputInt("BPP", &current_bpp_);
ImGui::InputText("##CGXFile", cgx_file_name_, sizeof(cgx_file_name_));
ImGui::SameLine();
InputText("##CGXFile", cgx_file_name_, sizeof(cgx_file_name_));
SameLine();
core::FileDialogPipeline("ImportCgxKey", ".CGX,.cgx\0", "Open CGX", [this]() {
strncpy(cgx_file_path_,
@@ -172,7 +175,7 @@ absl::Status GraphicsEditor::DrawCgxImport() {
}
absl::Status GraphicsEditor::DrawScrImport() {
ImGui::InputText("##ScrFile", scr_file_name_, sizeof(scr_file_name_));
InputText("##ScrFile", scr_file_name_, sizeof(scr_file_name_));
core::FileDialogPipeline(
"ImportScrKey", ".SCR,.scr,.BAK\0", "Open SCR", [this]() {
@@ -186,7 +189,7 @@ absl::Status GraphicsEditor::DrawScrImport() {
scr_loaded_ = true;
});
ImGui::InputInt("SCR Mod", &scr_mod_value_);
InputInt("SCR Mod", &scr_mod_value_);
core::ButtonPipe("Load Scr Data", [this]() {
status_ = gfx::LoadScr(scr_file_path_, scr_mod_value_, scr_data_);
@@ -207,8 +210,8 @@ absl::Status GraphicsEditor::DrawScrImport() {
absl::Status GraphicsEditor::DrawPaletteControls() {
gui::TextWithSeparators("COL Import");
ImGui::InputText("##ColFile", col_file_name_, sizeof(col_file_name_));
ImGui::SameLine();
InputText("##ColFile", col_file_name_, sizeof(col_file_name_));
SameLine();
core::FileDialogPipeline(
"ImportColKey", ".COL,.col,.BAK,.bak\0", "Open COL", [this]() {
@@ -254,8 +257,8 @@ absl::Status GraphicsEditor::DrawPaletteControls() {
absl::Status GraphicsEditor::DrawObjImport() {
gui::TextWithSeparators("OBJ Import");
ImGui::InputText("##ObjFile", obj_file_path_, sizeof(obj_file_path_));
ImGui::SameLine();
InputText("##ObjFile", obj_file_path_, sizeof(obj_file_path_));
SameLine();
core::FileDialogPipeline(
"ImportObjKey", ".obj,.OBJ,.bak,.BAK\0", "Open OBJ", [this]() {
@@ -272,9 +275,8 @@ absl::Status GraphicsEditor::DrawObjImport() {
absl::Status GraphicsEditor::DrawTilemapImport() {
gui::TextWithSeparators("Tilemap Import");
ImGui::InputText("##TMapFile", tilemap_file_path_,
sizeof(tilemap_file_path_));
ImGui::SameLine();
InputText("##TMapFile", tilemap_file_path_, sizeof(tilemap_file_path_));
SameLine();
core::FileDialogPipeline(
"ImportTilemapKey", ".DAT,.dat,.BIN,.bin,.hex,.HEX\0", "Open Tilemap",
@@ -297,8 +299,8 @@ absl::Status GraphicsEditor::DrawTilemapImport() {
absl::Status GraphicsEditor::DrawFileImport() {
gui::TextWithSeparators("BIN Import");
ImGui::InputText("##ROMFile", file_path_, sizeof(file_path_));
ImGui::SameLine();
InputText("##ROMFile", file_path_, sizeof(file_path_));
SameLine();
core::FileDialogPipeline("ImportDlgKey", ".bin,.hex\0", "Open BIN", [this]() {
strncpy(file_path_, ImGuiFileDialog::Instance()->GetFilePathName().c_str(),
@@ -313,7 +315,7 @@ absl::Status GraphicsEditor::DrawFileImport() {
gui::InputHex("BIN Offset", &current_offset_);
gui::InputHex("BIN Size", &bin_size_);
if (ImGui::Button("Decompress BIN")) {
if (Button("Decompress BIN")) {
if (strlen(file_path_) > 0) {
RETURN_IF_ERROR(DecompressImportData(bin_size_))
} else {
@@ -356,7 +358,7 @@ absl::Status GraphicsEditor::DrawClipboardImport() {
absl::Status GraphicsEditor::DrawExperimentalFeatures() {
gui::TextWithSeparators("Experimental");
if (ImGui::Button("Decompress Super Donkey Full")) {
if (Button("Decompress Super Donkey Full")) {
if (strlen(file_path_) > 0) {
RETURN_IF_ERROR(DecompressSuperDonkey())
} else {

View File

@@ -20,9 +20,8 @@
namespace yaze {
namespace app {
namespace editor {
// "99973","A3D80",
//
// "99973","A3D80",
const std::string kSuperDonkeyTiles[] = {
"97C05", "98219", "9871E", "98C00", "99084", "995AF", "99DE0", "9A27E",
@@ -44,7 +43,7 @@ const std::string kSuperDonkeySprites[] = {
"BE115", "BE5C2", "BEB63", "BF0CB", "BF607", "BFA55", "BFD71", "C017D",
"C0567", "C0981", "C0BA7", "C116D", "C166A", "C1FE0", "C24CE", "C2B19"};
constexpr char* kPaletteGroupAddressesKeys[] = {
constexpr const char* kPaletteGroupAddressesKeys[] = {
"ow_main", "ow_aux", "ow_animated", "hud",
"global_sprites", "armors", "swords", "shields",
"sprites_aux1", "sprites_aux2", "sprites_aux3", "dungeon_main",