From 17fa0aeb68febf977215e2534d101da0bb56ff98 Mon Sep 17 00:00:00 2001 From: Joey Pollack Date: Fri, 2 Sep 2022 20:24:38 -0400 Subject: [PATCH] Preparing editor assets to show their properties --- src/run_modes/editor/contents/World.cpp | 5 +++++ src/run_modes/editor/contents/editor_asset.h | 2 ++ src/run_modes/editor/contents/tile_map.h | 2 ++ src/run_modes/editor/contents/tile_set.cpp | 6 ++++++ src/run_modes/editor/contents/tile_set.h | 1 + src/run_modes/editor/contents/world.h | 1 + src/run_modes/editor/panels/properties_view.cpp | 8 ++++++-- 7 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/run_modes/editor/contents/World.cpp b/src/run_modes/editor/contents/World.cpp index 97016b6..9957dfe 100644 --- a/src/run_modes/editor/contents/World.cpp +++ b/src/run_modes/editor/contents/World.cpp @@ -118,5 +118,10 @@ namespace lunarium { namespace editor return nlohmann::ordered_json(); } + + void World::DrawProperties() + { + + } }} \ No newline at end of file diff --git a/src/run_modes/editor/contents/editor_asset.h b/src/run_modes/editor/contents/editor_asset.h index 506eb92..455f2cf 100644 --- a/src/run_modes/editor/contents/editor_asset.h +++ b/src/run_modes/editor/contents/editor_asset.h @@ -31,6 +31,8 @@ namespace lunarium { namespace editor [[nodiscard]] virtual OpRes LoadRawFile() = 0; + virtual void DrawProperties() = 0; + // [[nodiscard]] virtual OpRes LoadFromJSON(nlohmann::json& node) = 0; //[[nodiscard]] virtual OpRes SaveToJSON(nlohmann::json& node) = 0; diff --git a/src/run_modes/editor/contents/tile_map.h b/src/run_modes/editor/contents/tile_map.h index e316ebb..ddaab40 100644 --- a/src/run_modes/editor/contents/tile_map.h +++ b/src/run_modes/editor/contents/tile_map.h @@ -42,6 +42,8 @@ namespace lunarium { namespace editor // Call during render to texture phase void Render(lunarium::Renderer2D* g); + void DrawProperties(); + void DrawDebugGUI(); TileRef** GetMap() { return mpMap; }; diff --git a/src/run_modes/editor/contents/tile_set.cpp b/src/run_modes/editor/contents/tile_set.cpp index 3402c22..f56204b 100644 --- a/src/run_modes/editor/contents/tile_set.cpp +++ b/src/run_modes/editor/contents/tile_set.cpp @@ -170,4 +170,10 @@ namespace lunarium { namespace editor } g->DrawLine(glm::vec2(0, mSetImage->GetHeight()), glm::vec2(mSetImage->GetWidth(), mSetImage->GetHeight()), Color::Black(), 1.5f); } + + + void TileSet::DrawProperties() + { + + } }} \ No newline at end of file diff --git a/src/run_modes/editor/contents/tile_set.h b/src/run_modes/editor/contents/tile_set.h index d7b377f..50dc469 100644 --- a/src/run_modes/editor/contents/tile_set.h +++ b/src/run_modes/editor/contents/tile_set.h @@ -28,6 +28,7 @@ namespace lunarium { namespace editor OpRes Deserialize(nlohmann::ordered_json& node); bool IsValidNode(nlohmann::ordered_json& node); nlohmann::ordered_json AsJSON(); + void DrawProperties(); void SetTileSetID(int id); int GetTileSetID() const; diff --git a/src/run_modes/editor/contents/world.h b/src/run_modes/editor/contents/world.h index 1879283..483db88 100644 --- a/src/run_modes/editor/contents/world.h +++ b/src/run_modes/editor/contents/world.h @@ -33,6 +33,7 @@ namespace lunarium { namespace editor [[nodiscard]] virtual OpRes Deserialize(nlohmann::ordered_json& node); [[nodiscord]] virtual bool IsValidNode(nlohmann::ordered_json& node); [[nodiscard]] virtual nlohmann::ordered_json AsJSON(); + void DrawProperties(); lunarium::World* GetWorld(); void UnloadWorld(); diff --git a/src/run_modes/editor/panels/properties_view.cpp b/src/run_modes/editor/panels/properties_view.cpp index 0a0dc01..c26418e 100644 --- a/src/run_modes/editor/panels/properties_view.cpp +++ b/src/run_modes/editor/panels/properties_view.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #define PRESENT_COMP_CHOICE(str_name, type_name, pv) \ @@ -154,7 +155,10 @@ namespace lunarium { namespace editor void PropertiesView::ShowAsset() { - + if (mpSelectedAsset) + { + mpSelectedAsset->DrawProperties(); + } } -}} \ No newline at end of file +}}