public void Draw() { LineBatch _batch = _screen.ScreenManager.LineBatch; SpriteBatch _spriteBatch = _screen.ScreenManager.SpriteBatch; _spriteBatch.Begin(0, null, null, null, null, null, _screen.Camera.View); _spriteBatch.Draw(_body.Texture, ConvertUnits.ToDisplayUnits(_chassis.Position), null, Color.White, _chassis.Rotation, _body.Origin, 1f, SpriteEffects.None, 0f); _spriteBatch.End(); _batch.Begin(_screen.Camera.SimProjection, _screen.Camera.SimView); for (int i = 0; i < _walkerJoints.Count; ++i) { _batch.DrawLine(_walkerJoints[i].WorldAnchorA, _walkerJoints[i].WorldAnchorB, Color.DarkRed); } _batch.End(); _spriteBatch.Begin(0, null, null, null, null, null, _screen.Camera.View); for (int i = 0; i < 3; ++i) { _spriteBatch.Draw(_leftLeg.Texture, ConvertUnits.ToDisplayUnits(_leftLegs[i].Position), null, Color.White, _leftLegs[i].Rotation, _leftLeg.Origin, 1f, SpriteEffects.None, 0f); _spriteBatch.Draw(_leftShoulder.Texture, ConvertUnits.ToDisplayUnits(_leftShoulders[i].Position), null, Color.White, _leftShoulders[i].Rotation, _leftShoulder.Origin, 1f, SpriteEffects.None, 0f); _spriteBatch.Draw(_rightLeg.Texture, ConvertUnits.ToDisplayUnits(_rightLegs[i].Position), null, Color.White, _rightLegs[i].Rotation, _rightLeg.Origin, 1f, SpriteEffects.None, 0f); _spriteBatch.Draw(_rightShoulder.Texture, ConvertUnits.ToDisplayUnits(_rightShoulders[i].Position), null, Color.White, _rightShoulders[i].Rotation, _rightShoulder.Origin, 1f, SpriteEffects.None, 0f); } _spriteBatch.Draw(_engine.Texture, ConvertUnits.ToDisplayUnits(_wheel.Position), null, Color.White, _wheel.Rotation, _engine.Origin, 1f, SpriteEffects.None, 0f); _spriteBatch.End(); }
/// <summary> /// Load your graphics content. /// </summary> protected override void LoadContent() { _spriteBatch = new SpriteBatch(GraphicsDevice); _lineBatch = new LineBatch(GraphicsDevice); _assetCreator = new AssetCreator(GraphicsDevice); _assetCreator.LoadContent(_contentManager); _input.LoadContent(); // Tell each of the screens to load their content. foreach (GameScreen screen in _screens) { screen.LoadContent(); } }
public void Draw() { GraphicsDevice device = _screen.ScreenManager.GraphicsDevice; LineBatch batch = _screen.ScreenManager.LineBatch; device.SamplerStates[0] = SamplerState.AnisotropicWrap; device.RasterizerState = RasterizerState.CullNone; _basicEffect.Projection = _screen.Camera.SimProjection; _basicEffect.View = _screen.Camera.SimView; _basicEffect.CurrentTechnique.Passes[0].Apply(); device.DrawUserPrimitives(PrimitiveType.TriangleList, _borderVerts, 0, 8); batch.Begin(_screen.Camera.SimProjection, _screen.Camera.SimView); batch.DrawLineShape(_anchor.FixtureList[0].Shape); batch.End(); }