Skip to content

Commit

Permalink
Add a simple demo using the new demos engine
Browse files Browse the repository at this point in the history
  • Loading branch information
MuleaneEve committed Nov 7, 2018
1 parent 233753f commit 149c3fe
Show file tree
Hide file tree
Showing 6 changed files with 614 additions and 1 deletion.
26 changes: 26 additions & 0 deletions Demos.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BepuPhysics", "BepuPhysics\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DemoEngine", "DemoEngine\DemoEngine.csproj", "{34853617-FEA9-439E-8518-8C2342BCC4FD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SharpNeatWalker", "SharpNeatWalker\SharpNeatWalker.csproj", "{05BCAB48-1639-43E0-9EFA-5002D99B8782}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -234,6 +236,30 @@ Global
{34853617-FEA9-439E-8518-8C2342BCC4FD}.ReleaseStrip|x64.Build.0 = Release|Any CPU
{34853617-FEA9-439E-8518-8C2342BCC4FD}.ReleaseStrip|x86.ActiveCfg = Release|Any CPU
{34853617-FEA9-439E-8518-8C2342BCC4FD}.ReleaseStrip|x86.Build.0 = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Debug|Any CPU.Build.0 = Debug|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Debug|ARM.ActiveCfg = Debug|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Debug|ARM.Build.0 = Debug|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Debug|x64.ActiveCfg = Debug|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Debug|x64.Build.0 = Debug|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Debug|x86.ActiveCfg = Debug|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Debug|x86.Build.0 = Debug|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Release|Any CPU.Build.0 = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Release|ARM.ActiveCfg = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Release|ARM.Build.0 = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Release|x64.ActiveCfg = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Release|x64.Build.0 = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Release|x86.ActiveCfg = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.Release|x86.Build.0 = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.ReleaseStrip|Any CPU.ActiveCfg = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.ReleaseStrip|Any CPU.Build.0 = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.ReleaseStrip|ARM.ActiveCfg = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.ReleaseStrip|ARM.Build.0 = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.ReleaseStrip|x64.ActiveCfg = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.ReleaseStrip|x64.Build.0 = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.ReleaseStrip|x86.ActiveCfg = Release|Any CPU
{05BCAB48-1639-43E0-9EFA-5002D99B8782}.ReleaseStrip|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
2 changes: 1 addition & 1 deletion Demos/Demos/RagdollDemo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
namespace Demos.Demos
{
//For the purposes of this demo, we have custom collision filtering rules.
struct RagdollCallbacks : INarrowPhaseCallbacks
public struct RagdollCallbacks : INarrowPhaseCallbacks
{
public BodyProperty<ulong> Masks;
public void Initialize(Simulation simulation)
Expand Down
39 changes: 39 additions & 0 deletions SharpNeatWalker/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using BepuUtilities;
using DemoContentLoader;
using DemoEngine;
using DemoUtilities;
using OpenTK;

namespace SharpNeatWalker
{
internal static class Program
{
private static void Main()
{
if (!false) // Run in the background
using (var simulation = new WalkerDemo())
{
var start = System.DateTime.UtcNow;
simulation.RunPhysics(canContinue: () => (System.DateTime.UtcNow - start).TotalSeconds < -5); // Run for a few secs
}

ContentArchive content;
using (var stream = typeof(Demos.DemoHarness).Assembly.GetManifestResourceStream("Demos.Demos.contentarchive"))
{
content = ContentArchive.Load(stream);
}

using (var window = new DemoEngine.Window("SharpNeat Walker", new Int2((int)(DisplayDevice.Default.Width * 0.75f), (int)(DisplayDevice.Default.Height * 0.75f)), WindowMode.Windowed))
using (var loop = new GameLoop(window))
{
var harness = new DemoHarness(loop, content, customDemoSet: new DemoSet().AddOption<WalkerDemo>());
loop.Run(harness);
}

/*var loop = new GameLoop(window);
var demo = new DemoHarness(loop, content, customDemoSet: new DemoSet().AddOption<Walker>());
loop.Run(demo);
loop.Dispose();*/
}
}
}
Loading

0 comments on commit 149c3fe

Please sign in to comment.