public void SetupPhysics(ref PhysicsLayer.PhysicsContext ctx, BodyType type) { if (type == BodyType.Dynamic) { body = PhysicsLayer.PhysicsBody.DynamicBody(ctx, offset, size); } else if (type == BodyType.Static) { body = PhysicsLayer.PhysicsBody.GroundBody(ctx, offset, size); } }
// Initialize all engine variables within constructor public Application() : base(new WindowLayer.Options(1280, 720, 4, 4, false, "SPHelloWorld", true), Properties.Resources.ResourceManager) { floor.BufferToGPU(); quad.BufferToGPU(); shader = new Shader("simple_v", "simple_f"); // Set background color of sky camera2D.clearColor = new Color("#c0e6fc"); // Physics physicsContext = PhysicsLayer.PhysicsContext.NewContext(-98.0f); floor.SetupPhysics(ref physicsContext, Sprite.BodyType.Static); quad.SetupPhysics(ref physicsContext, Sprite.BodyType.Dynamic); }