The ScreenEditor class allows the user to edit a variety of screens in the game or create a custom menu. More...
#include <screen_editor.h>
Public Member Functions | |
ScreenEditor (Rom *rom=nullptr) | |
void | Initialize () override |
absl::Status | Load () override |
absl::Status | Update () override |
absl::Status | Undo () override |
absl::Status | Redo () override |
absl::Status | Cut () override |
absl::Status | Copy () override |
absl::Status | Paste () override |
absl::Status | Find () override |
absl::Status | Save () override |
void | set_rom (Rom *rom) |
Rom * | rom () const |
![]() | |
Editor ()=default | |
virtual | ~Editor ()=default |
virtual absl::Status | Clear () |
EditorType | type () const |
void | set_context (EditorContext *context) |
bool * | active () |
void | set_active (bool active) |
virtual bool | IsRomLoaded () const |
virtual std::string | GetRomStatus () const |
Public Attributes | |
std::vector< zelda3::DungeonMap > | dungeon_maps_ |
Private Types | |
enum class | EditingMode { DRAW , EDIT } |
Private Member Functions | |
void | DrawTitleScreenEditor () |
void | DrawNamingScreenEditor () |
void | DrawOverworldMapEditor () |
void | DrawInventoryMenuEditor () |
void | DrawToolset () |
void | DrawDungeonMapToolset () |
void | DrawInventoryToolset () |
absl::Status | LoadDungeonMapTile16 (const std::vector< uint8_t > &gfx_data, bool bin_mode=false) |
absl::Status | SaveDungeonMapTile16 () |
void | DrawDungeonMapScreen (int i) |
void | DrawDungeonMapsTabs () |
void | DrawDungeonMapsEditor () |
Draw dungeon maps editor with enhanced ROM hacking features. | |
void | DrawDungeonMapsRoomGfx () |
Draw dungeon room graphics editor with enhanced tile16 editing. | |
void | LoadBinaryGfx () |
Private Attributes | |
EditingMode | current_mode_ = EditingMode::DRAW |
bool | show_dungeon_maps_ = false |
bool | show_inventory_menu_ = false |
bool | show_overworld_map_ = false |
bool | show_title_screen_ = false |
bool | show_naming_screen_ = false |
bool | binary_gfx_loaded_ = false |
uint8_t | selected_room = 0 |
int | selected_tile16_ = 0 |
int | selected_tile8_ = 0 |
int | selected_dungeon = 0 |
int | floor_number = 1 |
bool | copy_button_pressed = false |
bool | paste_button_pressed = false |
std::vector< gfx::Bitmap > | tile8_individual_ |
zelda3::DungeonMapLabels | dungeon_map_labels_ |
gfx::SnesPalette | palette_ |
gfx::BitmapTable | sheets_ |
gfx::Tilemap | tile16_blockset_ |
std::array< gfx::TileInfo, 4 > | current_tile16_info |
gui::Canvas | current_tile_canvas_ |
gui::Canvas | screen_canvas_ |
gui::Canvas | tilesheet_canvas_ |
gui::Canvas | tilemap_canvas_ |
zelda3::Inventory | inventory_ |
Rom * | rom_ |
absl::Status | status_ |
Additional Inherited Members | |
![]() | |
std::string | MakeCardTitle (const std::string &base_title) const |
template<typename T > | |
absl::StatusOr< T > | SafeRomAccess (std::function< T()> accessor, const std::string &operation="") const |
![]() | |
bool | active_ = false |
EditorType | type_ |
EditorContext * | context_ = nullptr |
The ScreenEditor class allows the user to edit a variety of screens in the game or create a custom menu.
This class is currently a work in progress (WIP) and provides functionality for updating the screens, saving dungeon maps, drawing different types of screens, loading dungeon maps, and managing various properties related to the editor.
The screens that can be edited include the title screen, naming screen, overworld map, inventory menu, and more.
Definition at line 34 of file screen_editor.h.
|
strongprivate |
Enumerator | |
---|---|
DRAW | |
EDIT |
Definition at line 77 of file screen_editor.h.
|
inlineexplicit |
Definition at line 36 of file screen_editor.h.
References yaze::editor::kScreen, screen_canvas_, yaze::gui::Canvas::SetCanvasSize(), and yaze::editor::Editor::type_.
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 32 of file screen_editor.cc.
References yaze::gui::EditorCardManager::Get(), ICON_MD_EDIT, ICON_MD_INVENTORY, ICON_MD_MAP, ICON_MD_PUBLIC, ICON_MD_TITLE, show_dungeon_maps_, show_inventory_menu_, show_naming_screen_, show_overworld_map_, and show_title_screen_.
|
overridevirtual |
int current_tile8 = 0; int tile_data_offset = 0; for (int i = 0; i < 4; ++i) { for (int j = 0; j < 32; j++) { std::vector<uint8_t> tile_data(64, 0); // 8x8 tile (64 bytes int tile_index = current_tile8 + j; int x = (j % 8) * 8; int y = (j / 8) * 8; sheets_[i].Get8x8Tile(tile_index, x, y, tile_data, tile_data_offset); tile8_individual_.emplace_back(gfx::Bitmap(8, 8, 4, tile_data)); tile8_individual_.back().SetPalette(*rom()->mutable_dungeon_palette(3)); Queue texture creation via Arena's deferred system gfx::Arena::Get().QueueTextureCommand( gfx::Arena::TextureCommandType::CREATE, &tile8_individual_.back()); } tile_data_offset = 0; }
Implements yaze::editor::Editor.
Definition at line 87 of file screen_editor.cc.
References ASSIGN_OR_RETURN, dungeon_map_labels_, dungeon_maps_, yaze::gfx::Arena::Get(), yaze::zelda3::LoadDungeonMaps(), yaze::zelda3::LoadDungeonMapTile16(), RETURN_IF_ERROR, rom(), sheets_, and tile16_blockset_.
Referenced by yaze::editor::EditorManager::LoadAssets().
|
overridevirtual |
Implements yaze::editor::Editor.
Definition at line 121 of file screen_editor.cc.
References yaze::gui::EditorCard::Begin(), DrawDungeonMapsEditor(), DrawInventoryMenuEditor(), DrawNamingScreenEditor(), DrawOverworldMapEditor(), DrawTitleScreenEditor(), DrawToolset(), yaze::gui::EditorCard::End(), ICON_MD_EDIT_ATTRIBUTES, ICON_MD_INVENTORY, ICON_MD_MAP, ICON_MD_PUBLIC, ICON_MD_TITLE, yaze::editor::Editor::MakeCardTitle(), show_dungeon_maps_, show_inventory_menu_, show_naming_screen_, show_overworld_map_, show_title_screen_, status_, and yaze::gui::VerticalSpacing().
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 44 of file screen_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 45 of file screen_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 46 of file screen_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 47 of file screen_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 48 of file screen_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 49 of file screen_editor.h.
|
inlineoverridevirtual |
Implements yaze::editor::Editor.
Definition at line 50 of file screen_editor.h.
|
inline |
|
inline |
Definition at line 52 of file screen_editor.h.
References rom_.
Referenced by DrawDungeonMapsEditor(), DrawDungeonMapsRoomGfx(), DrawInventoryMenuEditor(), Load(), LoadBinaryGfx(), and set_rom().
|
private |
Definition at line 617 of file screen_editor.cc.
Referenced by Update().
|
private |
Definition at line 620 of file screen_editor.cc.
Referenced by Update().
|
private |
Definition at line 623 of file screen_editor.cc.
Referenced by Update().
|
private |
Definition at line 189 of file screen_editor.cc.
References yaze::zelda3::Inventory::bitmap(), yaze::zelda3::Inventory::Create(), yaze::gui::DisplayPalette(), yaze::gui::Canvas::DrawBackground(), yaze::gui::Canvas::DrawBitmap(), yaze::gui::Canvas::DrawContextMenu(), yaze::gui::Canvas::DrawGrid(), DrawInventoryToolset(), yaze::gui::Canvas::DrawOverlay(), inventory_, yaze::zelda3::Inventory::palette(), palette_, rom(), screen_canvas_, status_, yaze::zelda3::Inventory::tilesheet(), and tilesheet_canvas_.
Referenced by Update().
|
private |
Definition at line 166 of file screen_editor.cc.
References yaze::gui::Toolset::AddAction(), yaze::gui::Toolset::Begin(), yaze::gui::Toolset::End(), ICON_MD_EDIT_ATTRIBUTES, ICON_MD_INVENTORY, ICON_MD_MAP, ICON_MD_PUBLIC, ICON_MD_TITLE, show_dungeon_maps_, show_inventory_menu_, show_naming_screen_, show_overworld_map_, and show_title_screen_.
Referenced by Update().
|
private |
Definition at line 626 of file screen_editor.cc.
|
private |
Definition at line 227 of file screen_editor.cc.
References current_mode_, DRAW, ICON_MD_BUILD, ICON_MD_DRAW, ICON_MD_MORE_VERT, ICON_MD_REDO, ICON_MD_UNDO, ICON_MD_ZOOM_IN, ICON_MD_ZOOM_OUT, screen_canvas_, yaze::gui::Canvas::ZoomIn(), and yaze::gui::Canvas::ZoomOut().
Referenced by DrawInventoryMenuEditor().
|
private |
|
private |
|
private |
Definition at line 272 of file screen_editor.cc.
References yaze::gfx::Arena::CREATE, yaze::gui::Canvas::DrawBackground(), yaze::gui::Canvas::DrawBitmap(), yaze::gui::Canvas::DrawGrid(), yaze::gui::Canvas::DrawOutlineWithColor(), yaze::gui::Canvas::DrawOverlay(), yaze::gui::Canvas::DrawText(), yaze::gui::Canvas::DrawTileSelector(), dungeon_map_labels_, dungeon_maps_, floor_number, yaze::gfx::Arena::Get(), yaze::gfx::TileCache::GetTile(), yaze::util::HexByte(), yaze::zelda3::kNumRooms, yaze::editor::kRedPen, yaze::gui::Canvas::points(), yaze::gfx::Arena::QueueTextureCommand(), yaze::gfx::RenderTile16(), screen_canvas_, selected_dungeon, selected_room, tile16_blockset_, and yaze::gfx::Tilemap::tile_cache.
Referenced by DrawDungeonMapsTabs().
|
private |
Definition at line 350 of file screen_editor.cc.
References copy_button_pressed, DrawDungeonMapScreen(), dungeon_map_labels_, dungeon_maps_, floor_number, yaze::gui::InputHexByte(), yaze::gui::InputHexWord(), paste_button_pressed, selected_dungeon, and selected_room.
Referenced by DrawDungeonMapsEditor().
|
private |
Draw dungeon maps editor with enhanced ROM hacking features.
Enhanced Features:
Performance Notes:
Definition at line 517 of file screen_editor.cc.
References current_mode_, DRAW, yaze::gui::Canvas::DrawBackground(), yaze::gui::Canvas::DrawBitmapTable(), yaze::gui::Canvas::DrawContextMenu(), DrawDungeonMapsRoomGfx(), DrawDungeonMapsTabs(), yaze::gui::Canvas::DrawGrid(), yaze::gui::Canvas::DrawOverlay(), yaze::gui::Canvas::DrawTileSelector(), EDIT, yaze::gui::Canvas::GetTileIdFromMousePos(), ICON_MD_DRAW, ICON_MD_EDIT, ICON_MD_SAVE, LoadBinaryGfx(), PRINT_IF_ERROR, yaze::Rom::resource_label(), rom(), yaze::zelda3::SaveDungeonMapTile16(), yaze::core::ResourceLabelManager::SelectableLabelWithNameEdit(), selected_dungeon, selected_tile8_, sheets_, tile16_blockset_, and tilemap_canvas_.
Referenced by Update().
|
private |
Draw dungeon room graphics editor with enhanced tile16 editing.
Enhanced Features:
Performance Notes:
Definition at line 427 of file screen_editor.cc.
References yaze::gfx::Tilemap::atlas, yaze::gfx::Arena::CREATE, current_tile16_info, current_tile_canvas_, yaze::gui::Canvas::DrawBackground(), yaze::gui::Canvas::DrawBitmap(), yaze::gui::Canvas::DrawContextMenu(), yaze::gui::Canvas::DrawGrid(), yaze::gui::Canvas::DrawOverlay(), yaze::gui::Canvas::DrawTilePainter(), yaze::gui::Canvas::DrawTileSelector(), dungeon_maps_, floor_number, yaze::gfx::Arena::Get(), yaze::gfx::TileCache::GetTile(), yaze::gui::InputTileInfo(), yaze::gfx::ModifyTile16(), yaze::gui::Canvas::mutable_points(), yaze::gui::Canvas::points(), yaze::gfx::Arena::QueueTextureCommand(), yaze::gfx::RenderTile16(), rom(), screen_canvas_, selected_dungeon, selected_room, selected_tile16_, selected_tile8_, tile16_blockset_, tile8_individual_, yaze::gfx::Tilemap::tile_cache, yaze::gfx::Tilemap::tile_info, tilesheet_canvas_, and yaze::gfx::UpdateTile16().
Referenced by DrawDungeonMapsEditor().
|
private |
Definition at line 585 of file screen_editor.cc.
References binary_gfx_loaded_, yaze::gfx::Arena::CREATE, yaze::gfx::Arena::Get(), yaze::zelda3::LoadDungeonMapTile16(), yaze::Rom::mutable_dungeon_palette(), yaze::gfx::Arena::QueueTextureCommand(), rom(), sheets_, yaze::util::FileDialogWrapper::ShowOpenFileDialog(), yaze::gfx::SnesTo8bppSheet(), status_, and tile16_blockset_.
Referenced by DrawDungeonMapsEditor().
std::vector<zelda3::DungeonMap> yaze::editor::ScreenEditor::dungeon_maps_ |
Definition at line 54 of file screen_editor.h.
Referenced by DrawDungeonMapScreen(), DrawDungeonMapsRoomGfx(), DrawDungeonMapsTabs(), Load(), yaze::editor::EditorManager::SaveRom(), and yaze::editor::EditorManager::SaveRomAs().
|
private |
Definition at line 79 of file screen_editor.h.
Referenced by DrawDungeonMapsEditor(), and DrawInventoryToolset().
|
private |
Definition at line 83 of file screen_editor.h.
Referenced by DrawToolset(), Initialize(), and Update().
|
private |
Definition at line 84 of file screen_editor.h.
Referenced by DrawToolset(), Initialize(), and Update().
|
private |
Definition at line 85 of file screen_editor.h.
Referenced by DrawToolset(), Initialize(), and Update().
|
private |
Definition at line 86 of file screen_editor.h.
Referenced by DrawToolset(), Initialize(), and Update().
|
private |
Definition at line 87 of file screen_editor.h.
Referenced by DrawToolset(), Initialize(), and Update().
|
private |
Definition at line 89 of file screen_editor.h.
Referenced by LoadBinaryGfx().
|
private |
Definition at line 91 of file screen_editor.h.
Referenced by DrawDungeonMapScreen(), DrawDungeonMapsRoomGfx(), and DrawDungeonMapsTabs().
|
private |
Definition at line 93 of file screen_editor.h.
Referenced by DrawDungeonMapsRoomGfx().
|
private |
Definition at line 94 of file screen_editor.h.
Referenced by DrawDungeonMapsEditor(), and DrawDungeonMapsRoomGfx().
|
private |
Definition at line 95 of file screen_editor.h.
Referenced by DrawDungeonMapScreen(), DrawDungeonMapsEditor(), DrawDungeonMapsRoomGfx(), and DrawDungeonMapsTabs().
|
private |
Definition at line 96 of file screen_editor.h.
Referenced by DrawDungeonMapScreen(), DrawDungeonMapsRoomGfx(), and DrawDungeonMapsTabs().
|
private |
Definition at line 98 of file screen_editor.h.
Referenced by DrawDungeonMapsTabs().
|
private |
Definition at line 99 of file screen_editor.h.
Referenced by DrawDungeonMapsTabs().
|
private |
Definition at line 101 of file screen_editor.h.
Referenced by DrawDungeonMapsRoomGfx().
|
private |
Definition at line 102 of file screen_editor.h.
Referenced by DrawDungeonMapScreen(), DrawDungeonMapsTabs(), and Load().
|
private |
Definition at line 104 of file screen_editor.h.
Referenced by DrawInventoryMenuEditor().
|
private |
Definition at line 105 of file screen_editor.h.
Referenced by DrawDungeonMapsEditor(), Load(), and LoadBinaryGfx().
|
private |
Definition at line 106 of file screen_editor.h.
Referenced by DrawDungeonMapScreen(), DrawDungeonMapsEditor(), DrawDungeonMapsRoomGfx(), Load(), and LoadBinaryGfx().
|
private |
Definition at line 107 of file screen_editor.h.
Referenced by DrawDungeonMapsRoomGfx().
|
private |
Definition at line 109 of file screen_editor.h.
Referenced by DrawDungeonMapsRoomGfx().
|
private |
Definition at line 111 of file screen_editor.h.
Referenced by DrawDungeonMapScreen(), DrawDungeonMapsRoomGfx(), DrawInventoryMenuEditor(), DrawInventoryToolset(), and ScreenEditor().
|
private |
Definition at line 112 of file screen_editor.h.
Referenced by DrawDungeonMapsRoomGfx(), and DrawInventoryMenuEditor().
|
private |
Definition at line 113 of file screen_editor.h.
Referenced by DrawDungeonMapsEditor().
|
private |
Definition at line 116 of file screen_editor.h.
Referenced by DrawInventoryMenuEditor().
|
private |
Definition at line 117 of file screen_editor.h.
|
private |
Definition at line 118 of file screen_editor.h.
Referenced by DrawInventoryMenuEditor(), LoadBinaryGfx(), and Update().