MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / Context

Method Context

Sources/OvEditor/src/OvEditor/Core/Context.cpp:68–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68OvEditor::Core::Context::Context(const std::filesystem::path& p_projectFolder) :
69 projectFolder(p_projectFolder),
70 projectFile(Utils::ProjectManagement::GetProjectFile(p_projectFolder)),
71 engineAssetsPath(std::filesystem::current_path() / "Data" / "Engine"),
72 projectAssetsPath(projectFolder / "Assets"),
73 projectScriptsPath(projectFolder / "Scripts"),
74 editorAssetsPath(std::filesystem::current_path() / "Data" / "Editor"),
75 sceneManager(projectAssetsPath.string()),
76 projectSettings(projectFile.string())
77{
78 if (!IsProjectSettingsIntegrityVerified())
79 {
80 ResetProjectSettings();
81 projectSettings.Rewrite();
82 }
83
84 ModelManager::ProvideAssetPaths(projectAssetsPath, engineAssetsPath);
85 TextureManager::ProvideAssetPaths(projectAssetsPath, engineAssetsPath);
86 ShaderManager::ProvideAssetPaths(projectAssetsPath, engineAssetsPath);
87 MaterialManager::ProvideAssetPaths(projectAssetsPath, engineAssetsPath);
88 SoundManager::ProvideAssetPaths(projectAssetsPath, engineAssetsPath);
89
90 /* Settings */
91 OvWindowing::Settings::DeviceSettings deviceSettings;
92 deviceSettings.contextMajorVersion = 4;
93 deviceSettings.contextMinorVersion = 5;
94
95 /* Window creation */
96 device = std::make_unique<OvWindowing::Context::Device>(deviceSettings);
97 const auto workAreaSize = device->GetWorkAreaSize();
98 const auto bestFitWindowSizeAndPosition = FindBestFitWindowSizeAndPosition(workAreaSize);
99 windowSettings.title = "Overload";
100 windowSettings.x = bestFitWindowSizeAndPosition[0];
101 windowSettings.y = bestFitWindowSizeAndPosition[1];
102 windowSettings.width = bestFitWindowSizeAndPosition[2];
103 windowSettings.height = bestFitWindowSizeAndPosition[3];
104 window = std::make_unique<OvWindowing::Window>(*device, windowSettings);
105 std::vector<uint64_t> iconRaw = { 0,0,144115188614240000ULL,7500771567664627712ULL,7860776967494637312ULL,0,0,0,0,7212820467466371072ULL,11247766461832697600ULL,14274185407633888512ULL,12905091124788992000ULL,5626708973701824512ULL,514575842263176960,0,0,6564302121125019648ULL,18381468271671515136ULL,18381468271654737920ULL,18237353083595659264ULL,18165295488836311040ULL,6708138037527189504ULL,0,4186681893338480640ULL,7932834557741046016ULL,17876782538917681152ULL,11319824055216379904ULL,15210934132358518784ULL,18381468271520454400ULL,1085667680982603520ULL,0,18093237891929479168ULL,18309410677600032768ULL,11391881649237530624ULL,7932834561381570304ULL,17300321784231761408ULL,15210934132375296000ULL,8293405106311272448ULL,2961143145139082752ULL,16507969723533236736ULL,17516777143216379904ULL,10671305705855129600ULL,7356091234422036224ULL,16580027318695106560ULL,2240567205413984000ULL,18381468271470188544ULL,10959253511276599296ULL,4330520004484136960ULL,10815138323200743424ULL,11607771853338181632ULL,8364614976649238272ULL,17444719546862998784ULL,2669156352,18381468269893064448ULL,6419342512197474304ULL,11103650170688640000ULL,6492244531366860800ULL,14346241902646925312ULL,13841557270159628032ULL,7428148827772098304ULL,3464698581331941120ULL,18381468268953606144ULL,1645680384,18381468271554008832ULL,7140201027266418688ULL,5987558797656659712ULL,17588834734687262208ULL,7284033640602212096ULL,14273902834169157632ULL,18381468269087692288ULL,6852253225049397248ULL,17732667349600245504ULL,16291515470083266560ULL,10022503688432981760ULL,11968059825861367552ULL,9733991836700645376ULL,14850363587428816640ULL,18381468271168132864ULL,16147400282007410688ULL,656430432014827520,18381468270950094848ULL,15715054717226194944ULL,72057596690306560,11823944635485519872ULL,15859169905251653376ULL,17084149004500473856ULL,8581352906816952064ULL,2527949855582584832ULL,18381468271419856896ULL,8581352907253225472ULL,252776704,1376441223417430016ULL,14994761349590357760ULL,10527190521537370112ULL,0,9806614576878321664ULL,18381468271671515136ULL,17156206598538401792ULL,6059619689256392448ULL,10166619973990488064ULL,18381468271403079424ULL,17444719549178451968ULL,420746240,870625192710242304,4906133035823863552ULL,18381468269289150464ULL,18381468271671515136ULL,18381468271671515136ULL,9950729769032620032ULL,14778305994951169792ULL,269422336,0,0,18381468268785833984ULL,8941923452686178304ULL,18381468270950094848ULL,3440842496,1233456333565402880ULL,0,0,0,11823944636091210240ULL,2383877888,16724143605745719296ULL,2316834816,0,0 };
106 window->SetIconFromMemory(reinterpret_cast<uint8_t*>(iconRaw.data()), 16, 16);
107 inputManager = std::make_unique<OvWindowing::Inputs::InputManager>(*window);
108 window->MakeCurrentContext();
109 device->SetVsync(true);
110
111 /* Graphics context creation */
112 driver = std::make_unique<OvRendering::Context::Driver>(OvRendering::Settings::DriverSettings{ true });
113 textureRegistry = std::make_unique<OvEditor::Utils::TextureRegistry>();
114
115 std::filesystem::create_directories(Utils::FileSystem::kEditorDataPath);
116
117 uiManager = std::make_unique<OvUI::Core::UIManager>(window->GetGlfwWindow(),
118 static_cast<OvUI::Styling::EStyle>(OvEditor::Settings::EditorSettings::ColorTheme.Get())
119 );
120
121 const auto fontPath = editorAssetsPath / "Fonts" / "Ruda-Bold.ttf";
122
123 if (!std::filesystem::exists(OvEditor::Utils::FileSystem::kLayoutFilePath))
124 {
125 const auto defaultLayoutPath = std::filesystem::current_path() / "Config" / "layout.ini";

Callers

nothing calls this directly

Calls 15

GetProjectFileFunction · 0.85
GetFontIDFunction · 0.85
RewriteMethod · 0.80
GetWorkAreaSizeMethod · 0.80
SetIconFromMemoryMethod · 0.80
MakeCurrentContextMethod · 0.80
SetVsyncMethod · 0.80
GetGlfwWindowMethod · 0.80
LoadFontMethod · 0.80
UseFontMethod · 0.80

Tested by

no test coverage detected