Esempio n. 1
0
        public static CachedStringRender GetCachedStringRender(string text,
                                                               BitmapFont font,
                                                               Rectangle destinationRectangle,
                                                               Color color,
                                                               bool wrap,
                                                               bool stroke,
                                                               int strokeDistance = 1,
                                                               DrawUtil.HorizontalAlignment horizontalAlignment = DrawUtil.HorizontalAlignment.Left,
                                                               DrawUtil.VerticalAlignment verticalAlignment     = DrawUtil.VerticalAlignment.Middle)
        {
            var checkCSR = new CachedStringRender(text, font, destinationRectangle, color, wrap, stroke, strokeDistance, horizontalAlignment, verticalAlignment);

            int csrHash = checkCSR.GetHashCode();

            if (!_cachedStringRenders.ContainsKey(csrHash))
            {
                checkCSR.InitRender();
                _cachedStringRenders.Add(csrHash, checkCSR);
            }

            return(_cachedStringRenders[csrHash]);
        }
Esempio n. 2
0
 protected bool Equals(CachedStringRender other)
 {
     return(string.Equals(this.Text, other.Text) && Equals(this.Font, other.Font) && this.DestinationRectangle.Equals(other.DestinationRectangle) && this.Color.Equals(other.Color) && this.Wrap == other.Wrap && this.Stroke == other.Stroke && this.StrokeDistance == other.StrokeDistance && this.HorizontalAlignment == other.HorizontalAlignment && this.VerticalAlignment == other.VerticalAlignment);
 }