Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions editor/editor.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
},
"InputSystem": {
"height": 991,
"height": 1009,
"inputSchemes": {
"Editor": {
"bools": [
Expand Down Expand Up @@ -91,7 +91,7 @@
},
"PhysicsSystem": {},
"UISystem": {
"height": 991,
"height": 1009,
"width": 1920
}
},
Expand Down
36 changes: 32 additions & 4 deletions editor/editor_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ bool EditorSystem::initialize(const JSON::json& systemData)
}
ImGui_ImplWin32_Init(Application::GetSingleton()->getWindow()->getWindowHandle());
ImGui_ImplDX11_Init(RenderingDevice::GetSingleton()->getDevice(), RenderingDevice::GetSingleton()->getContext());

// --- Apply layout with default values ---
ImGui::StyleColorsDark();

{
Expand Down Expand Up @@ -170,6 +172,20 @@ bool EditorSystem::initialize(const JSON::json& systemData)
colors[ImGuiCol_ModalWindowDimBg] = ImVec4(1.00f, 0.98f, 0.95f, 0.73f);
}

// --- Load json theme data ---
for (const auto& entry : std::filesystem::directory_iterator("editor/themes"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Register this into types.h too. We avoid writing down std::* around the engine. Typedef it to DirectoryIterator most likely.

{
if (entry.path().extension() == ".json")
{
std::ifstream f(entry.path());
nlohmann::json data;
f >> data;
m_ThemeDefinitions.push_back({ data.value("name", entry.path().stem().string()),
entry.path().string(),
data });
}
}

return true;
}

Expand Down Expand Up @@ -416,6 +432,18 @@ void EditorSystem::drawDefaultUI(float deltaMilliseconds)
static bool styleEditor = false;
if (ImGui::BeginMenu("View"))
{
if (ImGui::BeginMenu("Themes"))
{
for (size_t i = 0; i < m_ThemeDefinitions.size(); ++i)
{
if (ImGui::MenuItem(m_ThemeDefinitions[i].m_Name.c_str()))
{
m_ThemeDefinitions[i].apply();
}
}
ImGui::EndMenu();
}

if (ImGui::Checkbox("Wireframe Mode", &m_WireframeMode))
{
if (m_WireframeMode)
Expand Down Expand Up @@ -979,18 +1007,18 @@ int EditorSystem::exportScene(const String& sceneName, const String& sceneFilePa

for (auto& filePair : toCopy)
{
tasks.push_back(std::make_shared<Task>([=, &progress]() {
tasks.push_back(std::make_shared<Task>([=, &progress]()
{
progress++;
if (m_IsCopyFailed)
{
return;
}
m_IsCopyFailed = !OS::RelativeCopyFile(filePair.first, m_CurrExportDir + filePair.second);
}));
m_IsCopyFailed = !OS::RelativeCopyFile(filePair.first, m_CurrExportDir + filePair.second); }));
}

/// TODO: Fix the need for this dummy task (blocks the main thread while tasks are running)
tasks.push_back(std::make_shared<Task>([]() {}));
tasks.push_back(std::make_shared<Task>([]() { }));
progress++;

ThreadPool& threadPool = Application::GetSingleton()->getThreadPool();
Expand Down
4 changes: 4 additions & 0 deletions editor/editor_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#include "Tracy/Tracy.hpp"

#include "themes/theme.h"

ImColor ColorToImColor(Color& c);

class SceneDock;
Expand Down Expand Up @@ -82,6 +84,8 @@ class EditorSystem : public System
int exportScene(const String& sceneName, const String& sceneFilePath, Atomic<int>& progress);
void postExport();

Vector<ThemeDefinition> m_ThemeDefinitions;

public:
static EditorSystem* GetSingleton();

Expand Down
74 changes: 74 additions & 0 deletions editor/themes/classic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "Classic",
"style": {
"WindowPadding": [8.0, 8.0],
"WindowRounding": 0.0,
"FramePadding": [4.0, 3.0],
"FrameRounding": 0.0,
"ItemSpacing": [8.0, 4.0],
"ItemInnerSpacing": [4.0, 4.0],
"IndentSpacing": 20.0,
"ScrollbarSize": 12.0,
"ScrollbarRounding": 0.0,
"GrabMinSize": 8.0,
"GrabRounding": 0.0
},
"colors": {
"Text": [0.00, 0.00, 0.00, 1.00],
"TextDisabled": [0.50, 0.50, 0.50, 1.00],
"WindowBg": [0.82, 0.82, 0.82, 1.00],
"ChildBg": [0.85, 0.85, 0.85, 1.00],
"PopupBg": [0.90, 0.90, 0.90, 1.00],
"Border": [0.50, 0.50, 0.50, 1.00],
"BorderShadow": [0.00, 0.00, 0.00, 0.00],
"FrameBg": [0.75, 0.75, 0.75, 1.00],
"FrameBgHovered": [0.70, 0.70, 0.70, 1.00],
"FrameBgActive": [0.60, 0.60, 0.60, 1.00],
"TitleBg": [0.50, 0.50, 0.60, 1.00],
"TitleBgActive": [0.45, 0.45, 0.55, 1.00],
"TitleBgCollapsed": [0.60, 0.60, 0.70, 1.00],
"MenuBarBg": [0.75, 0.75, 0.75, 1.00],
"ScrollbarBg": [0.85, 0.85, 0.85, 1.00],
"ScrollbarGrab": [0.60, 0.60, 0.60, 1.00],
"ScrollbarGrabHovered": [0.55, 0.55, 0.55, 1.00],
"ScrollbarGrabActive": [0.50, 0.50, 0.50, 1.00],
"CheckMark": [0.00, 0.00, 0.00, 1.00],
"SliderGrab": [0.50, 0.50, 0.50, 1.00],
"SliderGrabActive": [0.30, 0.30, 0.30, 1.00],
"Button": [0.82, 0.82, 0.82, 1.00],
"ButtonHovered": [0.90, 0.90, 0.90, 1.00],
"ButtonActive": [0.65, 0.65, 0.65, 1.00],
"Header": [0.70, 0.70, 0.70, 1.00],
"HeaderHovered": [0.80, 0.80, 0.80, 1.00],
"HeaderActive": [0.60, 0.60, 0.60, 1.00],
"Separator": [0.50, 0.50, 0.50, 1.00],
"SeparatorHovered": [0.30, 0.30, 0.30, 1.00],
"SeparatorActive": [0.20, 0.20, 0.20, 1.00],
"ResizeGrip": [0.50, 0.50, 0.50, 1.00],
"ResizeGripHovered": [0.60, 0.60, 0.60, 1.00],
"ResizeGripActive": [0.40, 0.40, 0.40, 1.00],
"Tab": [0.80, 0.80, 0.85, 1.00],
"TabHovered": [0.90, 0.90, 0.95, 1.00],
"TabActive": [0.70, 0.70, 0.90, 1.00],
"TabUnfocused": [0.85, 0.85, 0.85, 1.00],
"TabUnfocusedActive": [0.80, 0.80, 0.90, 1.00],
"DockingPreview": [0.20, 0.40, 0.70, 0.70],
"DockingEmptyBg": [0.90, 0.90, 0.90, 1.00],
"PlotLines": [0.20, 0.20, 0.20, 1.00],
"PlotLinesHovered": [0.00, 0.00, 0.00, 1.00],
"PlotHistogram": [0.25, 0.25, 0.25, 1.00],
"PlotHistogramHovered": [0.00, 0.00, 0.00, 1.00],
"TableHeaderBg": [0.80, 0.80, 0.80, 1.00],
"TableBorderStrong": [0.50, 0.50, 0.50, 1.00],
"TableBorderLight": [0.75, 0.75, 0.75, 1.00],
"TableRowBg": [1.00, 1.00, 1.00, 0.00],
"TableRowBgAlt": [0.90, 0.90, 0.90, 0.30],
"TextSelectedBg": [0.50, 0.50, 1.00, 0.35],
"DragDropTarget": [0.00, 0.00, 1.00, 0.90],
"NavHighlight": [0.00, 0.00, 1.00, 1.00],
"NavWindowingHighlight": [0.25, 0.25, 0.25, 0.70],
"NavWindowingDimBg": [0.80, 0.80, 0.80, 0.20],
"ModalWindowDimBg": [0.90, 0.90, 0.90, 0.60]
}
}

74 changes: 74 additions & 0 deletions editor/themes/dark.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "Dark",
"style": {
"WindowPadding": [15.0, 15.0],
"WindowRounding": 5.0,
"FramePadding": [5.0, 5.0],
"FrameRounding": 4.0,
"ItemSpacing": [12.0, 6.0],
"ItemInnerSpacing": [8.0, 4.0],
"IndentSpacing": 25.0,
"ScrollbarSize": 15.0,
"ScrollbarRounding": 9.0,
"GrabMinSize": 5.0,
"GrabRounding": 3.0
},
"colors": {
"Text": [0.80, 0.80, 0.83, 1.00],
"TextDisabled": [0.24, 0.23, 0.29, 1.00],
"WindowBg": [0.05, 0.05, 0.07, 1.00],
"ChildBg": [0.07, 0.07, 0.09, 1.00],
"PopupBg": [0.14, 0.14, 0.14, 1.00],
"Border": [0.23, 0.23, 0.23, 1.00],
"BorderShadow": [0.68, 0.63, 0.63, 1.00],
"FrameBg": [0.10, 0.09, 0.12, 1.00],
"FrameBgHovered": [0.24, 0.23, 0.29, 1.00],
"FrameBgActive": [0.56, 0.56, 0.58, 1.00],
"TitleBg": [0.10, 0.09, 0.12, 1.00],
"TitleBgActive": [0.07, 0.07, 0.09, 1.00],
"TitleBgCollapsed": [1.00, 0.98, 0.95, 0.75],
"MenuBarBg": [0.10, 0.09, 0.12, 1.00],
"ScrollbarBg": [0.10, 0.09, 0.12, 1.00],
"ScrollbarGrab": [0.80, 0.80, 0.83, 0.31],
"ScrollbarGrabHovered": [0.56, 0.56, 0.58, 1.00],
"ScrollbarGrabActive": [0.06, 0.05, 0.07, 1.00],
"CheckMark": [0.20, 0.68, 0.42, 0.83],
"SliderGrab": [0.80, 0.80, 0.83, 0.31],
"SliderGrabActive": [0.06, 0.05, 0.07, 1.00],
"Button": [0.12, 0.43, 0.33, 0.88],
"ButtonHovered": [0.20, 0.68, 0.42, 0.83],
"ButtonActive": [0.56, 0.56, 0.58, 1.00],
"Header": [0.20, 0.68, 0.42, 0.58],
"HeaderHovered": [0.20, 0.68, 0.42, 0.83],
"HeaderActive": [0.06, 0.05, 0.07, 1.00],
"Separator": [0.43, 0.43, 0.50, 0.50],
"SeparatorHovered": [0.20, 0.68, 0.42, 0.83],
"SeparatorActive": [0.36, 0.75, 0.10, 1.00],
"ResizeGrip": [0.00, 0.00, 0.00, 0.00],
"ResizeGripHovered": [0.56, 0.56, 0.58, 1.00],
"ResizeGripActive": [0.06, 0.05, 0.07, 1.00],
"Tab": [0.18, 0.57, 0.58, 0.86],
"TabHovered": [0.20, 0.68, 0.42, 0.83],
"TabActive": [0.20, 0.68, 0.42, 1.00],
"TabUnfocused": [0.14, 0.41, 0.42, 0.46],
"TabUnfocusedActive": [0.14, 0.41, 0.42, 1.00],
"DockingPreview": [0.00, 1.00, 0.21, 0.70],
"DockingEmptyBg": [0.20, 0.20, 0.20, 1.00],
"PlotLines": [0.40, 0.39, 0.38, 0.63],
"PlotLinesHovered": [0.25, 1.00, 0.00, 1.00],
"PlotHistogram": [0.40, 0.39, 0.38, 0.63],
"PlotHistogramHovered": [0.25, 1.00, 0.00, 1.00],
"TableHeaderBg": [0.19, 0.19, 0.20, 1.00],
"TableBorderStrong": [0.31, 0.31, 0.35, 1.00],
"TableBorderLight": [0.23, 0.23, 0.25, 1.00],
"TableRowBg": [0.00, 0.00, 0.00, 0.00],
"TableRowBgAlt": [1.00, 1.00, 1.00, 0.06],
"TextSelectedBg": [0.25, 1.00, 0.00, 0.48],
"DragDropTarget": [1.00, 1.00, 0.00, 0.90],
"NavHighlight": [1.00, 1.00, 1.00, 1.00],
"NavWindowingHighlight": [1.00, 1.00, 1.00, 0.70],
"NavWindowingDimBg": [0.80, 0.80, 0.80, 0.20],
"ModalWindowDimBg": [1.00, 0.98, 0.95, 0.73]
}
}

74 changes: 74 additions & 0 deletions editor/themes/light.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "Light",
"style": {
"WindowPadding": [15.0, 15.0],
"WindowRounding": 5.0,
"FramePadding": [5.0, 5.0],
"FrameRounding": 4.0,
"ItemSpacing": [12.0, 6.0],
"ItemInnerSpacing": [8.0, 4.0],
"IndentSpacing": 25.0,
"ScrollbarSize": 15.0,
"ScrollbarRounding": 9.0,
"GrabMinSize": 5.0,
"GrabRounding": 3.0
},
"colors": {
"Text": [0.10, 0.10, 0.10, 1.00],
"TextDisabled": [0.50, 0.50, 0.50, 1.00],
"WindowBg": [0.95, 0.96, 0.98, 1.00],
"ChildBg": [0.98, 0.98, 0.98, 1.00],
"PopupBg": [0.94, 0.94, 0.94, 1.00],
"Border": [0.70, 0.70, 0.70, 0.50],
"BorderShadow": [0.00, 0.00, 0.00, 0.00],
"FrameBg": [0.90, 0.90, 0.90, 1.00],
"FrameBgHovered": [0.75, 0.75, 0.75, 1.00],
"FrameBgActive": [0.65, 0.65, 0.65, 1.00],
"TitleBg": [0.86, 0.86, 0.90, 1.00],
"TitleBgActive": [0.75, 0.75, 0.80, 1.00],
"TitleBgCollapsed": [0.95, 0.95, 0.95, 0.50],
"MenuBarBg": [0.92, 0.92, 0.95, 1.00],
"ScrollbarBg": [0.95, 0.95, 0.96, 1.00],
"ScrollbarGrab": [0.75, 0.75, 0.80, 0.60],
"ScrollbarGrabHovered": [0.65, 0.65, 0.70, 0.80],
"ScrollbarGrabActive": [0.60, 0.60, 0.65, 1.00],
"CheckMark": [0.25, 0.50, 0.75, 1.00],
"SliderGrab": [0.60, 0.60, 0.70, 0.50],
"SliderGrabActive": [0.25, 0.50, 0.75, 1.00],
"Button": [0.75, 0.75, 0.85, 1.00],
"ButtonHovered": [0.85, 0.85, 0.95, 1.00],
"ButtonActive": [0.65, 0.65, 0.90, 1.00],
"Header": [0.80, 0.80, 0.90, 1.00],
"HeaderHovered": [0.85, 0.85, 0.95, 1.00],
"HeaderActive": [0.65, 0.65, 0.85, 1.00],
"Separator": [0.60, 0.60, 0.70, 1.00],
"SeparatorHovered": [0.30, 0.60, 0.90, 1.00],
"SeparatorActive": [0.10, 0.50, 0.80, 1.00],
"ResizeGrip": [0.90, 0.90, 0.90, 0.30],
"ResizeGripHovered": [0.60, 0.60, 0.70, 0.60],
"ResizeGripActive": [0.30, 0.60, 0.90, 1.00],
"Tab": [0.80, 0.80, 0.85, 1.00],
"TabHovered": [0.90, 0.90, 0.95, 1.00],
"TabActive": [0.70, 0.70, 0.90, 1.00],
"TabUnfocused": [0.92, 0.92, 0.92, 0.90],
"TabUnfocusedActive": [0.75, 0.75, 0.85, 1.00],
"DockingPreview": [0.30, 0.60, 0.90, 0.70],
"DockingEmptyBg": [0.94, 0.94, 0.94, 1.00],
"PlotLines": [0.35, 0.35, 0.35, 1.00],
"PlotLinesHovered": [0.25, 0.50, 0.75, 1.00],
"PlotHistogram": [0.30, 0.45, 0.60, 1.00],
"PlotHistogramHovered": [0.25, 0.50, 0.75, 1.00],
"TableHeaderBg": [0.85, 0.85, 0.90, 1.00],
"TableBorderStrong": [0.70, 0.70, 0.75, 1.00],
"TableBorderLight": [0.85, 0.85, 0.90, 1.00],
"TableRowBg": [1.00, 1.00, 1.00, 0.00],
"TableRowBgAlt": [0.95, 0.95, 0.95, 0.30],
"TextSelectedBg": [0.30, 0.60, 0.90, 0.50],
"DragDropTarget": [0.00, 0.60, 1.00, 0.90],
"NavHighlight": [0.30, 0.60, 0.90, 1.00],
"NavWindowingHighlight": [0.30, 0.60, 0.90, 0.70],
"NavWindowingDimBg": [0.80, 0.80, 0.80, 0.20],
"ModalWindowDimBg": [0.90, 0.90, 0.90, 0.60]
}
}

Loading