Shows how the game uses the current graphics sheet while it is edited: a room that loads it, a sprite animation drawn from it, and the tile16s that use the selected 8x8 tile. More...
#include <usage_preview_view.h>
Public Member Functions | |
| UsagePreviewView (GraphicsEditorState *state) | |
| void | SetRom (Rom *rom) |
| void | SetGameData (zelda3::GameData *game_data) |
| void | SetHackName (std::string hack_name) |
| void | SetLiveRoomProvider (usage_preview::LiveRoomProvider provider) |
| void | Reset () |
| void | Draw () |
| void | DrawSourcePreview (bool show_controls=true) |
Static Public Attributes | |
| static constexpr double | kMinRenderInterval = 0.1 |
Private Types | |
| enum class | Mode { kRoom , kSprite , kTile16 } |
Private Member Functions | |
| void | EnsureTables () |
| void | RefreshRoomContexts () |
| void | DrawRoomContext (bool render_now) |
| void | DrawSpriteContext (bool render_now, float delta) |
| void | DrawTile16Context (bool render_now) |
| void | DrawSharedUses () |
| absl::Status | ScanSharedUses (const usage_preview::LiveRoomContexts &rooms) |
| uint64_t | SharedUsesHash (const usage_preview::LiveRoomContexts &rooms) const |
| uint64_t | HashWatchedSheets (bool include_room_context) const |
| usage_preview::SheetPixels | Snapshot () const |
| void | ShowImage (gfx::Bitmap &bitmap, const usage_preview::PreviewImage &image) |
| void | DrawBitmapFit (gfx::Bitmap &bitmap, const std::vector< SDL_Rect > &rects, float max_scale, bool fit_height=false) |
| int | SelectedTileIndex () const |
| void | InvalidateTables () |
Friends | |
| class | UsagePreviewViewTestPeer |
| class | AuthoringSaveWorkflowTestPeer |
Shows how the game uses the current graphics sheet while it is edited: a room that loads it, a sprite animation drawn from it, and the tile16s that use the selected 8x8 tile.
Renders from the session's sheet store (unsaved pixel edits) through usage_preview's renderers, or the source editor's live context. Re-renders at most 10 times a second while pixels change, and once more when the stroke ends.
Definition at line 30 of file usage_preview_view.h.
|
strongprivate |
| Enumerator | |
|---|---|
| kRoom | |
| kSprite | |
| kTile16 | |
Definition at line 52 of file usage_preview_view.h.
|
inlineexplicit |
Definition at line 32 of file usage_preview_view.h.
| void yaze::editor::UsagePreviewView::SetRom | ( | Rom * | rom | ) |
Definition at line 42 of file usage_preview_view.cc.
References InvalidateTables(), and rom_.

| void yaze::editor::UsagePreviewView::SetGameData | ( | zelda3::GameData * | game_data | ) |
Definition at line 48 of file usage_preview_view.cc.
References game_data_, and InvalidateTables().

|
inline |
Definition at line 36 of file usage_preview_view.h.
References hack_name_.
|
inline |
Definition at line 38 of file usage_preview_view.h.
References InvalidateTables(), and live_rooms_provider_.

|
inline |
Definition at line 42 of file usage_preview_view.h.
References InvalidateTables().

