Example #1
0
 private int CompareDepthAndFont(gxtSpriteFontInfo x, gxtSpriteFontInfo y)
 {
     if (depthMode == gxtBatchDepthMode.FRONT_TO_BACK)
     {
         if (x.depth < y.depth)
             return -1;
         if (x.depth > y.depth)
             return 1;
         if (x.spriteFont == y.spriteFont)
             return 0;
         return -1;
     }
     else
     {
         if (x.depth < y.depth)
             return 1;
         if (x.depth > y.depth)
             return -1;
         if (x.spriteFont == y.spriteFont)
             return 0;
         return -1;
     }
 }
Example #2
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="spriteFont"></param>
 /// <param name="text"></param>
 /// <param name="color"></param>
 /// <param name="position"></param>
 /// <param name="scale"></param>
 /// <param name="rotation"></param>
 /// <param name="origin"></param>
 /// <param name="spriteEffects"></param>
 /// <param name="layerDepth"></param>
 /// <returns></returns>
 public bool DrawString(SpriteFont spriteFont, string text, Color color, ref Vector2 position, ref Vector2 scale, float rotation, ref Vector2 origin, SpriteEffects spriteEffects, float layerDepth)
 {
     if (begun)
     {
         if (sortMode == gxtBatchSortMode.IMMEDIATE)
         {
             spriteBatch.DrawString(spriteFont, text, position, color, rotation, origin, scale, spriteEffects, layerDepth);
         }
         else
         {
             if (drawOrder != gxtBatchDrawOrder.INLINE)
             {
                 gxtSpriteFontInfo sfi = new gxtSpriteFontInfo();
                 sfi.depth = layerDepth;
                 sfi.color = color;
                 sfi.position = position;
                 sfi.rotation = rotation;
                 sfi.scale = scale;
                 sfi.origin = origin;
                 sfi.spriteEffects = spriteEffects;
                 sfi.text = text;
                 sfi.spriteFont = spriteFont;
                 spriteFontData.Add(sfi);
                 // add buffer object
             }
             else
             {
                 gxtGeneralSpriteFontInfo gsfi = new gxtGeneralSpriteFontInfo();
                 gsfi.color = color;
                 gsfi.depth = layerDepth;
                 gsfi.origin = origin;
                 gsfi.position = position;
                 gsfi.rotation = rotation;
                 gsfi.scale = scale;
                 gsfi.spriteEffects = spriteEffects;
                 gsfi.spriteFont = spriteFont;
                 gsfi.text = text;
                 generalData.Add(gsfi);
             }
         }
     }
     return begun;
 }