コード例 #1
0
        public override void prerender()
        {
            if (str.Length == 0)
            {
                return;
            }
            if (currentFont == null)
            {
                currentFont = new XNAFont();
            }
            int off = uirCache.IndexOf(this);
            if (off > -1)
            {
                uir = uirCache[off].uir;
                uirCache.RemoveAt(off);
                uirCache.Insert(0, this);
                return;
            }
            SilverlightImplementation.textBlockInstance.Text = str;
            SilverlightImplementation.textBlockInstance.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(col.A, col.R, col.G, col.B));
            currentFont.applyFont(SilverlightImplementation.textBlockInstance);
            SilverlightImplementation.textBlockInstance.Measure(new Size(10000, 10000));
            int dw = (int)SilverlightImplementation.textBlockInstance.DesiredSize.Width;
            int dh = (int)SilverlightImplementation.textBlockInstance.DesiredSize.Height;

            uir = new UIElementRenderer(SilverlightImplementation.textBlockInstance, dw, dh);
            uir.Render();
            uirCache.Insert(0, this);
            if (uirCache.Count > 50)
            {
                uirCache[50].uir.Dispose();
                uirCache.RemoveAt(50);
            }
        }
コード例 #2
0
 public override global::System.Object createFont(int face, int style, int size)
 {
     XNAFont x = new XNAFont();
     x.face = face;
     x.style = style;
     x.size = size;
     return x;
 }
コード例 #3
0
 public DrawString(int x, int y, String str, Color col, XNAFont currentFont, int alpha)
 {
     this.x = x;
     this.y = y;
     this.str = str;
     this.col = new Color(col.R, col.G, col.B, alpha);
     this.currentFont = currentFont;
 }