| void yaze::editor::UsagePreviewView::Draw | ( | ) |
Definition at line 522 of file usage_preview_view.cc.
References area_choice_, areas_for_sheet_, yaze::gfx::PaletteManager::ColorRevision(), configured_spriteset_, yaze::editor::GraphicsEditorState::current_sheet_id, dirty_, EnsureTables(), game_data_, yaze::gfx::PaletteManager::Get(), yaze::Rom::is_loaded(), yaze::zelda3::IsUnderworldSpriteset(), last_render_time_, last_sheet_, palette_revision_, RefreshRoomContexts(), yaze::editor::usage_preview::RoomUsagePreview::Reset(), rom_, room_preview_, yaze::editor::GraphicsEditorState::source_context_revision, source_context_revision_, spriteset_choice_, yaze::zelda3::GameData::spriteset_ids, spritesets_for_sheet_, yaze::zelda3::SpriteSheetSlots(), state_, and tile16_preview_.
| void yaze::editor::UsagePreviewView::DrawSourcePreview | ( | bool | show_controls = true | ) |
Definition at line 258 of file usage_preview_view.cc.
References yaze::gui::AutoRegisterLastItem(), yaze::gfx::PaletteManager::ColorRevision(), DrawBitmapFit(), DrawSharedUses(), game_data_, yaze::gfx::PaletteManager::Get(), HashWatchedSheets(), HOVER_HINT, ICON_MD_REFRESH, kMinRenderInterval, live_, rendered_source_revision_, ShowImage(), source_bitmap_, yaze::editor::GraphicsEditorState::source_context, yaze::editor::GraphicsEditorState::source_context_revision, source_dirty_, source_hash_, source_palette_revision_, source_render_time_, source_status_, and state_.
|
private |
Definition at line 80 of file usage_preview_view.cc.
References yaze::zelda3::CollectRoomGfx(), yaze::editor::usage_preview::CollectRoomSheetBlocks(), dirty_, fallback_room_blocks_, game_data_, group_hash_, yaze::Rom::is_loaded(), last_sheet_, yaze::zelda3::GameData::main_blockset_ids, yaze::editor::usage_preview::RoomUsagePreview::Reset(), rom_, yaze::zelda3::GameData::room_blockset_ids, room_gfx_, room_preview_, yaze::zelda3::GameData::spriteset_ids, and tables_ready_.
Referenced by Draw().

|
private |
Definition at line 104 of file usage_preview_view.cc.
References current_live_room_, yaze::editor::GraphicsEditorState::current_sheet_id, dirty_, fallback_room_blocks_, game_data_, last_render_time_, last_sheet_, live_room_revisions_, live_rooms_, live_rooms_provider_, rom_, room_blocks_, room_choice_, rooms_for_sheet_, yaze::editor::usage_preview::RoomsUsingSheet(), and state_.
Referenced by Draw().

|
private |
Definition at line 651 of file usage_preview_view.cc.
References HOVER_HINT.
|
private |
Definition at line 745 of file usage_preview_view.cc.
References ICON_MD_PAUSE, ICON_MD_PLAY_ARROW, ICON_MD_SKIP_NEXT, ICON_MD_SKIP_PREVIOUS, yaze::zelda3::kDungeonSpritesetBase, yaze::editor::zsprite::ZSprite::Load(), and yaze::zelda3::ResolveSpriteName().

|
private |
Definition at line 888 of file usage_preview_view.cc.
References yaze::zelda3::CollectOverworldAreaGfx(), and HOVER_HINT.

|
private |
Definition at line 389 of file usage_preview_view.cc.
References yaze::gui::AutoRegisterLastItem(), DrawBitmapFit(), game_data_, live_rooms_provider_, yaze::editor::usage_preview::RoomUsagePreview::mutable_bitmap(), yaze::editor::usage_preview::RoomUsagePreview::ObjectRectsForObject(), yaze::zelda3::PaletteAddressGroupName(), yaze::editor::usage_preview::RoomUsagePreview::Render(), rom_, ScanSharedUses(), shared_preview_object_, shared_preview_room_, shared_room_preview_, shared_scan_hash_, shared_scan_ready_, shared_scan_status_, shared_targets_, shared_uses_, shared_whole_pattern_, and SharedUsesHash().
Referenced by DrawSourcePreview().
|
private |
Definition at line 353 of file usage_preview_view.cc.
References yaze::editor::usage_preview::FindLoadedRoomSourceUses(), game_data_, yaze::zelda3::ResolvedGraphicsContext::id, yaze::Rom::is_loaded(), yaze::editor::GraphicsEditContext::owner, yaze::zelda3::ResolvedGraphicsContext::parent_id, yaze::editor::GraphicsEditContext::resolved, RETURN_IF_ERROR, rom_, shared_preview_room_, shared_scan_hash_, shared_scan_ready_, shared_targets_, shared_uses_, shared_whole_pattern_, SharedUsesHash(), yaze::editor::GraphicsEditorState::source_context, yaze::editor::GraphicsEditorState::SourceTarget(), state_, yaze::zelda3::ResolvedGraphicsContext::surface, and yaze::editor::UpdateGraphicsContextPalettes().
Referenced by DrawSharedUses().
|
private |
Definition at line 325 of file usage_preview_view.cc.
References yaze::editor::GraphicsEditorState::current_sheet_id, game_data_, yaze::gfx::PaletteManager::Get(), yaze::zelda3::CustomObjectManager::Get(), yaze::zelda3::GraphicsSheetStore::Revision(), rom_, shared_whole_pattern_, yaze::zelda3::GraphicsSheetStoreHolder::sheet_store, yaze::editor::GraphicsEditorState::source_context, yaze::editor::GraphicsEditorState::source_context_revision, and state_.
Referenced by DrawSharedUses(), and ScanSharedUses().

