Working on Crashes and bug fixes

This commit is contained in:
OusmBlueNinja 2025-05-10 12:26:41 -05:00
parent 504ee0b64d
commit 137d8e86f7
10 changed files with 1264 additions and 1268 deletions

View File

@ -21,7 +21,7 @@ DockId=0x0000001B,0
[Window][Scene Tree]
Pos=0,19
Size=341,579
Size=341,444
Collapsed=0
DockId=0x0000000F,0
@ -125,8 +125,8 @@ Collapsed=0
DockId=0x0000000D,0
[Window][Resources]
Pos=0,600
Size=341,577
Pos=0,465
Size=341,712
Collapsed=0
DockId=0x00000010,0
@ -185,8 +185,8 @@ DockSpace ID=0x11111111 Window=0x1BBC0F80 Pos=0,19 Size=1920,1158 Sp
DockNode ID=0x00000005 Parent=0x11111111 SizeRef=989,1158 Split=X
DockNode ID=0x00000001 Parent=0x00000005 SizeRef=341,701 Split=Y Selected=0x12EF0F59
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=342,637 Split=Y Selected=0x12EF0F59
DockNode ID=0x0000000F Parent=0x00000003 SizeRef=342,579 HiddenTabBar=1 Selected=0x12EF0F59
DockNode ID=0x00000010 Parent=0x00000003 SizeRef=342,577 HiddenTabBar=1 Selected=0x30401527
DockNode ID=0x0000000F Parent=0x00000003 SizeRef=341,444 HiddenTabBar=1 Selected=0x12EF0F59
DockNode ID=0x00000010 Parent=0x00000003 SizeRef=341,712 HiddenTabBar=1 Selected=0x30401527
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=342,519 HiddenTabBar=1 Selected=0x36AF052B
DockNode ID=0x00000002 Parent=0x00000005 SizeRef=1577,701 Split=Y Selected=0xC450F867
DockNode ID=0x00000007 Parent=0x00000002 SizeRef=606,659 Split=X Selected=0xC450F867
@ -197,7 +197,7 @@ DockSpace ID=0x11111111 Window=0x1BBC0F80 Pos=0,19 Size=1920,1158 Sp
DockNode ID=0x00000008 Parent=0x00000002 SizeRef=606,497 Split=X Selected=0xEA83D666
DockNode ID=0x00000015 Parent=0x00000008 SizeRef=1283,172 Split=X Selected=0xEA83D666
DockNode ID=0x00000011 Parent=0x00000015 SizeRef=1232,168 Split=Y Selected=0x9B5D3198
DockNode ID=0x00000013 Parent=0x00000011 SizeRef=1449,273 HiddenTabBar=1 Selected=0xEA83D666
DockNode ID=0x00000013 Parent=0x00000011 SizeRef=1449,273 Selected=0xEA83D666
DockNode ID=0x00000014 Parent=0x00000011 SizeRef=1449,222 HiddenTabBar=1 Selected=0x9B5D3198
DockNode ID=0x00000012 Parent=0x00000015 SizeRef=49,168 HiddenTabBar=1 Selected=0x56009A08
DockNode ID=0x00000016 Parent=0x00000008 SizeRef=292,172 Split=Y Selected=0x3FC1A724

View File

