当前位置: 首页>>代码示例>>C#>>正文


C# SpriteSortMode类代码示例

本文整理汇总了C#中SpriteSortMode的典型用法代码示例。如果您正苦于以下问题:C# SpriteSortMode类的具体用法?C# SpriteSortMode怎么用?C# SpriteSortMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SpriteSortMode类属于命名空间,在下文中一共展示了SpriteSortMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Begin

 public void Begin(SpriteSortMode sortMode, SpriteBlendMode blendMode, SaveStateMode stateMode, Matrix transformMatrix)
 {
     _blendMode = blendMode;
     _sortMode = sortMode;
     _saveMode = stateMode;
     _matrix = transformMatrix;
 }
开发者ID:QHebert,项目名称:monogame,代码行数:7,代码来源:SpriteBatch.cs

示例2: InvalidOperationException

        /// <summary>
        /// Begins a new sprite and text batch with the specified render state.
        /// </summary>
        /// <param name="sortMode">The drawing order for sprite and text drawing. <see cref="SpriteSortMode.Deferred"/> by default.</param>
        /// <param name="blendState">State of the blending. Uses <see cref="BlendState.AlphaBlend"/> if null.</param>
        /// <param name="samplerState">State of the sampler. Uses <see cref="SamplerState.LinearClamp"/> if null.</param>
        /// <param name="depthStencilState">State of the depth-stencil buffer. Uses <see cref="DepthStencilState.None"/> if null.</param>
        /// <param name="rasterizerState">State of the rasterization. Uses <see cref="RasterizerState.CullCounterClockwise"/> if null.</param>
        /// <param name="effect">A custom <see cref="Effect"/> to override the default sprite effect. Uses default sprite effect if null.</param>
        /// <param name="transformMatrix">An optional matrix used to transform the sprite geometry. Uses <see cref="Matrix.Identity"/> if null.</param>
        /// <exception cref="InvalidOperationException">Thrown if <see cref="Begin"/> is called next time without previous <see cref="End"/>.</exception>
        /// <remarks>This method uses optional parameters.</remarks>
        /// <remarks>The <see cref="Begin"/> Begin should be called before drawing commands, and you cannot call it again before subsequent <see cref="End"/>.</remarks>
        public void Begin
        (
             SpriteSortMode sortMode = SpriteSortMode.Deferred,
             BlendState blendState = null,
             SamplerState samplerState = null,
             DepthStencilState depthStencilState = null,
             RasterizerState rasterizerState = null,
             Effect effect = null,
             Matrix? transformMatrix = null
        )
        {
            if (_beginCalled)
                throw new InvalidOperationException("Begin cannot be called again until End has been successfully called.");

            // defaults
            _sortMode = sortMode;
            _blendState = blendState ?? BlendState.AlphaBlend;
            _samplerState = samplerState ?? SamplerState.LinearClamp;
            _depthStencilState = depthStencilState ?? DepthStencilState.None;
            _rasterizerState = rasterizerState ?? RasterizerState.CullCounterClockwise;
            _effect = effect;
            _matrix = transformMatrix ?? Matrix.Identity;

            // Setup things now so a user can change them.
            if (sortMode == SpriteSortMode.Immediate)
            {
                Setup();
            }

            _beginCalled = true;
        }
开发者ID:KennethYap,项目名称:MonoGame,代码行数:44,代码来源:SpriteBatch.cs

示例3: DrawBatch

        public void DrawBatch(SpriteSortMode sortMode)
        {
            if (_items.Count == 0) return;

            SortItems(sortMode);

            var index = 0;

            // build the vertices array to send to the GPU
            foreach (var item in _items)
            {
                _vertices[index++] = item.Vertices[0];
                _vertices[index++] = item.Vertices[1];
                _vertices[index++] = item.Vertices[2];
                _vertices[index++] = item.Vertices[3];

                //add this item back to the pool
                _itemPool.Enqueue(item);
            }

            GL.BindVertexArray(_vertexHandle);
            GL.BindBuffer(BufferTarget.ElementArrayBuffer, _indexHandle);

            Draw(index, _items.Count);

            _items.Clear();
        }
开发者ID:makesj,项目名称:vienna,代码行数:27,代码来源:SpriteBatcher.cs