|
private |
Definition at line 158 of file usage_preview_view.cc.
References yaze::editor::GraphicsEditorState::current_sheet_id, game_data_, yaze::editor::GraphicsEditorState::modified_sheets, yaze::zelda3::GraphicsSheetStore::Revision(), room_blocks_, room_choice_, rooms_for_sheet_, yaze::zelda3::GraphicsSheetStoreHolder::sheet_store, yaze::editor::usage_preview::SnapshotSessionSheets(), yaze::editor::GraphicsEditorState::source_context, and state_.
Referenced by DrawSourcePreview().

|
private |
Definition at line 191 of file usage_preview_view.cc.
References yaze::editor::GraphicsEditorState::current_sheet_id, game_data_, yaze::editor::GraphicsEditorState::modified_sheets, yaze::editor::usage_preview::SnapshotSessionSheets(), and state_.

|
private |
Definition at line 206 of file usage_preview_view.cc.
References yaze::editor::usage_preview::PreviewImage::colors, yaze::gfx::Bitmap::Create(), yaze::gfx::Bitmap::depth(), yaze::editor::usage_preview::PreviewImage::empty(), yaze::editor::usage_preview::PreviewImage::format, yaze::editor::usage_preview::PreviewImage::height, yaze::gfx::Bitmap::height(), yaze::editor::usage_preview::PreviewImage::index0_transparent, yaze::gfx::Bitmap::is_active(), yaze::editor::usage_preview::PreviewImage::kIndexed, yaze::gfx::Bitmap::kPreview, yaze::gfx::Bitmap::metadata(), yaze::editor::usage_preview::PreviewImage::pixels, yaze::gfx::Bitmap::BitmapMetadata::purpose, yaze::gfx::Bitmap::set_data(), yaze::gfx::Bitmap::SetPalette(), yaze::editor::usage_preview::PreviewImage::width, and yaze::gfx::Bitmap::width().
Referenced by DrawSourcePreview().
|
private |
Definition at line 230 of file usage_preview_view.cc.
References yaze::gui::GetWarningColor(), yaze::gfx::Bitmap::height(), yaze::gfx::Bitmap::is_active(), yaze::gfx::Bitmap::texture(), and yaze::gfx::Bitmap::width().
Referenced by DrawSharedUses(), and DrawSourcePreview().
|
private |
Definition at line 197 of file usage_preview_view.cc.
References follow_selection_, yaze::editor::GraphicsEditorState::selection, state_, tile_index_, and yaze::editor::PixelSelection::x.
|
private |
Definition at line 53 of file usage_preview_view.cc.
References areas_, configured_spriteset_, current_live_room_, dirty_, fallback_room_blocks_, group_hash_, last_render_time_, last_sheet_, live_room_revisions_, live_rooms_, object_rects_, yaze::editor::usage_preview::RoomUsagePreview::Reset(), room_blocks_, room_gfx_, room_preview_, rooms_for_sheet_, shared_preview_room_, shared_room_preview_, shared_scan_ready_, shared_scan_status_, shared_targets_, shared_uses_, source_dirty_, source_render_time_, and tables_ready_.
Referenced by Reset(), SetGameData(), SetLiveRoomProvider(), and SetRom().