@ -1,4 +0,0 @@
[COMPILE] g++ -std=c++20 -Wall -g -DGLM_ENABLE_EXPERIMENTAL -O2 -static -static-libstdc++ -static-libgcc -Isrc/include -Isrc/include/lua -Isrc/vendor -Isrc/vendor/imgui -Isrc/vendor/box2d -Isrc/vendor/xxhash -Isrc/vendor/miniaudio -Isrc/vendor/imguizmo -IC:/msys64/mingw64/include -IC:\msys64\mingw64\lib\libyaml-cpp.a -Isrc\vendor\imgui -MMD -MP -c src\src\core\utils\EngineConfig.cpp -o src\build\core\utils\EngineConfig.o
[LINK] g++ src\build\Engine.o src\build\main.o src\build\Renderer.o src\build\Components\AnimationComponent.o src\build\Components\AudioPlayerComponent.o src\build\Components\CameraComponent.o src\build\Components\LightComponent.o src\build\Components\ParticleComponent.o src\build\Components\PathFollowerComponent.o src\build\Components\PhysicsComponent.o src\build\Components\ScriptComponent.o src\build\Components\SpriteComponent.o src\build\Components\TextComonent.o src\build\Components\TilemapComponent.o src\build\core\audio\AudioEngine.o src\build\core\functions\Prefab.o src\build\core\functions\ScenePacker.o src\build\core\scripts\LuaGlobalBridge.o src\build\core\scripts\ScriptCore.o src\build\core\utils\AssetManager.o src\build\core\utils\EngineConfig.o src\build\core\utils\ExceptionHandler.o src\build\core\utils\FileDialog.o src\build\core\utils\input.o src\build\core\utils\LoadingWindow.o src\build\core\utils\Logging.o src\build\core\utils\Popup.o src\build\core\utils\Profiler.o src\build\core\utils\Texture.o src\build\core\utils\utils.o src\build\editor\utils\Themes.o src\build\editor\windows\AssetBrowser.o src\build\editor\windows\AudioInfo.o src\build\editor\windows\Inspector.o src\build\editor\windows\LuaGlobals.o src\build\editor\windows\SceneTree.o src\build\Entitys\Object.o src\build\utils\GameObjectsList.o src\build\utils\Shader.o src\build\utils\UID.o src\build\lapi.o src\build\lauxlib.o src\build\lbaselib.o src\build\lcode.o src\build\lcorolib.o src\build\lctype.o src\build\ldblib.o src\build\ldebug.o src\build\ldo.o src\build\ldump.o src\build\lfunc.o src\build\lgc.o src\build\linit.o src\build\liolib.o src\build\llex.o src\build\lmathlib.o src\build\lmem.o src\build\loadlib.o src\build\lobject.o src\build\lopcodes.o src\build\loslib.o src\build\lparser.o src\build\lstate.o src\build\lstring.o src\build\lstrlib.o src\build\ltable.o src\build\ltablib.o src\build\ltm.o src\build\lua.o src\build\luac.o src\build\lundump.o src\build\lutf8lib.o src\build\lvm.o src\build\lzio.o src\build\imgui.o src\build\imgui_demo.o src\build\imgui_draw.o src\build\imgui_impl_glfw.o src\build\imgui_impl_opengl3.o src\build\imgui_tables.o src\build\imgui_widgets.o src\build\aabb.o src\build\arena_allocator.o src\build\array.o src\build\bitset.o src\build\body.o src\build\broad_phase.o src\build\constraint_graph.o src\build\contact.o src\build\contact_solver.o src\build\core.o src\build\distance.o src\build\distance_joint.o src\build\dynamic_tree.o src\build\geometry.o src\build\hull.o src\build\id_pool.o src\build\island.o src\build\joint.o src\build\manifold.o src\build\math_functions.o src\build\motor_joint.o src\build\mouse_joint.o src\build\mover.o src\build\prismatic_joint.o src\build\revolute_joint.o src\build\sensor.o src\build\shape.o src\build\solver.o src\build\solver_set.o src\build\table.o src\build\timer.o src\build\types.o src\build\weld_joint.o src\build\wheel_joint.o src\build\world.o src\build\xxhash.o src\build\miniaudio.o src\build\ImGuizmo.o -o src\build\app.exe -LC:\msys64\mingw64\lib -lglfw3 -lglew32 -lopengl32 -lgdi32 -lyaml-cpp -lcomdlg32 -lssl -lcrypto -ldbghelp -lz -lfreetype
[ERROR] Runtime crash
Command 'src\build\app.exe' returned non-zero exit status 3221225477.

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,7 @@
#include "core/utils/EngineConfig.h"
#include "core/functions/Prefab.h"
#include "core/functions/ProjectManager.h"
#include "utils/GameObjectsList.h"
#include "core/utils/Profiler.h"
@ -34,10 +35,8 @@
#include "editor/windows/LuaGlobals.h"
#include "editor/windows/SceneTree.h"
#include "editor/utils/Themes.h"
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <imgui.h>
@ -136,11 +135,9 @@ void DrawProfilerTimelineBars(const ProfileNode &node,
int tn = std::snprintf(timeBuf, sizeof(timeBuf),
"%.2f ms", node.visualDurationMs);
if (tn < 0)
timeBuf[0] = '\0';
ImVec2 shortSz = ImGui::CalcTextSize(timeBuf);
if (shortSz.x <= availW)
{
@ -451,7 +448,7 @@ void DrawGizmoForObject(const std::shared_ptr<Object> &obj,
return;
// Model matrix at z = 1 to avoid clipping
glm::mat4 model = glm::translate(glm::mat4(1.0f), glm::vec3(obj->GetLocalPosition(), 1.0f));
glm::mat4 model = glm::translate(glm::mat4(1.0f), glm::vec3(obj->GetWorldPosition(), 1.0f));
model = glm::rotate(model, glm::radians(obj->GetLocalRotation()), glm::vec3(0, 0, 1));
ImGuizmo::SetOrthographic(true);
@ -480,7 +477,7 @@ void DrawGizmoForObject(const std::shared_ptr<Object> &obj,
float angleRadians = atan2(manipulated[1][0], manipulated[0][0]); // M10, M00
obj->SetLocalPosition({pos.x, pos.y});
obj->SetWorldPosition({pos.x, pos.y});
obj->SetLocalRotation(glm::degrees(angleRadians)); // Z
}
}
@ -511,7 +508,6 @@ void Engine::Init()
glfwSetDropCallback(window, GLFWDropCallback);
g_engineConfig.LoadFromFile();
Logger::LogOk("Config Core");
@ -527,71 +523,19 @@ void Engine::Init()
Renderer::Init();
auto obj = std::make_shared<Object>("Hello, Create");
objects.push_back(obj);
selected = obj;
//{
// std::random_device rd;
// std::mt19937 rng(rd());
// std::uniform_real_distribution<float> lightRadius(200.0f, 1000.0f);
// std::uniform_real_distribution<float> lightIntensity(0.5f, 1.0f);
// std::uniform_real_distribution<float> hueDist(0.0f, 1.0f);
//
// const float tileSize = 2048.0f; // approximate texture size
// const int gridSize = 10;
//
// // 10x10 grid of pebble sprites
// for (int y = 0; y < gridSize; ++y)
// {
// for (int x = 0; x < gridSize; ++x)
// {
// int index = y * gridSize + x;
// auto obj = std::make_shared<Object>("Pebble_" + std::to_string(index));
// obj->SetLocalPosition(glm::vec2(x * tileSize, y * tileSize));
//
// auto sprite = obj->AddComponent<SpriteComponent>();
// sprite->SetTexture("C:/Users/spenc/OneDrive/Pictures/textures/ganges_river_pebbles_diff_1k.png");
// sprite->SetNormalMap("C:/Users/spenc/OneDrive/Pictures/textures/ganges_river_pebbles_nor_gl_1k.png");
// sprite->SetRenderType(RenderType::Lit);
//
// objects.push_back(obj);
// }
// }
//
// // 100 random lights
// std::uniform_real_distribution<float> posDist(0.0f, tileSize * gridSize);
//
// for (int i = 0; i < 100; ++i)
// {
// auto obj = std::make_shared<Object>("Light_" + std::to_string(i));
// obj->SetLocalPosition(glm::vec2(posDist(rng), posDist(rng)));
//
// auto light = obj->AddComponent<LightComponent>();
// light->SetRadius(lightRadius(rng));
// light->SetIntensity(lightIntensity(rng));
// light->SetColor(HSVtoRGB(hueDist(rng), 0.8f, 1.0f));
//
// objects.push_back(obj);
// }
//}
Logger::LogVerbose("Init Sound Core");
AudioEngine::Init();
Logger::LogVerbose("Init Input Core");
Input::Init(window);
Logger::LogVerbose("Init ProjectManager");
ProjectManager::Init();
Logger::LogVerbose("Init Script Core");
ScriptCore::Init();
// AssetManager::LoadAssetAsync("C:\\Users\\spenc\\Music\\creative-technology-showreel-241274.mp3", AssetType::Audio);
Logger::LogVerbose("Resverving Objects");
// These values were AI Generated.
m_toDraw.reserve(2048); // ~2K sprites per frame (including UI, particles, objects)
@ -601,6 +545,12 @@ void Engine::Init()
m_animationsUpdates.reserve(512); // ~500 animated objects (characters, FX, etc.)
m_PathUpdates.reserve(16);
auto obj = std::make_shared<Object>("Hello, Create");
objects.push_back(obj);
selected = obj;
Logger::LogOk("Engine Core");
}
@ -683,7 +633,6 @@ void Engine::collectObjects(bool playing, const glm::vec2 &camPos, float camZoom
void Engine::Run()
{
Logger::LogOk("Engine Start");
while (!glfwWindowShouldClose(window) && running)
{
@ -788,7 +737,7 @@ void Engine::Run()
if (ImGui::MenuItem("Load Scene"))
{
std::string file = OpenFileDialog(FileDialogType::Scenes);
Logger::LogInfo("[LoadScene] Loading Scene.");
Logger::LogInfo("Loading Scene.");
if (!file.empty())
LoadScene(file);
selected = nullptr;
@ -1612,8 +1561,6 @@ void Engine::Run()
}
}
bool VerifySceneHash(const YAML::Node &root)
{
if (!root["scene_hash"] || !root["objects"])
@ -1696,7 +1643,7 @@ void Engine::LoadScene(const std::string &path)
if (!root["engine_version"] || !root["format_version"] || !root["scene_name"])
{
Logger::LogError("[LoadScene] Missing required metadata!");
Logger::LogError("Missing required metadata!");
loadingUI.Destroy();
return;
}
@ -1706,7 +1653,7 @@ void Engine::LoadScene(const std::string &path)
if (loadedVersion != expectedVersion)
{
Logger::LogWarning("[LoadScene] Version mismatch! Expected %s, got %s",
Logger::LogWarning("Version mismatch! Expected %s, got %s",
expectedVersion.c_str(), loadedVersion.c_str());
if (!g_engineConfig.settings.ignore_invalid_versions_popups)
@ -1723,7 +1670,7 @@ void Engine::LoadScene(const std::string &path)
if (result == 0)
{
Logger::LogInfo("[LoadScene] User cancelled scene load.");
Logger::LogInfo("User cancelled scene load.");
return;
}
if (result == 2)
@ -1736,13 +1683,13 @@ void Engine::LoadScene(const std::string &path)
}
else
{
Logger::LogInfo("[LoadScene] Version mismatch ignored due to user setting.");
Logger::LogInfo("Version mismatch ignored due to user setting.");
}
}
if (!VerifySceneHash(root))
{
Logger::LogWarning("[LoadScene] Scene hash does not match! File may be corrupted or tampered.");
Logger::LogWarning("Scene hash does not match! File may be corrupted or tampered.");
}
if (root["Assets"])
@ -1785,7 +1732,7 @@ void Engine::LoadScene(const std::string &path)
}
catch (const std::exception &e)
{
Logger::LogWarning("[LoadScene] Failed to load object '%s': %s", objName.c_str(), e.what());
Logger::LogWarning("Failed to load object '%s': %s", objName.c_str(), e.what());
}
objectIndex++;
@ -1794,7 +1741,7 @@ void Engine::LoadScene(const std::string &path)
// Color correction settings
if (root["color_correction"])
{
Logger::LogVerbose("[LoadScene] Loading Color Correction Attributes");
Logger::LogVerbose("Loading Color Correction Attributes");
currentStep = "Color Correction";
currentDetail = "Applying settings...";
loadingUI.Update(currentStep, currentDetail, 0.9f);

View File

@ -41,6 +41,7 @@ Object::Object(const Object &other)
this->uid = UID::Generate();
this->parent = parent;
this->isCopy = true;
this->children.clear();
@ -182,7 +183,6 @@ Object *Object::GetParent() const
void Object::Save(YAML::Emitter &out) const
{
Logger::LogVerbose("[LoadScene] Saving Object: [%s, %d]", name.c_str(), uid.id);
out << YAML::BeginMap;
out << YAML::Key << "name" << YAML::Value << name;
@ -199,7 +199,6 @@ void Object::Save(YAML::Emitter &out) const
out << YAML::Key << "components" << YAML::Value << YAML::BeginSeq;
for (const auto &comp : components)
{
Logger::LogVerbose("[LoadScene] Saving Component: %s", comp->GetName().c_str());
comp->Save(out);
}
out << YAML::EndSeq;
@ -262,7 +261,6 @@ void Object::Load(const YAML::Node &node)
}
}
Logger::LogVerbose("[LoadScene] Loading Object: ['%s', %d]", name.c_str(), uid.id);
components.clear();
if (node["components"])

View File

@ -61,6 +61,14 @@ public:
bool IsPrefab() const { return isPrefab; }
void SetPrefab(bool value) { isPrefab = value; }
bool IsCopy() const { return isCopy; }
void SetCopy(bool value) { isCopy = value; }
core::types::Vec2 GetSize() const { return size; }
void SetSize(core::types::Vec2 value) { size = value; }
UAssetID GetPrefabUAID() const { return prefabUAID; }
void SetPrefabUAID(UAssetID uaid) { prefabUAID = uaid; }
@ -79,7 +87,10 @@ private:
std::vector<std::shared_ptr<Object>> children;
std::vector<std::shared_ptr<Component>> components;
core::types::Vec2 size;
bool isCopy = false;
bool isPrefab = false;
UAssetID prefabUAID;

View File

@ -1,2 +1,23 @@
#include "ProjectManager.h"
#include "../../core/types/all.h"
#include "../../core/utils/AssetManager.h"
#include "../../core/utils/Logging.h"
std::vector<AssetInfo> ProjectManager::m_resources;
bool ProjectManager::Init()
{
m_resources.clear();
Logger::LogOk("Project Core");
return true;
}
bool ProjectManager::SaveResource()
{
//Todo: Implement this
Logger::LogWarning("Not Implemented (#21)");
return false;
}

View File

@ -1,7 +1,15 @@
#pragma once
#include <vector>
class AssetInfo;
class ProjectManager
{
public:
static bool Init();
static bool SaveResource();
private:
static std::vector<AssetInfo> m_resources;
};

View File

@ -14,46 +14,50 @@ using UAssetID = uint64_t;
class Object;
#define ASSET_TEXTURE "ASSET_TEXTURE"
#define ASSET_AUDIO "ASSET_AUDIO"
#define ASSET_FONT "ASSET_FONT"
#define ASSET_SHADER "ASSET_SHADER"
#define ASSET_SCRIPT "ASSET_SCRIPT"
#define ASSET_SCENE "ASSET_SCENE"
#define ASSET_VIDEO "ASSET_VIDEO"
#define ASSET_PREFAB "ASSET_PREFAB"
#define ASSET_UNKNOWN "ASSET_UNKNOWN"
#define ASSET_TEXTURE "ASSET_TEXTURE"
#define ASSET_AUDIO "ASSET_AUDIO"
#define ASSET_FONT "ASSET_FONT"
#define ASSET_SHADER "ASSET_SHADER"
#define ASSET_SCRIPT "ASSET_SCRIPT"
#define ASSET_SCENE "ASSET_SCENE"
#define ASSET_VIDEO "ASSET_VIDEO"
#define ASSET_PREFAB "ASSET_PREFAB"
#define ASSET_UNKNOWN "ASSET_UNKNOWN"
#define ASSET_TYPE_LIST \
X(Image) \
X(Audio) \
X(Font) \
X(Prefab) \
X(Shader) \
X(Script) \
X(Scene) \
X(Video) \
#define ASSET_TYPE_LIST \
X(Image) \
X(Audio) \
X(Font) \
X(Prefab) \
X(Shader) \
X(Script) \
X(Scene) \
X(Video) \
X(Unknown)
enum class AssetType {
enum class AssetType
{
#define X(name) name,
ASSET_TYPE_LIST
#undef X
};
inline const char* AssetTypeToString(AssetType type) {
switch (type) {
#define X(name) case AssetType::name: return #name;
inline const char *AssetTypeToString(AssetType type)
{
switch (type)
{
#define X(name) \
case AssetType::name: \
return #name;
ASSET_TYPE_LIST
#undef X
default: return "Unknown";
default:
return "Unknown";
}
}
inline AssetType StringToAssetType(const std::string_view str) {
inline AssetType StringToAssetType(const std::string_view str)
{
static const std::unordered_map<std::string_view, AssetType> map = {
#define X(name) {#name, AssetType::name},
ASSET_TYPE_LIST
@ -64,8 +68,6 @@ inline AssetType StringToAssetType(const std::string_view str) {
return it != map.end() ? it->second : AssetType::Unknown;
}
struct AssetInfo
{
uint64_t uaid = 0;
@ -79,8 +81,8 @@ struct AssetInfo
virtual ~AssetInfo() = default;
virtual void Save(YAML::Emitter& out) const = 0;
virtual void Load(const YAML::Node& node) = 0;
virtual void Save(YAML::Emitter &out) const = 0;
virtual void Load(const YAML::Node &node) = 0;
};
struct ImageAssetInfo : public AssetInfo
@ -92,35 +94,32 @@ struct ImageAssetInfo : public AssetInfo
ImageAssetInfo() { type = AssetType::Image; }
void Save(YAML::Emitter& out) const override;
void Load(const YAML::Node& node) override;
void Save(YAML::Emitter &out) const override;
void Load(const YAML::Node &node) override;
};
struct AudioAssetInfo : public AssetInfo
{
ma_sound* sound = nullptr;
ma_sound *sound = nullptr;
AudioAssetInfo() { type = AssetType::Audio; }
void Save(YAML::Emitter& out) const override;
void Load(const YAML::Node& node) override;
void Save(YAML::Emitter &out) const override;
void Load(const YAML::Node &node) override;
};
struct FontAssetInfo : public AssetInfo
{
GLuint atlasTextureID = 0;
int atlasWidth = 0;
int atlasHeight = 0;
int atlasWidth = 0;
int atlasHeight = 0;
FontAssetInfo();
void Save(YAML::Emitter& out) const override;
void Load(const YAML::Node& node) override;
void Save(YAML::Emitter &out) const override;
void Load(const YAML::Node &node) override;
};
struct PrefabAssetInfo : public AssetInfo
{
YAML::Node prefabYAML;
@ -129,48 +128,44 @@ struct PrefabAssetInfo : public AssetInfo
std::string prefabName = "Unnamed Prefab";
PrefabAssetInfo();
~PrefabAssetInfo() override
{
prefabRoot.reset();
}
std::shared_ptr<Object> Instantiate() const;
void Save(YAML::Emitter& out) const override;
void Load(const YAML::Node& node) override;
void Save(YAML::Emitter &out) const override;
void Load(const YAML::Node &node) override;
void ReloadFromYAML();
};
const char* MiniaudioResultToString(ma_result result);
const char *MiniaudioResultToString(ma_result result);
class AssetManager
{
public:
static void Init();
static void LoadAssetAsync(const std::string& path, AssetType type);
static const AssetInfo* GetAssetByID(uint64_t uaid);
static const AssetInfo* GetAssetByPath(const std::string& path);
static const std::unordered_map<uint64_t, std::shared_ptr<AssetInfo>>& GetAllAssets();
static void LoadAssetAsync(const std::string &path, AssetType type);
static const AssetInfo *GetAssetByID(uint64_t uaid);
static const AssetInfo *GetAssetByPath(const std::string &path);
static const std::unordered_map<uint64_t, std::shared_ptr<AssetInfo>> &GetAllAssets();
static void UnloadAsset(uint64_t uaid);
static void ClearAllAssets();
static void Save(YAML::Emitter& out);
static void Load(const YAML::Node& node);
static void Save(YAML::Emitter &out);
static void Load(const YAML::Node &node);
static uint64_t GenerateUAID();
static AssetType AssetTypeFromExtension(std::string ext);
private:
static std::unordered_map<uint64_t, std::shared_ptr<AssetInfo>> s_Assets;
static std::unordered_map<std::string, uint64_t> s_PathToUAID;
static uint64_t s_NextUAID;
static void LoadImageInternal (const std::string& path, uint64_t uaid);
static void LoadAudioInternal (const std::string& path, uint64_t uaid);
static void LoadPrefabInternal (const std::string& path, uint64_t uaid);
static void LoadFontInternal (const std::string& path, uint64_t uaid);
static void LoadImageInternal(const std::string &path, uint64_t uaid);
static void LoadAudioInternal(const std::string &path, uint64_t uaid);
static void LoadPrefabInternal(const std::string &path, uint64_t uaid);
static void LoadFontInternal(const std::string &path, uint64_t uaid);
};

View File

@ -64,8 +64,28 @@ void DrawInspectorUI(std::shared_ptr<Object> selected)
drawList->AddText(textPos, textColor, "P");
ImGui::Dummy(ImVec2(iconSize + 4.0f, iconSize));
}
if (selected->IsCopy())
{
ImGui::SameLine();
ImVec2 iconPos = ImGui::GetCursorScreenPos();
float iconSize = ImGui::GetTextLineHeight();
ImVec2 iconEnd = ImVec2(iconPos.x + iconSize, iconPos.y + iconSize);
ImU32 bgColor = IM_COL32(40, 255, 45, 255);
ImU32 textColor = IM_COL32(255, 255, 255, 255);
auto *drawList = ImGui::GetWindowDrawList();
drawList->AddRectFilled(iconPos, iconEnd, bgColor, 3.0f);
ImVec2 textSize = ImGui::CalcTextSize("C");
ImVec2 textPos = {
iconPos.x + (iconSize - textSize.x) * 0.5f,
iconPos.y + (iconSize - textSize.y) * 0.5f};
drawList->AddText(textPos, textColor, "C");
ImGui::Dummy(ImVec2(iconSize + 4.0f, iconSize));
}
ImGui::Separator();