Beispiel #1
0
        public void DrawSegment(SpriteBatch spriteBatch, ISegment segment)
        {
            Texture2D segmentTexture2D;

            _textures.TryGetValue("SegmentTexture", out segmentTexture2D);
            if (segmentTexture2D == null)
            {
                throw new Exception("ERROR : Texture not found in the dictionary");
            }
            float radianAngle = AngleHelper.SlopeToRadian((float)segment.Slope);

            spriteBatch.Draw(segmentTexture2D, new Rectangle((int)segment.Point1.X, (int)segment.Point1.Y, (int)segment.Lenght + 1, 1), null, Color.Black, radianAngle, new Vector2(0, 0), SpriteEffects.None, 1f);
        }