|
friend |
Definition at line 50 of file usage_preview_view.h.
|
friend |
Definition at line 51 of file usage_preview_view.h.
|
staticconstexpr |
Definition at line 47 of file usage_preview_view.h.
Referenced by DrawSourcePreview().
|
private |
Definition at line 71 of file usage_preview_view.h.
Referenced by Draw(), DrawSourcePreview(), HashWatchedSheets(), RefreshRoomContexts(), ScanSharedUses(), SelectedTileIndex(), SharedUsesHash(), and Snapshot().
|
private |
Definition at line 72 of file usage_preview_view.h.
Referenced by Draw(), DrawSharedUses(), EnsureTables(), RefreshRoomContexts(), ScanSharedUses(), SetRom(), and SharedUsesHash().
|
private |
Definition at line 73 of file usage_preview_view.h.
Referenced by Draw(), DrawSharedUses(), DrawSourcePreview(), EnsureTables(), HashWatchedSheets(), RefreshRoomContexts(), ScanSharedUses(), SetGameData(), SharedUsesHash(), and Snapshot().
|
private |
Definition at line 74 of file usage_preview_view.h.
Referenced by SetHackName().
|
private |
Definition at line 76 of file usage_preview_view.h.
|
private |
Definition at line 77 of file usage_preview_view.h.
Referenced by DrawSourcePreview().
|
private |
Definition at line 78 of file usage_preview_view.h.
Referenced by Draw(), EnsureTables(), InvalidateTables(), and RefreshRoomContexts().
|
private |
Definition at line 79 of file usage_preview_view.h.
|
private |
Definition at line 80 of file usage_preview_view.h.
Referenced by Draw(), InvalidateTables(), and RefreshRoomContexts().
|
private |
Definition at line 81 of file usage_preview_view.h.
Referenced by Draw(), EnsureTables(), InvalidateTables(), and RefreshRoomContexts().
|
private |
Definition at line 82 of file usage_preview_view.h.
|
private |
Definition at line 85 of file usage_preview_view.h.
Referenced by EnsureTables(), and InvalidateTables().
|
private |
Definition at line 86 of file usage_preview_view.h.
Referenced by HashWatchedSheets(), InvalidateTables(), and RefreshRoomContexts().
|
private |
Definition at line 87 of file usage_preview_view.h.
Referenced by EnsureTables(), and InvalidateTables().
|
private |
Definition at line 88 of file usage_preview_view.h.
Referenced by InvalidateTables().
|
private |
Definition at line 90 of file usage_preview_view.h.
Referenced by DrawSharedUses(), RefreshRoomContexts(), and SetLiveRoomProvider().
|
private |
Definition at line 91 of file usage_preview_view.h.
Referenced by InvalidateTables(), and RefreshRoomContexts().
|
private |
Definition at line 92 of file usage_preview_view.h.
Referenced by EnsureTables(), InvalidateTables(), and RefreshRoomContexts().
|
private |
Definition at line 93 of file usage_preview_view.h.
Referenced by InvalidateTables(), and RefreshRoomContexts().
|
private |
Definition at line 94 of file usage_preview_view.h.
Referenced by EnsureTables(), and InvalidateTables().
|
private |
Definition at line 95 of file usage_preview_view.h.
Referenced by InvalidateTables(), and RefreshRoomContexts().
|
private |
Definition at line 98 of file usage_preview_view.h.
Referenced by Draw(), EnsureTables(), and InvalidateTables().
|
private |
Definition at line 99 of file usage_preview_view.h.
Referenced by HashWatchedSheets(), InvalidateTables(), and RefreshRoomContexts().
|
private |
Definition at line 100 of file usage_preview_view.h.
Referenced by HashWatchedSheets(), and RefreshRoomContexts().
|
private |
Definition at line 101 of file usage_preview_view.h.
|
private |
Definition at line 102 of file usage_preview_view.h.
|
private |
Definition at line 103 of file usage_preview_view.h.
Referenced by InvalidateTables().
|
private |
Definition at line 106 of file usage_preview_view.h.
|
private |
Definition at line 107 of file usage_preview_view.h.
Referenced by Draw().
|
private |
Definition at line 108 of file usage_preview_view.h.
Referenced by Draw().
|
private |
Definition at line 109 of file usage_preview_view.h.
Referenced by Draw(), and InvalidateTables().
|
private |
Definition at line 110 of file usage_preview_view.h.
|
private |
Definition at line 111 of file usage_preview_view.h.
|
private |
Definition at line 112 of file usage_preview_view.h.
|
private |
Definition at line 113 of file usage_preview_view.h.
|
private |
Definition at line 114 of file usage_preview_view.h.
|
private |
Definition at line 115 of file usage_preview_view.h.
|
private |
Definition at line 116 of file usage_preview_view.h.
|
private |
Definition at line 119 of file usage_preview_view.h.
Referenced by Draw().
|
private |
Definition at line 120 of file usage_preview_view.h.
Referenced by Draw().
|
private |
Definition at line 121 of file usage_preview_view.h.
Referenced by Draw().
|
private |
Definition at line 122 of file usage_preview_view.h.
Referenced by SelectedTileIndex().
|
private |
Definition at line 123 of file usage_preview_view.h.
Referenced by SelectedTileIndex().
|
private |
Definition at line 124 of file usage_preview_view.h.
|
private |
Definition at line 125 of file usage_preview_view.h.
|
private |
Definition at line 126 of file usage_preview_view.h.
|
private |
Definition at line 127 of file usage_preview_view.h.
Referenced by Draw().
|
private |
Definition at line 128 of file usage_preview_view.h.
Referenced by Draw().
|
private |
Definition at line 129 of file usage_preview_view.h.
|
private |
Definition at line 130 of file usage_preview_view.h.
Referenced by DrawSourcePreview().
|
private |
Definition at line 131 of file usage_preview_view.h.
Referenced by DrawSourcePreview().
|
private |
Definition at line 132 of file usage_preview_view.h.
Referenced by DrawSourcePreview().
|
private |
Definition at line 133 of file usage_preview_view.h.
Referenced by DrawSourcePreview().
|
private |
Definition at line 134 of file usage_preview_view.h.
Referenced by DrawSourcePreview(), and InvalidateTables().
|
private |
Definition at line 135 of file usage_preview_view.h.
Referenced by DrawSourcePreview(), and InvalidateTables().
|
private |
Definition at line 136 of file usage_preview_view.h.
Referenced by DrawSourcePreview().
|
private |
Definition at line 139 of file usage_preview_view.h.
Referenced by DrawSharedUses(), ScanSharedUses(), and SharedUsesHash().
|
private |
Definition at line 140 of file usage_preview_view.h.
Referenced by DrawSharedUses(), InvalidateTables(), and ScanSharedUses().
|
private |
Definition at line 141 of file usage_preview_view.h.
Referenced by DrawSharedUses(), and ScanSharedUses().
|
private |
Definition at line 142 of file usage_preview_view.h.
Referenced by DrawSharedUses(), and InvalidateTables().
|
private |
Definition at line 143 of file usage_preview_view.h.
Referenced by DrawSharedUses(), InvalidateTables(), and ScanSharedUses().
|
private |
Definition at line 144 of file usage_preview_view.h.
Referenced by DrawSharedUses(), InvalidateTables(), and ScanSharedUses().
|
private |
Definition at line 145 of file usage_preview_view.h.
Referenced by DrawSharedUses(), and InvalidateTables().
|
private |
Definition at line 146 of file usage_preview_view.h.
Referenced by DrawSharedUses(), InvalidateTables(), and ScanSharedUses().
|
private |
Definition at line 147 of file usage_preview_view.h.
Referenced by DrawSharedUses().