public void Draw(SpriteBatch spriteBatch) { spriteBatch.Draw(_roverTopTexture, new Rectangle((int)_roverTopPosition.X, (int)_roverTopPosition.Y, 63, 73), Color.White * 0.8f); DrawTrackDots(spriteBatch, _usedRightTrack, _roverTopPosition.X + 65, _roverTopPosition.Y + 64); DrawTrackDots(spriteBatch, _usedLeftTrack, _roverTopPosition.X - 10, _roverTopPosition.Y + 64); var font = _fontService.GetDefaultFont(); string kphString = "0 KPH"; Vector2 size = font.MeasureString(kphString); spriteBatch.DrawString(_fontService.GetDefaultFont(), kphString, new Vector2(700 - size.X, 160), Color.LightGreen); }
public void Draw(SpriteBatch spriteBatch) { string zoomText = "1x"; Rectangle position; if (_zoomEnabled) { int zoomLevel = 2; int width = zoomLevel * 800; int height = zoomLevel * 600; zoomText = zoomLevel + "x"; position = new Rectangle(-width / 4, -height / 4, width, height); //spriteBatch.Draw(_cameraTexture, new Rectangle(-400, -300, 1600, 1200), null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 1f); } else { position = new Rectangle(0, 0, 800, 600); //spriteBatch.Draw(_cameraTexture, _spritePosition, null, Color.White, 0f, Vector2.Zero, new Vector2(2.5f), SpriteEffects.None, 1f); } if (_cameraTexture != null) { spriteBatch.Draw(_cameraTexture, position, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 1f); } var font = _fontService.GetDefaultFont(); Vector2 size = font.MeasureString(zoomText); spriteBatch.DrawString(_font, zoomText, new Vector2(700 - size.X, 200), Color.LightGreen); }
public void Draw(SpriteBatch spriteBatch) { const int compassWidth = 865; float compassX = (float)(-HUDOrientation * compassWidth / 365) - 28; Vector2 compassPosition = new Vector2(compassX, 0); Vector2 secondCompassPosition; if (compassX > 0) { secondCompassPosition = new Vector2(compassX - compassWidth, 0); } else { secondCompassPosition = new Vector2(compassX + compassWidth, 0); } spriteBatch.Draw(_compassTexture, compassPosition, Color.LightGreen); spriteBatch.Draw(_compassTexture, secondCompassPosition, Color.LightGreen); spriteBatch.Draw(_compassHeading, new Rectangle(397, 50, 20, 11), Color.LightGreen); //string orientationString = MagnetometerX.ToString("0") + " <-> " + MagnetometerY.ToString("0") + " <-> " + MagnetometerZ.ToString("0") + " <-> " + MagnetometerOrientation.ToString("0"); string orientationString = MagnetometerOrientation.ToString("0"); var font = _fontService.GetDefaultFont(); Vector2 size = font.MeasureString(orientationString); Vector2 pos = new Vector2(406f - (size.X / 2), 60f); Vector2 origin = size * 0.5f; spriteBatch.DrawString(font, orientationString, pos, Color.LightGreen); }
public void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) { string cameraPositionString = "CAM: " + _cameraXAxis.ToString("0") + " - " + _cameraYAxis.ToString("0"); var font = _fontService.GetDefaultFont(); Vector2 size = font.MeasureString(cameraPositionString); Vector2 pos = new Vector2(120f, 500f); Vector2 origin = size * 0.5f; spriteBatch.DrawString(font, cameraPositionString, pos, Color.LightGreen); }