public static void Draw(this SpriteBatch batch, Texture2D texture, IReferenceList <BatchedSprite> sprites, int offset, int count)
 {
     for (int i = offset; i < count; i++)
     {
         batch.DrawRef(texture, ref sprites.GetReferenceAt(i));
     }
 }
示例#2
0
        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            IReferenceList refList = Activator.CreateInstance(bindingContext.ModelType) as IReferenceList;
            var            attVal  = bindingContext.ValueProvider.GetValue(bindingContext.ModelName + ".SerializedValue");

            refList.SerializedValue = attVal == null ? null : attVal.AttemptedValue;

            return(refList);
        }
 public static void DrawString(
     this SpriteBatch batch, IReferenceList <GlyphBatchedSprite> sprites, int offset, int count)
 {
     for (int i = offset; i < count; i++)
     {
         ref GlyphBatchedSprite s = ref sprites.GetReferenceAt(i);
         if (s.Visible)
         {
             batch.DrawRef(s.Texture, ref s.Sprite);
         }
     }
示例#4
0
        public static ICharIterator ColorFormat(
            ICharIterator input, BitmapFont font, bool keepSequences, byte baseAlpha, IReferenceList <Color?> output)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }
            if (font == null)
            {
                throw new ArgumentNullException(nameof(font));
            }

            if (input.Length == 0)
            {
                return(input);
            }

            var builder = StringBuilderPool.Rent(input.Length);

            ColorFormat(input, builder, font, keepSequences, baseAlpha, output);
            var iterator = CharIteratorPool.Rent(builder, 0, builder.Length);

            StringBuilderPool.Return(builder);
            return(iterator);
        }