Skip to content
Merged
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
270 changes: 41 additions & 229 deletions src/Box2D.NET.Samples/SampleApp.cs

Large diffs are not rendered by default.

27 changes: 13 additions & 14 deletions src/Box2D.NET.Samples/SampleContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
using System.IO;
using System.Runtime.CompilerServices;
using Box2D.NET.Samples.Graphics;
using Box2D.NET.Samples.Samples;
using ImGuiNET;
using Silk.NET.GLFW;
using Silk.NET.OpenGL;
using static Box2D.NET.B2Types;
using static Box2D.NET.B2Constants;
using static Box2D.NET.Samples.Graphics.Backgrounds;
using static Box2D.NET.Samples.Graphics.Draws;

Expand All @@ -20,11 +22,20 @@ public class SampleContext
//
public readonly string Signature;
public readonly Glfw glfw;
public GL gl;
public unsafe WindowHandle* window;
public readonly Camera camera;
public Draw draw;
public Sample sample = null;
public B2Capacity capacity;
public B2DebugDraw debugDraw;
public ImFontPtr regularFont;
public ImFontPtr mediumFont;
public ImFontPtr largeFont;

public float uiScale = 1.0f;
public float hertz = 60.0f;
public float recycleDistance = 0.05f;
public int subStepCount = 4;
public int workerCount = 1;
public bool restart = false;
Expand All @@ -34,25 +45,12 @@ public class SampleContext
public bool drawProfile = false;
public bool enableWarmStarting = true;
public bool enableContinuous = true;
public bool enableRecycling = true;
public bool enableSleep = true;
public bool showUI = true;
public bool frameTime = false;

// These are persisted
public int sampleIndex = 0;
public B2Capacity capacity;


public B2DebugDraw debugDraw;

public ImFontPtr regularFont;
public ImFontPtr mediumFont;
public ImFontPtr largeFont;

//
public GL gl;
public unsafe WindowHandle* window;

private static string CreateSignature(string member, string file, int line)
{
Expand Down Expand Up @@ -92,6 +90,8 @@ private SampleContext(string signature, Glfw glfw)

public void Load()
{
recycleDistance = B2_CONTACT_RECYCLE_DISTANCE;

var settings = Settings.Load();

//
Expand All @@ -110,7 +110,6 @@ public void Load()
debugDraw.drawJoints = settings.drawJoints;

//
debugDraw.contactDrawType = settings.contactDrawType;
debugDraw.drawShapes = settings.drawShapes;
debugDraw.drawJoints = settings.drawJoints;
debugDraw.drawJointExtras = settings.drawJointExtras;
Expand Down
Loading
Loading