示例4: Start

        /// <summary>
        /// Starts the specified batch.
        /// </summary>
        /// <param name="batch">The batch.</param>
        /// <param name="useCamera">if set to <c>true</c> camera matrix will be applied.</param>
        /// <param name="sortMode">The sort mode.</param>
        /// <param name="blendState">State of the blend.</param>
        /// <param name="samplerState">State of the sampler.</param>
        /// <param name="depthStencilState">State of the depth stencil.</param>
        /// <param name="rasterizerState">State of the rasterizer.</param>
        /// <param name="effect">The effect.</param>
        /// <param name="transform">The transformation matrix.</param>
        public static void Start(this SpriteBatch batch,
            bool useCamera = false,
            SpriteSortMode sortMode = SpriteSortMode.Deferred,
            BlendState blendState = null,
            SamplerState samplerState = null,
            DepthStencilState depthStencilState = null,
            RasterizerState rasterizerState = null,
            Effect effect = null,
            Matrix? transform = null)
        {
            Matrix matrix = AlmiranteEngine.IsWinForms ? Matrix.Identity : AlmiranteEngine.Settings.Resolution.Matrix;

            if (useCamera)
            {
                matrix = AlmiranteEngine.Camera.Matrix * matrix;
            }

            if (transform.HasValue)
            {
                matrix = transform.Value * matrix;
            }

            BatchExtensions._sortMode = sortMode;
            BatchExtensions._blendState = blendState;
            BatchExtensions._samplerState = samplerState;
            BatchExtensions._depthStencilState = depthStencilState;
            BatchExtensions._rasterizerState = rasterizerState;
            BatchExtensions._effect = effect;
            BatchExtensions._matrix = matrix;

            batch.Begin(sortMode, blendState, samplerState, depthStencilState, rasterizerState, effect, matrix);
        }
开发者ID:WoLfulus,项目名称:Almirante,代码行数:44,代码来源:BatchStart.cs

示例5: Begin

 public override void Begin(GraphicsDevice device, SpriteBlendMode blendMode, SpriteSortMode sortMode, SaveStateMode stateMode, Local.Matrix transformMatrix)
 {
     _childRenderer = GetCurrentRenderer();
     _childRenderer.Begin(device, blendMode, sortMode, stateMode, transformMatrix);
     currentSortMode = sortMode;
     base.Begin(device, blendMode, sortMode, stateMode, transformMatrix);
 }
开发者ID:liwq-net,项目名称:SilverSprite,代码行数:7,代码来源:CanvasRenderer.cs

示例6: StartBatch

        internal static void StartBatch(BlendState blendState = null, SpriteSortMode sortMode = SpriteSortMode.Texture)
        {
            if (blendState == null)
            blendState = BlendState.NonPremultiplied;

             MainGame.SpriteBatch.Begin (sortMode, blendState, SamplerState.PointWrap, DepthStencilState.None, RasterizerState.CullNone);

             IsBatching = true;
        }
开发者ID:CAMongrel,项目名称:WinWar,代码行数:9,代码来源:RenderManager.cs

示例7: Begin

 public void Begin()
 {
     _sortMode = SpriteSortMode.Deferred;
     _blendState = BlendState.AlphaBlend;
     _depthStencilState = DepthStencilState.None;
     _samplerState = SamplerState.LinearClamp;
     _rasterizerState = RasterizerState.CullCounterClockwise;
     _matrix = Matrix.Identity;
 }
开发者ID:Jorgemagic,项目名称:MonoGame,代码行数:9,代码来源:SpriteBatch.cs

示例8: SpriteBatchDescription

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="spriteBatchName">The string name used to access the sprite batch</param>
 /// <param name="desiredBlendMode">The blend mode to use for the sprite batch</param>
 /// <param name="desiredSortMode">The sort mode to use for the sprite batch</param>
 /// <param name="desiredSaveMode">The save mode to use for the sprite batch</param>
 /// <param name="updateCameraMatrix">The flag used to denote if the matrix needs to be updated every update cycle</param>
 public SpriteBatchDescription(string spriteBatchName, SpriteBlendMode desiredBlendMode, 
     SpriteSortMode desiredSortMode, SaveStateMode desiredSaveMode, bool updateCameraMatrix)
 {
     this.spriteBatchName = spriteBatchName;
     this.desiredBlendMode = desiredBlendMode;
     this.desiredSortMode = desiredSortMode;
     this.desiredStateMode = desiredSaveMode;
     this.updateCameraMatrix = updateCameraMatrix;
     this.currentMatrix = Matrix.Identity;
 }
开发者ID:RochesterIndiesAnonymous,项目名称:Ironstag,代码行数:18,代码来源:SpriteBatchDescription.cs

示例9: TTSpriteBatch

 /// <summary>
 /// construct a TTSpriteBatch with custom rendering parameters for the batch
 /// </summary>
 public TTSpriteBatch(GraphicsDevice gfx, SpriteSortMode ssm, BlendState bs, SamplerState ss, DepthStencilState dss, RasterizerState rs, Effect fx)
     : base(gfx)
 {
     spriteSortMode = ssm;
     blendState = bs;
     samplerState = ss;
     depthStencilState = dss;
     rasterizerState = rs;
     effect = fx;
 }
开发者ID:IndiegameGarden,项目名称:TTengine,代码行数:13,代码来源:TTSpriteBatch.cs

