Skip to content

Commit dab7351

Browse files
committed
xrECore: work in progress
This is a test and maybe everything will be made in a different way
1 parent 56e829e commit dab7351

File tree

3 files changed

+84
-27
lines changed

3 files changed

+84
-27
lines changed

src/editors/xrECore/Windows/WindowIDE.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public ref class WindowIDE : public System::Windows::Forms::Form
3333
Initialize();
3434
}
3535

36+
WindowView% View() { return *windowView; }
37+
WindowLog% Log() { return *windowLog; }
38+
3639
protected:
3740
~WindowIDE()
3841
{

src/editors/xrEditor/entry_point.cpp

Lines changed: 73 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,97 @@
11
#include "pch.hpp"
22
#include "editors/xrECore/Core/ELog.h"
3+
#include "xrCore/Threading/Event.hpp"
4+
#include "xrEngine/main.h"
5+
#include "xrEngine/device.h"
6+
#include "xrEngine/XR_IOConsole.h"
7+
#include "xrEngine/xr_ioc_cmd.h"
8+
39

410
using namespace XRay;
511
using namespace XRay::Editor;
612
using namespace XRay::Editor::Controls;
713
using namespace XRay::Editor::Windows;
814

9-
int entry_point(pcstr commandLine)
15+
Event UICreated;
16+
Event UIThreadExit;
17+
Event ReadyToShowUI;
18+
[System::STAThread]
19+
void UIThreadProc(void*)
1020
{
1121
System::Windows::Forms::Application::EnableVisualStyles();
22+
23+
auto windowIDE = gcnew WindowIDE();
24+
25+
Core.Initialize("OpenXRayEditor", LogCallback(ELogCallback, windowIDE->Log().Handle.ToPointer()), true);
26+
27+
#ifdef XR_X64
28+
Device.m_hWnd = (HWND)windowIDE->View().GetViewHandle().ToInt64();
29+
#else
30+
Device.m_hWnd = (HWND)windowIDE->View().GetViewHandle().ToInt32();
31+
#endif
32+
VERIFY(Device.m_hWnd != INVALID_HANDLE_VALUE);
33+
34+
UICreated.Set();
35+
ReadyToShowUI.Wait();
36+
System::Windows::Forms::Application::Run(windowIDE);
37+
UIThreadExit.Set();
38+
}
39+
40+
int entry_point(pcstr commandLine)
41+
{
1242
auto splash = gcnew WindowSplash();
1343
splash->Show();
1444

1545
splash->SetStatus("Loading xrDebug...");
1646
xrDebug::Initialize(false);
1747

1848
splash->SetStatus("Loading Core...");
19-
Core.Initialize("OpenXRayEditor", nullptr, true);
49+
thread_spawn(UIThreadProc, "OpenXRay Editor UI Thread", 0, nullptr);
50+
51+
UICreated.Wait();
52+
ReadyToShowUI.Set();
53+
54+
RunApplication();
55+
// splash->SetStatus("Loading Settings...");
56+
// InitSettings();
57+
// // Adjust player & computer name for Asian
58+
// if (pSettings->line_exist("string_table", "no_native_input"))
59+
// {
60+
// xr_strcpy(Core.UserName, sizeof(Core.UserName), "Player");
61+
// xr_strcpy(Core.CompName, sizeof(Core.CompName), "Computer");
62+
// }
63+
//
64+
// FPU::m24r();
65+
//
66+
// splash->SetStatus("Loading Engine...");
67+
// InitEngine();
68+
//
69+
// splash->SetStatus("Loading Input...");
70+
// InitInput();
71+
//
72+
// splash->SetStatus("Loading Console...");
73+
// InitConsole();
74+
//
75+
// splash->SetStatus("Creating Renderer List...");
76+
// Engine.External.CreateRendererList();
77+
//
78+
// CCC_LoadCFG_custom cmd("renderer ");
79+
// cmd.Execute(Console->ConfigFile);
80+
81+
splash->SetStatus("Loading Engine API...");
82+
//Engine.External.Initialize();
83+
84+
splash->SetStatus("Loading Device...");
85+
//Device.Initialize();
86+
//Device.Create();
2087

2188
splash->SetStatus("Loading finished.");
89+
//ReadyToShowUI.Set();
2290
splash->Close();
2391

24-
auto windowMain = gcnew WindowIDE();
25-
System::Windows::Forms::Application::Run(windowMain);
92+
//Startup();
93+
UIThreadExit.Wait();
94+
2695
Core._destroy();
2796
return 0;
2897
}
@@ -34,7 +103,6 @@ int StackoverflowFilter(const int exceptionCode)
34103
return EXCEPTION_CONTINUE_SEARCH;
35104
}
36105

37-
[System::STAThread]
38106
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int)
39107
{
40108
int result = 0;

src/editors/xrEditor/xrEditor.vcxproj

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,30 +57,10 @@
5757
<ClCompile>
5858
<ConformanceMode>true</ConformanceMode>
5959
<PrecompiledHeaderFile>pch.hpp</PrecompiledHeaderFile>
60-
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
61-
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Mixed|Win32'">/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
62-
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
63-
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
64-
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Mixed|x64'">/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
65-
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
60+
<AdditionalOptions>/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
6661
</ClCompile>
6762
<Link>
68-
<SubSystem Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Windows</SubSystem>
69-
</Link>
70-
<Link>
71-
<SubSystem Condition="'$(Configuration)|$(Platform)'=='Mixed|Win32'">Windows</SubSystem>
72-
</Link>
73-
<Link>
74-
<SubSystem Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Windows</SubSystem>
75-
</Link>
76-
<Link>
77-
<SubSystem Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Windows</SubSystem>
78-
</Link>
79-
<Link>
80-
<SubSystem Condition="'$(Configuration)|$(Platform)'=='Mixed|x64'">Windows</SubSystem>
81-
</Link>
82-
<Link>
83-
<SubSystem Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Windows</SubSystem>
63+
<AdditionalDependencies>xrECore.lib;%(AdditionalDependencies)</AdditionalDependencies>
8464
</Link>
8565
</ItemDefinitionGroup>
8666
<ItemGroup>
@@ -96,6 +76,9 @@
9676
<ProjectReference Include="..\..\xrCore\xrCore.vcxproj">
9777
<Project>{a0f7d1fb-59a7-4717-a7e4-96f37e91998e}</Project>
9878
</ProjectReference>
79+
<ProjectReference Include="..\..\xrEngine\xrEngine.vcxproj">
80+
<Project>{2578c6d8-660d-48ae-9322-7422f8664f06}</Project>
81+
</ProjectReference>
9982
<ProjectReference Include="..\xrECore\xrECore.vcxproj">
10083
<Project>{87d068ec-1789-4f09-a9ec-54cf276955e0}</Project>
10184
</ProjectReference>
@@ -109,6 +92,9 @@
10992
<Reference Include="System.Drawing" />
11093
<Reference Include="System.Windows.Forms" />
11194
<Reference Include="System.Xml" />
95+
<Reference Include="WeifenLuo.WinFormsUI.Docking">
96+
<HintPath>..\..\..\sdk\binaries\WeifenLuo.WinFormsUI.Docking.dll</HintPath>
97+
</Reference>
11298
<Reference Include="WindowsBase" />
11399
</ItemGroup>
114100
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

0 commit comments

Comments
 (0)