Skip to content

Commit 95e886f

Browse files
author
Pavel Kovalenko
committed
Add xrManagedApi library project and initial xrCore API.
1 parent eb293db commit 95e886f

File tree

8 files changed

+279
-0
lines changed

8 files changed

+279
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#include "Pch.hpp"
2+
3+
using namespace System;
4+
using namespace System::Reflection;
5+
using namespace System::Runtime::CompilerServices;
6+
using namespace System::Runtime::InteropServices;
7+
using namespace System::Security::Permissions;
8+
9+
//
10+
// General Information about an assembly is controlled through the following
11+
// set of attributes. Change these attribute values to modify the information
12+
// associated with an assembly.
13+
//
14+
[assembly:AssemblyTitleAttribute(L"xrManagedApi")];
15+
[assembly:AssemblyDescriptionAttribute(L"")];
16+
[assembly:AssemblyConfigurationAttribute(L"")];
17+
[assembly:AssemblyCompanyAttribute(L"")];
18+
[assembly:AssemblyProductAttribute(L"xrManagedApi")];
19+
[assembly:AssemblyCopyrightAttribute(L"Copyright (c) GSC Game World 2014")];
20+
[assembly:AssemblyTrademarkAttribute(L"")];
21+
[assembly:AssemblyCultureAttribute(L"")];
22+
23+
//
24+
// Version information for an assembly consists of the following four values:
25+
//
26+
// Major Version
27+
// Minor Version
28+
// Build Number
29+
// Revision
30+
//
31+
// You can specify all the value or you can default the Revision and Build Numbers
32+
// by using the '*' as shown below:
33+
34+
[assembly:AssemblyVersionAttribute("1.0.*")];
35+
36+
[assembly:ComVisible(false)];
37+
38+
[assembly:CLSCompliantAttribute(true)];

src/editors/xrManagedApi/Pch.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "Pch.hpp"