示例10: SpriteBatchState

 /// <summary>
 /// Initializes a new instance of the <see cref="SpriteBatchState"/> structure.
 /// </summary>
 /// <param name="sortMode">The sprite batch's sort mode.</param>
 /// <param name="blendState">The sprite batch's blend state.</param>
 /// <param name="samplerState">The sprite batch's sampler state.</param>
 /// <param name="rasterizerState">The sprite batch's rasterizer state.</param>
 /// <param name="depthStencilState">The sprite batch's depth/stencil state.</param>
 /// <param name="effect">The sprite batch's custom effect.</param>
 /// <param name="transformMatrix">The sprite batch's transformation matrix.</param>
 public SpriteBatchState(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, RasterizerState rasterizerState, DepthStencilState depthStencilState, Effect effect, Matrix transformMatrix)
 {
     this.sortMode          = sortMode;
     this.blendState        = blendState;
     this.samplerState      = samplerState;
     this.rasterizerState   = rasterizerState;
     this.depthStencilState = depthStencilState;
     this.customEffect      = effect;
     this.transformMatrix   = transformMatrix;
 }
开发者ID:RUSshy,项目名称:ultraviolet,代码行数:20,代码来源:SpriteBatchState.cs

示例11: Begin

 /// <summary>
 /// Begin the SpriteBatch
 /// </summary>
 /// <param name="SortMode">Self-explanatory.</param>
 /// <param name="BlendState">Self-explanatory.</param>
 /// <param name="SamplerState">Self-explanatory.</param>
 /// <param name="DepthStencilState">Self-explanatory.</param>
 /// <param name="RasterizerState">Self-explanatory.</param>
 /// <param name="Effect">Self-explanatory.</param>
 /// <param name="Matrix">Self-explanatory.</param>
 public void Begin(SpriteSortMode SortMode = SpriteSortMode.Deferred, BlendState BlendState = null,
     SamplerState SamplerState = null, DepthStencilState DepthStencilState = null,
     RasterizerState RasterizerState = null, Effect Effect = null, Matrix? Matrix = null, bool Backup = false)
 {
     if (Begun) End();
     Begun = true;
     if (Backup)
         this.Backup(SortMode, BlendState, SamplerState, DepthStencilState, RasterizerState, Effect, Matrix);
     SpriteBatch.Begin(SortMode, BlendState, SamplerState, DepthStencilState, RasterizerState, Effect, Matrix);
 }
开发者ID:CodeTreeCommunity,项目名称:Shooter2D,代码行数:20,代码来源:Batch.cs

示例12: Begin

        public void Begin(TextureAtlas atlas, Camera camera)
        {
            if (_beginCalled) throw new Exception("Begin called twice without a call to end.");

            _atlas = atlas;
            _camera = camera;
            _blendState = BlendState.AlphaBlend;
            _sortMode = SpriteSortMode.None;
            _beginCalled = true;
        }
开发者ID:makesj,项目名称:vienna,代码行数:10,代码来源:SpriteBatch.cs

示例13: Begin

        /// <summary>
        /// Begins a sprite batch operation using the specified sort and blend state
        ///    object and default state objects (DepthStencilState.None, SamplerState.LinearClamp,
        ///    RasterizerState.CullCounterClockwise). If you pass a null blend state, the
        ///    default is BlendState.AlphaBlend.
        /// </summary>
        /// <param name="sortMode">Sprite drawing order.</param>
        /// <param name="blendState">Blending options.</param>
        public new void Begin(SpriteSortMode sortMode, BlendState blendState)
        {
            if (Camera.main == null)
                return;

            if (!active)
            {
                base.Begin(sortMode, blendState, SamplerState.AnisotropicClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise, null, Camera.main.TransformMatrix);
                active = true;
            }
        }
开发者ID:MaxPlay,项目名称:GameEngine,代码行数:19,代码来源:EngineSpriteBatch.cs

示例14: SBNode

        public SBNode(batchEnum _name, SpriteSortMode _sort, BlendState _blend)
        {
            spriteBatch = new SpriteBatch(Game1.GameInstance.GraphicsDevice);

            batchName = _name;

            sort = _sort;
            blend = _blend;

            spriteListHead = null;
        }
开发者ID:frobro98,项目名称:School-Projects,代码行数:11,代码来源:SBNode.cs

示例15: Backup

 public void Backup(SpriteSortMode SortMode = SpriteSortMode.Deferred, BlendState BlendState = null,
     SamplerState SamplerState = null, DepthStencilState DepthStencilState = null,
     RasterizerState RasterizerState = null, Effect Effect = null, Matrix? Matrix = null)
 {
     this.SortMode = SortMode;
     this.BlendState = BlendState;
     this.SamplerState = SamplerState;
     this.DepthStencilState = DepthStencilState;
     this.RasterizerState = RasterizerState;
     this.Effect = Effect;
     this.Matrix = Matrix;
 }
开发者ID:CodeTreeCommunity,项目名称:Shooter2D,代码行数:12,代码来源:Batch.cs


注:本文中的SpriteSortMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。