Editor Asset explorer setup
This commit is contained in:
		| @ -1,4 +1,7 @@ | ||||
| #pragma once | ||||
| #include "Project/Project.h" | ||||
|  | ||||
|  | ||||
| struct EditorContext { | ||||
|     std::shared_ptr<Project> CurrentProject; | ||||
|  | ||||
|  | ||||
| @ -3,7 +3,7 @@ | ||||
| #include "../../YoggieEngine/src/Graphics/Memory/Framebuffer.h" | ||||
| #include "../../YoggieEngine/src/PerfCounter.h" | ||||
| #include "../../YoggieEngine/src/Scene/Entity.h" | ||||
| #include "Project.h" | ||||
| #include "Project/Project.h" | ||||
|  | ||||
| class EditorRuntime : public  ApplicationRuntime { | ||||
|  | ||||
| @ -14,7 +14,7 @@ public: | ||||
|         CurrentProject = std::make_shared<Project>("Random"); | ||||
|  | ||||
|         framebuffer = new Framebuffer(); | ||||
|         | ||||
|          | ||||
|         // Create a level and load it as the current level | ||||
|         auto importer = ModelImporter(); | ||||
|  | ||||
| @ -31,7 +31,6 @@ public: | ||||
|         auto& rendercube2 = cube2.AddComponent<Render3DComponent>(); | ||||
|         rendercube2.mesh = *(Model->renderable->mesh); | ||||
|  | ||||
|  | ||||
|         // create an ambient light source | ||||
|         auto AmbientLight = MainScene.AddEntity("AmbientLight"); | ||||
|         auto light = AmbientLight.AddComponent<LightComponent>(); | ||||
|  | ||||
| @ -3,6 +3,7 @@ | ||||
| #include <iostream> | ||||
| #include "../../YoggieEngine/src/Scene/Components.h" | ||||
| #include "../../YoggieEngine/src/Scene/Entity.h" | ||||
|  | ||||
| class Editor; | ||||
|  | ||||
| void ComponentView(const std::string& componentName, voidFunction func) | ||||
| @ -169,7 +170,49 @@ void Console() { | ||||
| } | ||||
|  | ||||
| void AssetsFinder() { | ||||
|     static YoggieEngine::Texture folderIcon ("rsc/folderIcon.png"); | ||||
|     static YoggieEngine::Texture AssetIcon("rsc/assetIcon.png"); | ||||
|     static int iconSize = 60; | ||||
|  | ||||
|     ImGui::Begin("Asset-Finder", false); | ||||
|     ImGui::Dummy(ImVec2{ 128, 128 }); | ||||
|     ImGui::DragInt("IconSize", &iconSize, 1, 30, 90); | ||||
|  | ||||
|  | ||||
|     if (ImGui::BeginTable("##resources", 3))  | ||||
|     { | ||||
|         ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.f, 0.f, 0.f, 0.f)); | ||||
|         ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.f, 0.f, 0.f, 0.f)); | ||||
|         ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.f, 1.f, 1.f, 0.2f)); | ||||
|  | ||||
|         for (int row = 0; row < 4; row++) { | ||||
|             ImGui::TableNextRow(); | ||||
|             for (int column = 0; column < 3; column++) { | ||||
|                 ImGui::TableSetColumnIndex(column); | ||||
|                  | ||||
|                 if (column % 2) { | ||||
|                     ImGui::ImageButton( | ||||
|                         (ImTextureID)folderIcon.GetID(), | ||||
|                         ImVec2{ (float)iconSize,(float)iconSize }); | ||||
|                     ImGui::Text("Folder %d", row); | ||||
|                 } | ||||
|                 else { | ||||
|                     ImGui::ImageButton( | ||||
|                         (ImTextureID)AssetIcon.GetID(),  | ||||
|                         ImVec2{ (float)iconSize, (float)iconSize }); | ||||
|                     ImGui::Text("Asset %d", row); | ||||
|                 } | ||||
|  | ||||
|  | ||||
|             } | ||||
|          } | ||||
|  | ||||
|         ImGui::PopStyleColor(3); | ||||
|         ImGui::EndTable(); | ||||
|  | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
|     ImGui::End(); | ||||
| } | ||||
		Reference in New Issue
	
	Block a user