src/editors/xrManagedApi/Pch.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#pragma once
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#include "Pch.hpp"
2+
#include "Core.hpp"
3+
#include "xrCore/xrCore.h"
4+
#include <msclr/marshal_cppstd.h>
5+
6+
namespace XRay
7+
{
8+
namespace ManagedApi
9+
{
10+
11+
Core::Core() { }
12+
13+
static void LogCallbackWrapper(const char* msg)
14+
{
15+
if (!Core::ManagedLogCallback)
16+
return;
17+
String^ tmpMsg = msg ? gcnew String(msg) : nullptr;
18+
Core::ManagedLogCallback(tmpMsg);
19+
}
20+
21+
void Core::Initialize(String^ appName, LogCallback^ logCallback, bool initFs, String^ fsFileName)
22+
{
23+
ManagedLogCallback = logCallback;
24+
std::string appNameC = msclr::interop::marshal_as<std::string>(appName);
25+
if (fsFileName)
26+
{
27+
std::string fsFileNameC = msclr::interop::marshal_as<std::string>(fsFileName);
28+
::Core._initialize(appNameC.c_str(), LogCallbackWrapper, initFs, fsFileNameC.c_str());
29+
}
30+
else
31+
::Core._initialize(appNameC.c_str(), LogCallbackWrapper, initFs, nullptr);
32+
}
33+
34+
void Core::Initialize(String^ appName, LogCallback^ logCallback, bool initFs)
35+
{
36+
Core::Initialize(appName, logCallback, initFs, nullptr);
37+
}
38+
39+
void Core::Initialize(String^ appName, LogCallback^ logCallback)
40+
{
41+
Core::Initialize(appName, logCallback, false, nullptr);
42+
}
43+
44+
void Core::Initialize(String^ appName)
45+
{
46+
Core::Initialize(appName, nullptr, false, nullptr);
47+
}
48+
49+
void Core::Destroy()
50+
{
51+
::Core._destroy();
52+
}
53+
54+
}
55+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#pragma once
2+
3+
using namespace System;
4+
5+
namespace XRay
6+
{
7+
namespace ManagedApi
8+
{
9+
public ref class Core
10+
{
11+
public:
12+
delegate void LogCallback(String^ str);
13+
internal:
14+
static LogCallback^ ManagedLogCallback;
15+
private:
16+
Core();
17+
public:
18+
static void Initialize(String^ appName, LogCallback^ logCallback, bool initFs, String^ fsFileName);
19+
static void Initialize(String^ appName, LogCallback^ logCallback, bool initFs);
20+
static void Initialize(String^ appName, LogCallback^ logCallback);
21+
static void Initialize(String^ appName);
22+
static void Destroy();
23+
};
24+
}
25+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
</ItemGroup>
13+
<PropertyGroup Label="Globals">
14+
<ProjectGuid>{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}</ProjectGuid>
15+
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
16+
<Keyword>ManagedCProj</Keyword>
17+
<RootNamespace>xrManagedApi</RootNamespace>
18+
</PropertyGroup>
19+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
20+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
21+
<ConfigurationType>DynamicLibrary</ConfigurationType>
22+
<UseDebugLibraries>true</UseDebugLibraries>
23+
<PlatformToolset>v120</PlatformToolset>
24+
<CLRSupport>true</CLRSupport>
25+
<CharacterSet>Unicode</CharacterSet>
26+
</PropertyGroup>
27+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
28+
<ConfigurationType>DynamicLibrary</ConfigurationType>
29+
<UseDebugLibraries>false</UseDebugLibraries>
30+
<PlatformToolset>v120</PlatformToolset>
31+
<CLRSupport>true</CLRSupport>
32+
<CharacterSet>Unicode</CharacterSet>
33+
</PropertyGroup>
34+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
35+
<ImportGroup Label="ExtensionSettings">
36+
</ImportGroup>
37+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
38+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
39+
<Import Project="$(SolutionDir)Common.props" />
40+
</ImportGroup>
41+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
42+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
43+
<Import Project="$(SolutionDir)Common.props" />
44+
</ImportGroup>
45+
<PropertyGroup Label="UserMacros" />
46+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
47+
<OutDir>$(xrBinDir)</OutDir>
48+
<IntDir>$(xrIntDir)$(ProjectName)\</IntDir>
49+
<LinkIncremental>true</LinkIncremental>
50+
</PropertyGroup>
51+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
52+
<OutDir>$(xrBinDir)</OutDir>
53+
<IntDir>$(xrIntDir)$(ProjectName)\</IntDir>
54+
<LinkIncremental>false</LinkIncremental>
55+
</PropertyGroup>
56+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
57+
<ClCompile>
58+
<WarningLevel>Level3</WarningLevel>
59+
<Optimization>Disabled</Optimization>
60+
<PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
61+
<PrecompiledHeader>Use</PrecompiledHeader>
62+
<AdditionalIncludeDirectories>.;$(SolutionDir)</AdditionalIncludeDirectories>
63+
<PrecompiledHeaderFile>Pch.hpp</PrecompiledHeaderFile>
64+
</ClCompile>
65+
<Link>
66+
<GenerateDebugInformation>true</GenerateDebugInformation>
67+
<AdditionalDependencies>xrCore.lib</AdditionalDependencies>
68+
<AdditionalLibraryDirectories>$(xrLibDir)</AdditionalLibraryDirectories>
69+
</Link>
70+
</ItemDefinitionGroup>
71+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
72+
<ClCompile>
73+
<WarningLevel>Level3</WarningLevel>
74+
<PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
75+
<PrecompiledHeader>Use</PrecompiledHeader>
76+
<AdditionalIncludeDirectories>.;$(SolutionDir)</AdditionalIncludeDirectories>
77+
<PrecompiledHeaderFile>Pch.hpp</PrecompiledHeaderFile>
78+
</ClCompile>
79+
<Link>
80+
<GenerateDebugInformation>true</GenerateDebugInformation>
81+
<AdditionalDependencies>xrCore.lib</AdditionalDependencies>
82+
<AdditionalLibraryDirectories>$(xrLibDir)</AdditionalLibraryDirectories>
83+
</Link>
84+
</ItemDefinitionGroup>
85+
<ItemGroup>
86+
<Reference Include="System" />
87+
<Reference Include="System.Data" />
88+
<Reference Include="System.Xml" />
89+
</ItemGroup>
90+
<ItemGroup>
91+
<ClInclude Include="Pch.hpp" />
92+
<ClInclude Include="wrappers\Core.hpp" />
93+
</ItemGroup>
94+
<ItemGroup>
95+
<ClCompile Include="AssemblyInfo.cpp" />
96+
<ClCompile Include="Pch.cpp">
97+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
98+
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
99+
</ClCompile>
100+
<ClCompile Include="wrappers\Core.cpp" />
101+
</ItemGroup>
102+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
103+
<ImportGroup Label="ExtensionTargets">
104+
</ImportGroup>
105+
</Project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="wrappers">
5+
<UniqueIdentifier>{5701e3e7-534d-4d78-8018-13a0da121c00}</UniqueIdentifier>
6+
</Filter>
7+
</ItemGroup>
8+
<ItemGroup>
9+
<ClInclude Include="wrappers\Core.hpp">
10+
<Filter>wrappers</Filter>
11+
</ClInclude>
12+
<ClInclude Include="Pch.hpp" />
13+
</ItemGroup>
14+
<ItemGroup>
15+
<ClCompile Include="wrappers\Core.cpp">
16+
<Filter>wrappers</Filter>
17+
</ClCompile>
18+
<ClCompile Include="AssemblyInfo.cpp" />
19+
<ClCompile Include="Pch.cpp" />
20+
</ItemGroup>
21+
</Project>

src/engine.sln

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrWeatherEditor", "editors\
133133
EndProject
134134
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xrPostprocessEditor", "editors\xrPostprocessEditor\xrPostprocessEditor.csproj", "{CB449DB5-9C97-447A-AA25-35EA7712F62C}"
135135
EndProject
136+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xrManagedApi", "editors\xrManagedApi\xrManagedApi.vcxproj", "{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}"
137+
EndProject
136138
Global
137139
GlobalSection(SolutionConfigurationPlatforms) = preSolution
138140
Debug_Dedicated|Any CPU = Debug_Dedicated|Any CPU
@@ -1600,6 +1602,36 @@ Global
16001602
{CB449DB5-9C97-447A-AA25-35EA7712F62C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
16011603
{CB449DB5-9C97-447A-AA25-35EA7712F62C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
16021604
{CB449DB5-9C97-447A-AA25-35EA7712F62C}.Release|Win32.ActiveCfg = Release|Any CPU
1605+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Debug_Dedicated|Any CPU.ActiveCfg = Debug|Win32
1606+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Debug_Dedicated|Mixed Platforms.ActiveCfg = Debug|Win32
1607+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Debug_Dedicated|Mixed Platforms.Build.0 = Debug|Win32
1608+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Debug_Dedicated|Win32.ActiveCfg = Debug|Win32
1609+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Debug_Dedicated|Win32.Build.0 = Debug|Win32
1610+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Debug|Any CPU.ActiveCfg = Debug|Win32
1611+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
1612+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Debug|Mixed Platforms.Build.0 = Debug|Win32
1613+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Debug|Win32.ActiveCfg = Debug|Win32
1614+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Debug|Win32.Build.0 = Debug|Win32
1615+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Mixed_Dedicated|Any CPU.ActiveCfg = Release|Win32
1616+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Mixed_Dedicated|Mixed Platforms.ActiveCfg = Release|Win32
1617+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Mixed_Dedicated|Mixed Platforms.Build.0 = Release|Win32
1618+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Mixed_Dedicated|Win32.ActiveCfg = Release|Win32
1619+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Mixed_Dedicated|Win32.Build.0 = Release|Win32
1620+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Mixed|Any CPU.ActiveCfg = Release|Win32
1621+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Mixed|Mixed Platforms.ActiveCfg = Release|Win32
1622+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Mixed|Mixed Platforms.Build.0 = Release|Win32
1623+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Mixed|Win32.ActiveCfg = Release|Win32
1624+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Mixed|Win32.Build.0 = Release|Win32
1625+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Release_Dedicated|Any CPU.ActiveCfg = Release|Win32
1626+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Release_Dedicated|Mixed Platforms.ActiveCfg = Release|Win32
1627+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Release_Dedicated|Mixed Platforms.Build.0 = Release|Win32
1628+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Release_Dedicated|Win32.ActiveCfg = Release|Win32
1629+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Release_Dedicated|Win32.Build.0 = Release|Win32
1630+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Release|Any CPU.ActiveCfg = Release|Win32
1631+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Release|Mixed Platforms.ActiveCfg = Release|Win32
1632+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Release|Mixed Platforms.Build.0 = Release|Win32
1633+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Release|Win32.ActiveCfg = Release|Win32
1634+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5}.Release|Win32.Build.0 = Release|Win32
16031635
EndGlobalSection
16041636
GlobalSection(SolutionProperties) = preSolution
16051637
HideSolutionNode = FALSE
@@ -1644,6 +1676,7 @@ Global
16441676
{E9DC16A3-D0FA-4924-AF6E-F6FDF3EA0661} = {CB0C814D-FB4E-453B-B7A0-716F4A1EACA4}
16451677
{492D3DFE-9068-4E7E-A008-7C2420A651C0} = {CB0C814D-FB4E-453B-B7A0-716F4A1EACA4}
16461678
{CB449DB5-9C97-447A-AA25-35EA7712F62C} = {CB0C814D-FB4E-453B-B7A0-716F4A1EACA4}
1679+
{55B0E2CA-E27A-47FC-BC92-21ABDC1044F5} = {CB0C814D-FB4E-453B-B7A0-716F4A1EACA4}
16471680
EndGlobalSection
16481681
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
16491682
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}

0 commit comments

Comments
 (0)