public void Load(GraphicsDevice graphicsDevice, PhysicsSimulator physicsSimulator) { _circleBrush = new CircleBrush(_radius, _color, _borderColor); _circleBrush.Load(graphicsDevice); _circleBody = new Body[_count]; _circleGeom = new Geom[_count]; _circleBody[0] = BodyFactory.Instance.CreateCircleBody(physicsSimulator, _radius, .5f); _circleBody[0].Position = _startPosition; for (int i = 1; i < _count; i++) { _circleBody[i] = BodyFactory.Instance.CreateBody(physicsSimulator, _circleBody[0]); _circleBody[i].Position = Vector2.Lerp(_startPosition, _endPosition, i / (float)(_count - 1)); } _circleGeom[0] = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, _circleBody[0], _radius, 10); _circleGeom[0].RestitutionCoefficient = .7f; _circleGeom[0].FrictionCoefficient = .2f; _circleGeom[0].CollisionCategories = _collisionCategories; _circleGeom[0].CollidesWith = _collidesWith; for (int j = 1; j < _count; j++) { _circleGeom[j] = GeomFactory.Instance.CreateGeom(physicsSimulator, _circleBody[j], _circleGeom[0]); } }
public override void LoadContent() { _circleBrush = new CircleBrush(64, Color.White, Color.Black); _circleBrush.Load(ScreenManager.GraphicsDevice); _circleBody = BodyFactory.Instance.CreateCircleBody(PhysicsSimulator, 64, 1); _circleBody.Position = new Vector2(725, 384); _circleGeom = GeomFactory.Instance.CreateCircleGeom(PhysicsSimulator, _circleBody, 64, 20); _rectangleBody = BodyFactory.Instance.CreateRectangleBody(PhysicsSimulator, 128, 128, 1); _rectangleBody.Position = new Vector2(256, 384); _rectangleGeom = GeomFactory.Instance.CreateRectangleGeom(PhysicsSimulator, _rectangleBody, 128, 128); _rectangleBrush = new RectangleBrush(128, 128, Color.Gold, Color.Black); _rectangleBrush.Load(ScreenManager.GraphicsDevice); _p1 = ScreenManager.ScreenCenter; _p2 = _circleGeom.Position; _lineBrush = new LineBrush(1, Color.Black); _lineBrush.Load(ScreenManager.GraphicsDevice); _marker = new CircleBrush(3, Color.Red, Color.Red); _marker.Load(ScreenManager.GraphicsDevice); base.LoadContent(); }
public void Load(GraphicsDevice graphicsDevice, PhysicsSimulator physicsSimulator) { _circleBrush = new CircleBrush(_radius, _color, _borderColor); _circleBrush.Load(graphicsDevice); _circleBody = new Body[_count]; _circleGeom = new Geom[_count]; _circleBody[0] = BodyFactory.Instance.CreateCircleBody(physicsSimulator, _radius, .5f); _circleBody[0].Position = _startPosition; for (int i = 1; i < _count; i++) { _circleBody[i] = BodyFactory.Instance.CreateBody(physicsSimulator, _circleBody[0]); _circleBody[i].Position = Vector2.Lerp(_startPosition, _endPosition, i/(float) (_count - 1)); } _circleGeom[0] = GeomFactory.Instance.CreateCircleGeom(physicsSimulator, _circleBody[0], _radius, 10); _circleGeom[0].RestitutionCoefficient = .7f; _circleGeom[0].FrictionCoefficient = .2f; _circleGeom[0].CollisionCategories = _collisionCategories; _circleGeom[0].CollidesWith = _collidesWith; for (int j = 1; j < _count; j++) { _circleGeom[j] = GeomFactory.Instance.CreateGeom(physicsSimulator, _circleBody[j], _circleGeom[0]); } }
private void LoadSpringContent(GraphicsDevice graphicsDevice) { _springLineBrush = new LineBrush(_springLineThickness, _springLineColor); _springCircleBrush = new CircleBrush(2, _springLineColor, _springLineColor); _springLineBrush.Load(graphicsDevice); _springCircleBrush.Load(graphicsDevice); }
private void LoadVerticeContent(GraphicsDevice graphicsDevice) { _verticeCircleBrush = new CircleBrush(_verticeRadius, _verticeColor, _verticeColor); _verticeCircleBrush.Load(graphicsDevice); }
private void LoadContactContent(GraphicsDevice graphicsDevice) { _contactCircleBrush = new CircleBrush(_contactRadius, _contactColor, _contactColor); _contactCircleBrush.Load(graphicsDevice); }
private void LoadGridContent(GraphicsDevice graphicsDevice) { _gridCircleBrush = new CircleBrush(_gridRadius, _gridColor, _gridColor); _gridCircleBrush.Load(graphicsDevice); }
public override void LoadContent() { _circleBrush = new CircleBrush(64, Color.White, Color.Black); _circleBrush.Load(ScreenManager.GraphicsDevice); _circleBody = BodyFactory.Instance.CreateCircleBody(PhysicsSimulator, 64, 1); _circleBody.Position = new Vector2(725, 384); _circleGeom = GeomFactory.Instance.CreateCircleGeom(PhysicsSimulator, _circleBody, 64, 20); _rectangleBody = BodyFactory.Instance.CreateRectangleBody(PhysicsSimulator, 128, 128, 1); _rectangleBody.Position = new Vector2(256, 384); _rectangleGeom = GeomFactory.Instance.CreateRectangleGeom(PhysicsSimulator, _rectangleBody, 128, 128); _rectangleBrush = new RectangleBrush(128, 128, Color.Gold, Color.Black); _rectangleBrush.Load(ScreenManager.GraphicsDevice); base.LoadContent(); }