Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
11 changes: 5 additions & 6 deletions MengeCS/MengeCS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@
<Compile Include="Vector2.cs" />
<Compile Include="Vector3.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="MengeCore.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>xcopy /y /d "$(MengeDir)\MengeCore.dll" $(ProjectDir)</PreBuildEvent>
<PreBuildEvent>if "$(ConfigurationName)" == "Debug" (
xcopy /y /d "$(MengeDir)\MengeCore_d.dll" $(TargetDir)
) ELSE (
xcopy /y /d "$(MengeDir)\MengeCore.dll" $(TargetDir)
)</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
Binary file removed MengeCS/MengeCore_d.dll
Binary file not shown.
34 changes: 20 additions & 14 deletions MengeCS/MengeWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,50 @@ namespace MengeCS
{
class MengeWrapper
{
[DllImport("MengeCore")]
#if DEBUG
const string MENGE_DLL = "MengeCore_d";
#else
const string MENGE_DLL = "MengeCore";
#endif

[DllImport(MENGE_DLL)]
public static extern bool InitSimulator([MarshalAs(UnmanagedType.LPStr)] String behaveFile,
[MarshalAs(UnmanagedType.LPStr)] String sceneFile,
[MarshalAs(UnmanagedType.LPStr)] String model,
[MarshalAs(UnmanagedType.LPStr)] String pluginPath
);
[DllImport("MengeCore")]

[DllImport(MENGE_DLL)]
public static extern float SetTimeStep(float timestep);

[DllImport("MengeCore")]
[DllImport(MENGE_DLL)]
public static extern bool DoStep();

[DllImport("MengeCore")]
[DllImport(MENGE_DLL)]
public static extern uint AgentCount();

[DllImport("MengeCore")]
[DllImport(MENGE_DLL)]
public static extern bool GetAgentPosition(uint i, ref float x, ref float y, ref float z);

[DllImport("MengeCore")]
[DllImport(MENGE_DLL)]
public static extern bool GetAgentVelocity(uint i, ref float x, ref float y, ref float z);

[DllImport("MengeCore")]
public static extern bool GetAgentOrient(uint i, ref float x, ref float y );
[DllImport(MENGE_DLL)]
public static extern bool GetAgentOrient(uint i, ref float x, ref float y);

[DllImport("MengeCore")]
[DllImport(MENGE_DLL)]
public static extern int GetAgentClass(uint i);

[DllImport("MengeCore")]
[DllImport(MENGE_DLL)]
public static extern float GetAgentRadius(uint i);

[DllImport("MengeCore")]
[DllImport(MENGE_DLL)]
public static extern int ExternalTriggerCount();

[DllImport("MengeCore")]
[DllImport(MENGE_DLL)]
public static extern IntPtr ExternalTriggerName(int i);

[DllImport("MengeCore", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
[DllImport(MENGE_DLL, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern void FireExternalTrigger([MarshalAs(UnmanagedType.LPStr)] string lpString);
}
}
13 changes: 7 additions & 6 deletions MengeCSExe/MengeCSExe.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@
<Name>MengeCS</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="..\MengeCS\MengeCore.dll">
<Link>MengeCore.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>if "$(ConfigurationName)" == "Debug" (
xcopy /y /d "$(ProjectDir)..\MengeCS\bin\Debug\MengeCore_d.dll" $(TargetDir)
) ELSE (
xcopy /y /d "$(ProjectDir)..\MengeCS\bin\Release\MengeCore.dll" $(TargetDir)
)</PreBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down