public override void Draw(SpriteBatchUI spriteBatch, Point position) { AEntity player = WorldModel.Entities.GetPlayerEntity(); float x = (float)Math.Round((player.Position.X % 256) + player.Position.X_offset) / 256f; float y = (float)Math.Round((player.Position.Y % 256) + player.Position.Y_offset) / 256f; Vector3 playerPosition = new Vector3(x - y, x + y, 0f); float minimapU = (m_GumpTexture.Width / 256f) / 2f; float minimapV = (m_GumpTexture.Height / 256f) / 2f; VertexPositionNormalTextureHue[] v = new VertexPositionNormalTextureHue[4] { new VertexPositionNormalTextureHue(new Vector3(position.X, position.Y, 0), playerPosition + new Vector3(-minimapU, -minimapV, 0), new Vector3(0, 0, 0)), new VertexPositionNormalTextureHue(new Vector3(position.X + Width, position.Y, 0), playerPosition + new Vector3(minimapU, -minimapV, 0), new Vector3(1, 0, 0)), new VertexPositionNormalTextureHue(new Vector3(position.X, position.Y + Height, 0), playerPosition + new Vector3(-minimapU, minimapV, 0), new Vector3(0, 1, 0)), new VertexPositionNormalTextureHue(new Vector3(position.X + Width, position.Y + Height, 0), playerPosition + new Vector3(minimapU, minimapV, 0), new Vector3(1, 1, 0)) }; spriteBatch.DrawSprite(m_GumpTexture, v, Techniques.MiniMap); if (UltimaGame.TotalMS % 500f < 250f) { if (m_PlayerIndicator == null) { m_PlayerIndicator = new Texture2D(spriteBatch.GraphicsDevice, 1, 1); m_PlayerIndicator.SetData <uint>(new uint[1] { 0xFFFFFFFF }); } spriteBatch.Draw2D(m_PlayerIndicator, new Vector3(position.X + Width / 2, position.Y + Height / 2 - 8, 0), Vector3.Zero); } }
public override void Draw(SpriteBatchUI spriteBatch, Vector2Int position, double frameMS) { var player = WorldModel.Entities.GetPlayerEntity(); var x = (float)Math.Round((player.Position.X % 256) + player.Position.X_offset) / 256f; var y = (float)Math.Round((player.Position.Y % 256) + player.Position.Y_offset) / 256f; var playerPosition = new Vector3(x - y, x + y, 0f); var minimapU = (_gumpTexture.Width / 256f) / 2f; var minimapV = (_gumpTexture.Height / 256f) / 2f; VertexPositionNormalTextureHue[] v = { new VertexPositionNormalTextureHue(new Vector3(position.x, position.y, 0), playerPosition + new Vector3(-minimapU, -minimapV, 0), new Vector3(0, 0, 0)), new VertexPositionNormalTextureHue(new Vector3(position.x + Width, position.y, 0), playerPosition + new Vector3(minimapU, -minimapV, 0), new Vector3(1, 0, 0)), new VertexPositionNormalTextureHue(new Vector3(position.x, position.y + Height, 0), playerPosition + new Vector3(-minimapU, minimapV, 0), new Vector3(0, 1, 0)), new VertexPositionNormalTextureHue(new Vector3(position.x + Width, position.y + Height, 0), playerPosition + new Vector3(minimapU, minimapV, 0), new Vector3(1, 1, 0)) }; spriteBatch.DrawSprite(_gumpTexture, v, Techniques.MiniMap); _timeMS += (float)frameMS; if (_timeMS >= ReticleBlinkMS) { if (_playerIndicator == null) { _playerIndicator = new Texture2DInfo(spriteBatch.GraphicsDevice, 1, 1); _playerIndicator.SetData(new uint[1] { 0xFFFFFFFF }); } spriteBatch.Draw2D(_playerIndicator, new Vector3(position.x + Width / 2, position.y + Height / 2 - 8, 0), Vector3.zero); } if (_timeMS >= ReticleBlinkMS * 2) { _timeMS -= ReticleBlinkMS * 2; } }