SpiecsEngine
 
Loading...
Searching...
No Matches
SlateStyleLayout.cpp
Go to the documentation of this file.
1/**
2* @file SlateStyleLayout.cpp.
3* @brief The SlateStyleLayout Class Implementation.
4* @author Spices.
5*/
6
7#include "Pchheader.h"
9#include "Imgui/ImguiHelper.h"
10#include "Core/Library/FileLibrary.h"
11#include "Render/Vulkan/VulkanRenderBackend.h"
12#include "..\Core\Thread\ThreadModel.h"
13
14namespace Spices {
15
16 std::shared_ptr<SlateStyleLayout> SlateStyleLayout::m_Layout = nullptr;
17
19 {
21
22 if (!m_Layout)
23 {
24 m_Layout = std::make_shared<SlateStyleLayout>();
25 }
26
27 return m_Layout;
28 }
29
31 {
33
34 switch (layout)
35 {
37 {
38 std::stringstream ss;
39 ss << SPICES_ENGINE_ASSETS_PATH << "SlateLayout/DefaultLayout.ini";
40 ImGui::LoadIniSettingsFromDisk(ss.str().c_str());
41 }
42 default:
43 {
44 std::stringstream ss;
45 ss << SPICES_ENGINE_ASSETS_PATH << "SlateLayout/DefaultLayout.ini";
46 ImGui::LoadIniSettingsFromDisk(ss.str().c_str());
47 }
48 }
49 }
50
52 {
54
55 std::string filepath = FileLibrary::FileLibrary_OpenInExplore(
56 "Slate Layout (*.ini)\0*.ini\0",
57 glfwGetWin32Window((GLFWwindow*)VulkanRenderBackend::GetState().m_Windows)
58 );
59
60 if (!filepath.empty())
61 {
62 AsyncTask(ThreadPoolEnum::Game, [=]() {
63 ImGui::LoadIniSettingsFromDisk(filepath.c_str());
64 });
65 }
66 }
67
69 {
71
72 std::string filepath = FileLibrary::FileLibrary_SaveInExplore(
73 "Slate Layout (*.ini)\0*.ini\0",
74 glfwGetWin32Window((GLFWwindow*)VulkanRenderBackend::GetState().m_Windows)
75 );
76
77 filepath.append(".ini");
78
79 if (!filepath.empty())
80 {
81 AsyncTask(ThreadPoolEnum::Game, [=]() {
82 ImGui::SaveIniSettingsToDisk(filepath.c_str());
83 });
84 }
85 }
86
88 {
90
91 std::stringstream ss;
92
93 ss << "saved/SlateCache/";
94 std::filesystem::create_directory(ss.str());
95
96 ss << "CacheLayout.ini";
97 ImGui::SaveIniSettingsToDisk(ss.str().c_str());
98 }
99
101 {
103
104 std::stringstream ss;
105 ss << "saved/SlateCache/CacheLayout.ini";
106
107 ImGui::LoadIniSettingsFromDisk(ss.str().c_str());
108 }
109
111 {
113
114 std::stringstream ss;
115
116 ss << "saved/SlateCache/";
117 std::filesystem::create_directory(ss.str());
118
119 ss << "QuickLayout.ini";
120 ImGui::SaveIniSettingsToDisk(ss.str().c_str());
121 }
122
124 {
126
127 std::stringstream ss;
128 ss << "saved/SlateCache/QuickLayout.ini";
129
130 ImGui::LoadIniSettingsFromDisk(ss.str().c_str());
131 }
132}
#define SPICES_PROFILE_ZONE
void SetLayout(StyleLayoutEnum layout)
Set Slate Layout.
void QuickStoreLayout()
Quick Store Slate Layout to disk.
void StoreLayout()
Store Slate Layout to disk.
static std::shared_ptr< SlateStyleLayout > m_Layout
SlateStyleLayout single instance.
void QuickLoadLayout()
Quick Load Slate Layout to disk.
void StoreLayoutCache()
Store Slate Layout Cache.
static std::shared_ptr< SlateStyleLayout > Get()
Get this single instance.
void LoadLayout()
Load Slate Layout in disk.
void LoadLayoutCache()
Load Slate Layout Cache.
Wrappers of Slate StyleLayout Functions.
StyleLayoutEnum
Enum of Slate StyleLayout.