Added Icons
This commit is contained in:
parent
dbd23a30fc
commit
605641db7f
106
imgui.ini
106
imgui.ini
@ -19,7 +19,7 @@ DockId=0x00000002,0
|
||||
Pos=374,27
|
||||
Size=1212,770
|
||||
Collapsed=0
|
||||
DockId=0x00000017,0
|
||||
DockId=0x0000001F,0
|
||||
|
||||
[Window][Performance]
|
||||
Pos=8,774
|
||||
@ -49,7 +49,7 @@ DockId=0x0000000B,0
|
||||
Pos=374,27
|
||||
Size=1202,849
|
||||
Collapsed=0
|
||||
DockId=0x00000017,0
|
||||
DockId=0x0000001F,0
|
||||
|
||||
[Window][Lua Text Editor]
|
||||
Pos=8,481
|
||||
@ -68,26 +68,26 @@ Size=1920,1177
|
||||
Collapsed=0
|
||||
|
||||
[Window][Inspector##InspectorWindow]
|
||||
Pos=1536,27
|
||||
Size=376,1142
|
||||
Pos=1492,30
|
||||
Size=420,1139
|
||||
Collapsed=0
|
||||
DockId=0x00000016,0
|
||||
|
||||
[Window][Editor##EditorWindow]
|
||||
Pos=332,27
|
||||
Size=1202,776
|
||||
Pos=332,30
|
||||
Size=1158,430
|
||||
Collapsed=0
|
||||
DockId=0x00000017,0
|
||||
DockId=0x0000001F,0
|
||||
|
||||
[Window][Performance##performance]
|
||||
Pos=8,761
|
||||
Size=322,408
|
||||
Pos=8,762
|
||||
Size=322,407
|
||||
Collapsed=0
|
||||
DockId=0x0000001C,0
|
||||
|
||||
[Window][Logger##logger]
|
||||
Pos=332,805
|
||||
Size=1202,364
|
||||
Pos=332,348
|
||||
Size=518,364
|
||||
Collapsed=0
|
||||
DockId=0x00000019,0
|
||||
|
||||
@ -104,8 +104,8 @@ Collapsed=0
|
||||
DockId=0x0000000F,0
|
||||
|
||||
[Window][Scene Window##SceneWindow]
|
||||
Pos=8,27
|
||||
Size=322,732
|
||||
Pos=8,30
|
||||
Size=322,730
|
||||
Collapsed=0
|
||||
DockId=0x0000001B,0
|
||||
|
||||
@ -116,8 +116,8 @@ Collapsed=0
|
||||
DockId=0x00000011,0
|
||||
|
||||
[Window][Profiler]
|
||||
Pos=935,805
|
||||
Size=599,364
|
||||
Pos=332,805
|
||||
Size=1158,364
|
||||
Collapsed=0
|
||||
DockId=0x0000001A,0
|
||||
|
||||
@ -127,6 +127,18 @@ Size=1202,364
|
||||
Collapsed=0
|
||||
DockId=0x00000019,1
|
||||
|
||||
[Window][Logger##logger]
|
||||
Pos=332,752
|
||||
Size=1158,417
|
||||
Collapsed=0
|
||||
DockId=0x0000001E,0
|
||||
|
||||
[Window][ Logger##logger]
|
||||
Pos=332,462
|
||||
Size=1158,341
|
||||
Collapsed=0
|
||||
DockId=0x00000020,0
|
||||
|
||||
[Table][0xE9E836E4,4]
|
||||
Column 0 Weight=1.2999
|
||||
Column 1 Weight=1.0439
|
||||
@ -134,34 +146,38 @@ Column 2 Weight=0.6474
|
||||
Column 3 Weight=1.0088
|
||||
|
||||
[Docking][Data]
|
||||
DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=8,50 Size=1904,1142 Split=X Selected=0xF7365A5A
|
||||
DockNode ID=0x00000013 Parent=0x14621557 SizeRef=322,1142 Split=Y Selected=0x818D04BB
|
||||
DockNode ID=0x0000001B Parent=0x00000013 SizeRef=264,456 HiddenTabBar=1 Selected=0x1D5D92B6
|
||||
DockNode ID=0x0000001C Parent=0x00000013 SizeRef=264,254 HiddenTabBar=1 Selected=0x818D04BB
|
||||
DockNode ID=0x00000014 Parent=0x14621557 SizeRef=1580,1142 Split=X
|
||||
DockNode ID=0x00000015 Parent=0x00000014 SizeRef=1202,1142 Split=X
|
||||
DockNode ID=0x00000011 Parent=0x00000015 SizeRef=265,1142 Selected=0x1D5D92B6
|
||||
DockNode ID=0x00000012 Parent=0x00000015 SizeRef=1259,1142 Split=X
|
||||
DockNode ID=0x00000009 Parent=0x00000012 SizeRef=364,1142 Split=Y Selected=0x3DC5AC3F
|
||||
DockNode ID=0x00000005 Parent=0x00000009 SizeRef=364,745 Split=Y Selected=0x3DC5AC3F
|
||||
DockNode ID=0x0000000B Parent=0x00000005 SizeRef=364,452 HiddenTabBar=1 Selected=0x3DC5AC3F
|
||||
DockNode ID=0x0000000C Parent=0x00000005 SizeRef=364,291 Selected=0xAE3C694A
|
||||
DockNode ID=0x00000006 Parent=0x00000009 SizeRef=364,395 HiddenTabBar=1 Selected=0x726D8899
|
||||
DockNode ID=0x0000000A Parent=0x00000012 SizeRef=1538,1142 Split=X
|
||||
DockNode ID=0x00000007 Parent=0x0000000A SizeRef=357,1142 Selected=0x7737E8B2
|
||||
DockNode ID=0x00000008 Parent=0x0000000A SizeRef=1545,1142 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x00000008 SizeRef=1202,1142 Split=Y Selected=0xDF0EC458
|
||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=1202,849 Split=Y Selected=0xDF0EC458
|
||||
DockNode ID=0x0000000D Parent=0x00000003 SizeRef=1202,571 Split=Y Selected=0xDFF75B3F
|
||||
DockNode ID=0x00000017 Parent=0x0000000D SizeRef=1202,776 CentralNode=1 Selected=0xDFF75B3F
|
||||
DockNode ID=0x00000018 Parent=0x0000000D SizeRef=1202,364 Split=X Selected=0x1C0788A1
|
||||
DockNode ID=0x00000019 Parent=0x00000018 SizeRef=601,364 Selected=0x1C0788A1
|
||||
DockNode ID=0x0000001A Parent=0x00000018 SizeRef=599,364 Selected=0x9B5D3198
|
||||
DockNode ID=0x0000000E Parent=0x00000003 SizeRef=1202,569 Selected=0xE98146C5
|
||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=1202,291 Selected=0x9DD4E196
|
||||
DockNode ID=0x00000002 Parent=0x00000008 SizeRef=334,1142 HiddenTabBar=1 Selected=0x36DC96AB
|
||||
DockNode ID=0x00000016 Parent=0x00000014 SizeRef=376,1142 HiddenTabBar=1 Selected=0x8D0E8380
|
||||
DockSpace ID=0xC6145A92 Pos=8,27 Size=1904,1142 Split=X
|
||||
DockNode ID=0x0000000F Parent=0xC6145A92 SizeRef=301,1142 Selected=0xA8433A03
|
||||
DockNode ID=0x00000010 Parent=0xC6145A92 SizeRef=1601,1142 CentralNode=1
|
||||
DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=8,53 Size=1904,1139 Split=X Selected=0xF7365A5A
|
||||
DockNode ID=0x00000013 Parent=0x14621557 SizeRef=322,1142 Split=Y Selected=0x818D04BB
|
||||
DockNode ID=0x0000001B Parent=0x00000013 SizeRef=264,456 HiddenTabBar=1 Selected=0x1D5D92B6
|
||||
DockNode ID=0x0000001C Parent=0x00000013 SizeRef=264,254 HiddenTabBar=1 Selected=0x818D04BB
|
||||
DockNode ID=0x00000014 Parent=0x14621557 SizeRef=1580,1142 Split=X
|
||||
DockNode ID=0x00000015 Parent=0x00000014 SizeRef=1158,1142 Split=X
|
||||
DockNode ID=0x00000011 Parent=0x00000015 SizeRef=265,1142 Selected=0x1D5D92B6
|
||||
DockNode ID=0x00000012 Parent=0x00000015 SizeRef=1259,1142 Split=X
|
||||
DockNode ID=0x00000009 Parent=0x00000012 SizeRef=364,1142 Split=Y Selected=0x3DC5AC3F
|
||||
DockNode ID=0x00000005 Parent=0x00000009 SizeRef=364,745 Split=Y Selected=0x3DC5AC3F
|
||||
DockNode ID=0x0000000B Parent=0x00000005 SizeRef=364,452 HiddenTabBar=1 Selected=0x3DC5AC3F
|
||||
DockNode ID=0x0000000C Parent=0x00000005 SizeRef=364,291 Selected=0xAE3C694A
|
||||
DockNode ID=0x00000006 Parent=0x00000009 SizeRef=364,395 HiddenTabBar=1 Selected=0x726D8899
|
||||
DockNode ID=0x0000000A Parent=0x00000012 SizeRef=1538,1142 Split=X
|
||||
DockNode ID=0x00000007 Parent=0x0000000A SizeRef=357,1142 Selected=0x7737E8B2
|
||||
DockNode ID=0x00000008 Parent=0x0000000A SizeRef=1545,1142 Split=X
|
||||
DockNode ID=0x00000001 Parent=0x00000008 SizeRef=1202,1142 Split=Y Selected=0xDF0EC458
|
||||
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=1202,849 Split=Y Selected=0xDF0EC458
|
||||
DockNode ID=0x0000000D Parent=0x00000003 SizeRef=1202,571 Split=Y Selected=0xDFF75B3F
|
||||
DockNode ID=0x00000017 Parent=0x0000000D SizeRef=1202,776 Split=Y Selected=0xDFF75B3F
|
||||
DockNode ID=0x0000001D Parent=0x00000017 SizeRef=518,720 Split=Y Selected=0xDFF75B3F
|
||||
DockNode ID=0x0000001F Parent=0x0000001D SizeRef=518,796 CentralNode=1 Selected=0xDFF75B3F
|
||||
DockNode ID=0x00000020 Parent=0x0000001D SizeRef=518,341 Selected=0x1F29F1F5
|
||||
DockNode ID=0x0000001E Parent=0x00000017 SizeRef=518,417 Selected=0xC74E1AEE
|
||||
DockNode ID=0x00000018 Parent=0x0000000D SizeRef=1202,364 Split=X Selected=0x1C0788A1
|
||||
DockNode ID=0x00000019 Parent=0x00000018 SizeRef=601,364 Selected=0x1C0788A1
|
||||
DockNode ID=0x0000001A Parent=0x00000018 SizeRef=599,364 Selected=0x9B5D3198
|
||||
DockNode ID=0x0000000E Parent=0x00000003 SizeRef=1202,569 Selected=0xE98146C5
|
||||
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=1202,291 Selected=0x9DD4E196
|
||||
DockNode ID=0x00000002 Parent=0x00000008 SizeRef=334,1142 HiddenTabBar=1 Selected=0x36DC96AB
|
||||
DockNode ID=0x00000016 Parent=0x00000014 SizeRef=420,1142 Selected=0x8D0E8380
|
||||
DockSpace ID=0xC6145A92 Pos=8,27 Size=1904,1142 Split=X
|
||||
DockNode ID=0x0000000F Parent=0xC6145A92 SizeRef=301,1142 Selected=0xA8433A03
|
||||
DockNode ID=0x00000010 Parent=0xC6145A92 SizeRef=1601,1142 CentralNode=1
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "Windows/LoggerWindow.h"
|
||||
#include "Windows/InspectorWindow.h"
|
||||
#include "Windows/SceneWindow.h"
|
||||
#include "Windows/Icons.h"
|
||||
|
||||
#include "Windows/ProfilerWindow.h"
|
||||
|
||||
@ -49,10 +50,8 @@ SceneManager g_SceneManager;
|
||||
|
||||
std::vector<std::shared_ptr<GameObject>> g_GameObjects;
|
||||
|
||||
|
||||
std::shared_ptr<CameraComponent> g_RuntimeCameraObject;
|
||||
|
||||
|
||||
int g_GPU_Triangles_drawn_to_screen = 0;
|
||||
|
||||
GameObject *g_SelectedObject; // Pointer to the currently selected object
|
||||
@ -105,10 +104,44 @@ bool MyEngine::Init(int width, int height, const std::string &title)
|
||||
(void)io;
|
||||
// Enable docking
|
||||
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable | ImGuiConfigFlags_ViewportsEnable;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Path to your font files
|
||||
const char *regularFontPath = "assets/fonts/Roboto-Medium.ttf"; // Replace with your font file path
|
||||
const char *fontAwesomePath = "assets/fonts/fa-solid-900.ttf"; // Replace with Font Awesome font path
|
||||
|
||||
float fontSize = 16.0f; // Font size for both regular font and icons
|
||||
|
||||
// Load the regular font
|
||||
ImFont *regularFont = io.Fonts->AddFontFromFileTTF(regularFontPath, fontSize);
|
||||
if (!regularFont)
|
||||
{
|
||||
fprintf(stderr, "Failed to load regular font: %s\n", regularFontPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Configure Font Awesome
|
||||
ImFontConfig fontAwesomeConfig;
|
||||
fontAwesomeConfig.MergeMode = true; // Merge into the main font
|
||||
fontAwesomeConfig.PixelSnapH = true; // Snap pixels for better alignment
|
||||
fontAwesomeConfig.GlyphOffset.y = 2.0f; // Adjust vertical alignment (tweak this value if needed)
|
||||
|
||||
// Define the glyph range for Font Awesome
|
||||
static const ImWchar fontAwesomeRanges[] = {ICON_MIN_FA, ICON_MAX_FA, 0};
|
||||
|
||||
// Load Font Awesome and merge it into the regular font
|
||||
ImFont *fontAwesomeFont = io.Fonts->AddFontFromFileTTF(fontAwesomePath, fontSize, &fontAwesomeConfig, fontAwesomeRanges);
|
||||
if (!fontAwesomeFont)
|
||||
{
|
||||
fprintf(stderr, "Failed to load Font Awesome font: %s\n", fontAwesomePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Build the fonts
|
||||
io.Fonts->Build();
|
||||
|
||||
// (Optional) Multi-viewport
|
||||
// io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable;
|
||||
@ -204,7 +237,6 @@ void MyEngine::Run()
|
||||
DEBUG_PRINT("Save path: %s", savePath.c_str());
|
||||
g_SceneManager.SaveScene(g_GameObjects, savePath);
|
||||
|
||||
|
||||
ScopedTimer LUA_INIT_timer("GameObjectsScriptInit");
|
||||
for (auto &Gameobject : g_GameObjects)
|
||||
{
|
||||
@ -212,7 +244,7 @@ void MyEngine::Run()
|
||||
// Handle Components That Require Updates
|
||||
std::shared_ptr<ScriptComponent> script = Gameobject->GetComponent<ScriptComponent>();
|
||||
if (script)
|
||||
{ // Null Checks
|
||||
{ // Null Checks
|
||||
ScopedTimer Lua_timer("GameObjectLuaCall_INIT: " + Gameobject->name); // var has to be named that or it will be redecl
|
||||
|
||||
script->Init();
|
||||
@ -241,8 +273,6 @@ void MyEngine::Run()
|
||||
for (auto &Gameobject : g_GameObjects)
|
||||
{
|
||||
|
||||
|
||||
|
||||
Gameobject->Update(frame_delta);
|
||||
}
|
||||
}
|
||||
@ -260,7 +290,7 @@ void MyEngine::Run()
|
||||
m_PerformanceWindow->Show(m_Fps, m_Ms); // FPS & ms
|
||||
m_LoggerWindow->Show(); // Logs
|
||||
m_SceneWindow->Show();
|
||||
//m_luaEditor->Show();
|
||||
// m_luaEditor->Show();
|
||||
|
||||
if (m_showProfiler)
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
#include <GL/glew.h>
|
||||
@ -71,8 +72,9 @@ AssetManager::AssetVariant AssetManager::loadAssetFromDisk(AssetType type, const
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("Failed to load shader: " + path);
|
||||
g_LoggerWindow->AddLog("Failed to load Shader", ImVec4(1.0f, 0.01f, 0.01f, 1.0f));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AssetType::MODEL:
|
||||
{
|
||||
@ -84,12 +86,15 @@ AssetManager::AssetVariant AssetManager::loadAssetFromDisk(AssetType type, const
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("Failed to load model: " + path);
|
||||
g_LoggerWindow->AddLog("Failed to load model: %s", ImVec4(1.0f, 0.01f, 0.01f, 1.0f), path.c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw std::invalid_argument("Unknown AssetType");
|
||||
g_LoggerWindow->AddLog("Unknown Asset Type", ImVec4(1.0f, 0.01f, 0.01f, 1.0f));
|
||||
break;
|
||||
}
|
||||
throw std::runtime_error("Failed to load Asset: " + path);
|
||||
}
|
||||
|
||||
std::string AssetManager::generateKey(AssetType type, const std::string &path)
|
||||
|
@ -213,19 +213,25 @@ public:
|
||||
//}
|
||||
|
||||
// 3) Not loaded yet
|
||||
AssetVariant assetData = loadAssetFromDisk(type, path);
|
||||
|
||||
if (assetData.valueless_by_exception())
|
||||
try
|
||||
{
|
||||
DEBUG_PRINT("[AssetManager] Failed to load asset: %s", path.c_str());
|
||||
return nullptr; // For smart pointers, return nullptr on failure
|
||||
AssetVariant assetData = loadAssetFromDisk(type, path);
|
||||
|
||||
if (assetData.valueless_by_exception())
|
||||
{
|
||||
DEBUG_PRINT("[AssetManager] Failed to load asset: %s", path.c_str());
|
||||
return nullptr; // For smart pointers, return nullptr on failure
|
||||
}
|
||||
m_AssetMap[key] = assetData;
|
||||
return std::get<std::shared_ptr<T>>(assetData);
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
std::cout << "Exception caught: " << e.what() << '\n';
|
||||
}
|
||||
|
||||
// 4) Store in cache
|
||||
m_AssetMap[key] = assetData;
|
||||
|
||||
// 5) Return the loaded asset
|
||||
return std::get<std::shared_ptr<T>>(assetData);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DebugAssetMap();
|
||||
|
1416
src/Windows/Icons.h
Normal file
1416
src/Windows/Icons.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -6,6 +6,8 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Icons.h"
|
||||
|
||||
extern std::vector<GameObject> g_GameObjects;
|
||||
extern GameObject *g_SelectedObject; // Pointer to the currently selected object
|
||||
extern std::shared_ptr<CameraComponent> g_RuntimeCameraObject;
|
||||
@ -21,7 +23,7 @@ void InspectorWindow::Show()
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6, 4));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(10, 10));
|
||||
|
||||
if (ImGui::Begin("Inspector##InspectorWindow"))
|
||||
if (ImGui::Begin(ICON_FA_MAGNIFYING_GLASS " Inspector##InspectorWindow"))
|
||||
{
|
||||
// Title label (white text)
|
||||
if (g_SelectedObject)
|
||||
@ -33,6 +35,8 @@ void InspectorWindow::Show()
|
||||
return;
|
||||
}
|
||||
|
||||
ImVec2 size = ImGui::GetContentRegionAvail();
|
||||
|
||||
// Display object name and component count
|
||||
ImGui::Text("Editing Object: %s", g_SelectedObject->name.c_str());
|
||||
ImGui::Text("Components: %d", g_SelectedObject->GetComponentCount());
|
||||
@ -177,7 +181,6 @@ void InspectorWindow::Show()
|
||||
// printf("%p\n", &transform);
|
||||
if (transformOpen)
|
||||
{
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
ImGui::BeginTooltip();
|
||||
@ -185,196 +188,58 @@ void InspectorWindow::Show()
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
// -----------------------------------
|
||||
// Position
|
||||
// -----------------------------------
|
||||
ImGui::TextUnformatted("Position");
|
||||
ImGui::Spacing();
|
||||
const char *axisNames[3] = {"X", "Y", "Z"};
|
||||
static const ImVec4 colX = ImVec4(1.0f, 0.4f, 0.4f, 1.0f);
|
||||
static const ImVec4 colY = ImVec4(0.4f, 1.0f, 0.4f, 1.0f);
|
||||
static const ImVec4 colZ = ImVec4(0.4f, 0.4f, 1.0f, 1.0f);
|
||||
|
||||
static const ImVec4 colXHover = ImVec4(1.0f, 0.6f, 0.6f, 1.0f);
|
||||
static const ImVec4 colYHover = ImVec4(0.6f, 1.0f, 0.6f, 1.0f);
|
||||
static const ImVec4 colZHover = ImVec4(0.6f, 0.6f, 1.0f, 1.0f);
|
||||
|
||||
static const ImVec4 colXActive = ImVec4(1.0f, 0.2f, 0.2f, 1.0f);
|
||||
static const ImVec4 colYActive = ImVec4(0.2f, 1.0f, 0.2f, 1.0f);
|
||||
static const ImVec4 colZActive = ImVec4(0.2f, 0.2f, 1.0f, 1.0f);
|
||||
|
||||
auto drawTransformRow = [&](const char *label, float *values)
|
||||
{
|
||||
// We'll assign colors for X, Y, Z buttons
|
||||
// (normal, hovered, active)
|
||||
static const ImVec4 colX = ImVec4(1.0f, 0.4f, 0.4f, 1.0f);
|
||||
static const ImVec4 colXHover = ImVec4(1.0f, 0.6f, 0.6f, 1.0f);
|
||||
static const ImVec4 colXActive = ImVec4(1.0f, 0.2f, 0.2f, 1.0f);
|
||||
ImGui::TextUnformatted(label);
|
||||
ImGui::SameLine(90); // Align labels to a fixed width
|
||||
|
||||
static const ImVec4 colY = ImVec4(0.4f, 1.0f, 0.4f, 1.0f);
|
||||
static const ImVec4 colYHover = ImVec4(0.6f, 1.0f, 0.6f, 1.0f);
|
||||
static const ImVec4 colYActive = ImVec4(0.2f, 1.0f, 0.2f, 1.0f);
|
||||
ImVec4 colors[3][3] = {
|
||||
{colX, colXHover, colXActive},
|
||||
{colY, colYHover, colYActive},
|
||||
{colZ, colZHover, colZActive}};
|
||||
|
||||
static const ImVec4 colZ = ImVec4(0.4f, 0.4f, 1.0f, 1.0f);
|
||||
static const ImVec4 colZHover = ImVec4(0.6f, 0.6f, 1.0f, 1.0f);
|
||||
static const ImVec4 colZActive = ImVec4(0.2f, 0.2f, 1.0f, 1.0f);
|
||||
|
||||
const char *axisNames[3] = {"X", "Y", "Z"};
|
||||
// We'll reference transform.position here
|
||||
float *pos = glm::value_ptr(transform->position);
|
||||
|
||||
ImGui::PushID("PositionRow");
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
// Determine color set
|
||||
ImVec4 col, colH, colA;
|
||||
if (i == 0)
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, colors[i][0]);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, colors[i][1]);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, colors[i][2]);
|
||||
std::string name = std::string(axisNames[i]) + "##" + std::string(axisNames[i]);
|
||||
if (ImGui::Button(name.c_str(), ImVec2(20, 0)))
|
||||
{
|
||||
col = colX;
|
||||
colH = colXHover;
|
||||
colA = colXActive;
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
col = colY;
|
||||
colH = colYHover;
|
||||
colA = colYActive;
|
||||
}
|
||||
else
|
||||
{
|
||||
col = colZ;
|
||||
colH = colZHover;
|
||||
colA = colZActive;
|
||||
}
|
||||
|
||||
// Push color style for button
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, col);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, colH);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, colA);
|
||||
|
||||
// Small button with the axis name
|
||||
if (ImGui::Button(axisNames[i], ImVec2(20, 0)))
|
||||
{
|
||||
// No action on click, but we have a box with color
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(3);
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(60.0f);
|
||||
ImGui::DragFloat((std::string("##Pos") + axisNames[i]).c_str(), &pos[i], 0.1f);
|
||||
|
||||
if (i < 2)
|
||||
ImGui::SameLine(0, 15);
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
|
||||
// -----------------------------------
|
||||
// Rotation
|
||||
// -----------------------------------
|
||||
ImGui::TextUnformatted("Rotation");
|
||||
ImGui::Spacing();
|
||||
|
||||
{
|
||||
// Same approach, but referencing transform.rotation
|
||||
const char *axisNames[3] = {"X", "Y", "Z"};
|
||||
float *rot = glm::value_ptr(transform->rotation);
|
||||
|
||||
// We can reuse the same color sets
|
||||
ImGui::PushID("RotationRow");
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
// Decide color sets for X, Y, Z
|
||||
ImVec4 col, colH, colA;
|
||||
if (i == 0)
|
||||
{
|
||||
col = ImVec4(1.0f, 0.4f, 0.4f, 1.0f);
|
||||
colH = ImVec4(1.0f, 0.6f, 0.6f, 1.0f);
|
||||
colA = ImVec4(1.0f, 0.2f, 0.2f, 1.0f);
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
col = ImVec4(0.4f, 1.0f, 0.4f, 1.0f);
|
||||
colH = ImVec4(0.6f, 1.0f, 0.6f, 1.0f);
|
||||
colA = ImVec4(0.2f, 1.0f, 0.2f, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
col = ImVec4(0.4f, 0.4f, 1.0f, 1.0f);
|
||||
colH = ImVec4(0.6f, 0.6f, 1.0f, 1.0f);
|
||||
colA = ImVec4(0.2f, 0.2f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, col);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, colH);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, colA);
|
||||
|
||||
if (ImGui::Button(axisNames[i], ImVec2(20, 0)))
|
||||
{
|
||||
// No action
|
||||
// No action on click
|
||||
}
|
||||
ImGui::PopStyleColor(3);
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(60.0f);
|
||||
ImGui::DragFloat((std::string("##Rot") + axisNames[i]).c_str(), &rot[i], 0.1f);
|
||||
ImGui::SetNextItemWidth(60.0f); // Adjust field width to be more compact
|
||||
ImGui::DragFloat((std::string("##") + label + axisNames[i]).c_str(), &values[i], 0.1f);
|
||||
|
||||
if (i < 2)
|
||||
ImGui::SameLine(0, 15);
|
||||
ImGui::SameLine(0, 5); // Reduce spacing between fields
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
};
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
// Position Row
|
||||
drawTransformRow("Position", glm::value_ptr(transform->position));
|
||||
|
||||
// -----------------------------------
|
||||
// Scale
|
||||
// -----------------------------------
|
||||
ImGui::TextUnformatted("Scale");
|
||||
ImGui::Spacing();
|
||||
// Rotation Row
|
||||
drawTransformRow("Rotation", glm::value_ptr(transform->rotation));
|
||||
|
||||
{
|
||||
const char *axisNames[3] = {"X", "Y", "Z"};
|
||||
float *scl = glm::value_ptr(transform->scale);
|
||||
|
||||
ImGui::PushID("ScaleRow");
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
// same color approach
|
||||
ImVec4 col, colH, colA;
|
||||
if (i == 0)
|
||||
{
|
||||
col = ImVec4(1.0f, 0.4f, 0.4f, 1.0f);
|
||||
colH = ImVec4(1.0f, 0.6f, 0.6f, 1.0f);
|
||||
colA = ImVec4(1.0f, 0.2f, 0.2f, 1.0f);
|
||||
}
|
||||
else if (i == 1)
|
||||
{
|
||||
col = ImVec4(0.4f, 1.0f, 0.4f, 1.0f);
|
||||
colH = ImVec4(0.6f, 1.0f, 0.6f, 1.0f);
|
||||
colA = ImVec4(0.2f, 1.0f, 0.2f, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
col = ImVec4(0.4f, 0.4f, 1.0f, 1.0f);
|
||||
colH = ImVec4(0.6f, 0.6f, 1.0f, 1.0f);
|
||||
colA = ImVec4(0.2f, 0.2f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, col);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, colH);
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, colA);
|
||||
|
||||
if (ImGui::Button(axisNames[i], ImVec2(20, 0)))
|
||||
{
|
||||
// No action
|
||||
}
|
||||
ImGui::PopStyleColor(3);
|
||||
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(60.0f);
|
||||
ImGui::DragFloat((std::string("##Scl") + axisNames[i]).c_str(), &scl[i], 0.1f);
|
||||
|
||||
if (i < 2)
|
||||
ImGui::SameLine(0, 15);
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::Separator();
|
||||
// Scale Row
|
||||
drawTransformRow("Scale", glm::value_ptr(transform->scale));
|
||||
}
|
||||
}
|
||||
|
||||
@ -561,73 +426,76 @@ void InspectorWindow::Show()
|
||||
}
|
||||
|
||||
// --- Submeshes Information ---
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Submeshes:");
|
||||
|
||||
// Check if the model is loaded
|
||||
if (mesh)
|
||||
ImGui::Indent();
|
||||
if (ImGui::CollapsingHeader("Submeshes", ImGuiTreeNodeFlags_None))
|
||||
{
|
||||
// Iterate through each Submesh
|
||||
for (size_t sm = 0; sm < mesh->submeshes.size(); ++sm)
|
||||
|
||||
// Check if the model is loaded
|
||||
if (mesh)
|
||||
{
|
||||
const Submesh &submesh = mesh->submeshes[sm];
|
||||
std::string header = "Submesh " + std::to_string(sm + 1) + "##Submesh" + std::to_string(sm);
|
||||
|
||||
// Create a collapsing header for each Submesh
|
||||
if (ImGui::CollapsingHeader(header.c_str(), ImGuiTreeNodeFlags_DefaultOpen))
|
||||
// Iterate through each Submesh
|
||||
for (size_t sm = 0; sm < mesh->submeshes.size(); ++sm)
|
||||
{
|
||||
// --- Submesh VAO (Read-Only) ---
|
||||
ImGui::Text("VAO: %d", static_cast<int>(submesh.vao));
|
||||
const Submesh &submesh = mesh->submeshes[sm];
|
||||
std::string header = "Submesh " + std::to_string(sm + 1) + "##Submesh" + std::to_string(sm);
|
||||
|
||||
// --- Submesh Index Count (Read-Only) ---
|
||||
ImGui::Text("Index Count: %d", static_cast<int>(submesh.indices.size()));
|
||||
|
||||
// --- Textures Associated with the Submesh ---
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Textures:");
|
||||
|
||||
// Iterate through each Texture in the Submesh
|
||||
for (size_t i = 0; i < submesh.textures.size(); ++i)
|
||||
// Create a collapsing header for each Submesh
|
||||
if (ImGui::CollapsingHeader(header.c_str(), ImGuiTreeNodeFlags_None))
|
||||
{
|
||||
const Texture &texture = submesh.textures[i];
|
||||
std::string texHeader = "Texture " + std::to_string(i + 1) + "##Submesh" + std::to_string(sm) + "_Texture" + std::to_string(i);
|
||||
// --- Submesh VAO (Read-Only) ---
|
||||
ImGui::Text("VAO: %d", static_cast<int>(submesh.vao));
|
||||
|
||||
// Create a collapsing header for each Texture
|
||||
if (ImGui::CollapsingHeader(texHeader.c_str(), ImGuiTreeNodeFlags_DefaultOpen))
|
||||
// --- Submesh Index Count (Read-Only) ---
|
||||
ImGui::Text("Index Count: %d", static_cast<int>(submesh.indices.size()));
|
||||
|
||||
// --- Textures Associated with the Submesh ---
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Textures:");
|
||||
|
||||
// Iterate through each Texture in the Submesh
|
||||
for (size_t i = 0; i < submesh.textures.size(); ++i)
|
||||
{
|
||||
// --- Texture Type (Read-Only) ---
|
||||
ImGui::Text("Type: %s", texture.type.c_str());
|
||||
const Texture &texture = submesh.textures[i];
|
||||
std::string texHeader = "Texture " + std::to_string(i + 1) + "##Submesh" + std::to_string(sm) + "_Texture" + std::to_string(i);
|
||||
|
||||
// --- Texture ID (Read-Only) ---
|
||||
ImGui::Text("Texture ID: %d", static_cast<int>(texture.id));
|
||||
|
||||
// --- Texture Path (Read-Only) ---
|
||||
ImGui::Text("Path: %s", texture.path.c_str());
|
||||
|
||||
// --- Texture Preview ---
|
||||
if (texture.id != 0)
|
||||
// Create a collapsing header for each Texture
|
||||
if (ImGui::CollapsingHeader(texHeader.c_str(), ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
// Adjust the size as needed
|
||||
ImVec2 imageSize = ImVec2(100, 100); // Example size
|
||||
ImGui::Image(static_cast<ImTextureID>(texture.id), imageSize, ImVec2(0, 0), ImVec2(1, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("No texture bound.");
|
||||
}
|
||||
// --- Texture Type (Read-Only) ---
|
||||
ImGui::Text("Type: %s", texture.type.c_str());
|
||||
|
||||
ImGui::Separator();
|
||||
// --- Texture ID (Read-Only) ---
|
||||
ImGui::Text("Texture ID: %d", static_cast<int>(texture.id));
|
||||
|
||||
// --- Texture Path (Read-Only) ---
|
||||
ImGui::Text("Path: %s", texture.path.c_str());
|
||||
|
||||
// --- Texture Preview ---
|
||||
if (texture.id != 0)
|
||||
{
|
||||
// Adjust the size as needed
|
||||
ImGui::Image(static_cast<ImTextureID>(texture.id), ImVec2(size.x, size.x), ImVec2(0, 0), ImVec2(1, 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::Text("No texture bound.");
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::Separator();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "No model loaded.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "No model loaded.");
|
||||
}
|
||||
ImGui::Unindent();
|
||||
|
||||
}
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "imgui.h"
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include "Icons.h"
|
||||
|
||||
// Helper function to format strings
|
||||
static std::string FormatString(const char* fmt, va_list args) {
|
||||
@ -33,7 +34,7 @@ void LoggerWindow::AddLog(const char* fmt, std::optional<ImVec4> color, ...) {
|
||||
}
|
||||
|
||||
void LoggerWindow::Show() {
|
||||
ImGui::Begin("Logger##logger");
|
||||
ImGui::Begin(ICON_FA_TERMINAL " Logger##logger");
|
||||
|
||||
if (ImGui::Button("Clear")) {
|
||||
m_Logs.clear();
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <iostream> // For debug statements
|
||||
#include "Icons.h"
|
||||
|
||||
// Constructor
|
||||
ProfilerWindow::ProfilerWindow()
|
||||
@ -98,7 +99,7 @@ void ProfilerWindow::Show()
|
||||
}
|
||||
|
||||
// Begin ImGui window with improved styling
|
||||
ImGui::Begin("Profiler", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_HorizontalScrollbar);
|
||||
ImGui::Begin(ICON_FA_GAUGE " Profiler", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_HorizontalScrollbar);
|
||||
|
||||
const auto &data = Profiler::Get().GetLastFrameData();
|
||||
|
||||
|
@ -24,6 +24,8 @@ extern std::vector<std::shared_ptr<GameObject>> g_GameObjects;
|
||||
#include "Engine/AssetManager.h"
|
||||
#include "Rendering/Shader.h"
|
||||
|
||||
#include "Icons.h"
|
||||
|
||||
// Extern reference to our global (or extern) asset manager
|
||||
extern AssetManager g_AssetManager;
|
||||
|
||||
@ -250,7 +252,7 @@ bool PlayPauseButton(const char *label, bool *isPlaying, ImVec2 Size)
|
||||
|
||||
void RenderWindow::Show(bool *GameRunning)
|
||||
{
|
||||
ImGui::Begin("Editor##EditorWindow");
|
||||
ImGui::Begin(ICON_FA_GAMEPAD " Editor##EditorWindow");
|
||||
|
||||
if (!m_Initialized)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user