• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SpriteSortMode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Begin

		public void Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix)
		{
			_sortMode = sortMode;
			
			_blendState = (blendState == null) ? BlendState.AlphaBlend : blendState;
			_depthStencilState = (depthStencilState == null) ? DepthStencilState.None : depthStencilState;
			_samplerState = (samplerState == null) ? SamplerState.LinearClamp : samplerState;
			_rasterizerState =  (rasterizerState == null) ? RasterizerState.CullCounterClockwise : rasterizerState;
			
			_effect = effect;
			_matrix = transformMatrix;
		}
开发者ID:HaKDMoDz,项目名称:Zazumo,代码行数:12,代码来源:SpriteBatch.cs


示例17: Begin

        public void Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix)
        {
            _sortMode = sortMode;

            _blendState = blendState ?? BlendState.AlphaBlend;
            _depthStencilState = depthStencilState ?? DepthStencilState.None;
            _samplerState = samplerState ?? SamplerState.LinearClamp;
            _rasterizerState = rasterizerState ?? RasterizerState.CullCounterClockwise;

            if(effect != null)
                _effect = effect;
            _matrix = transformMatrix;
        }
开发者ID:Clancey,项目名称:MonoGame,代码行数:13,代码来源:SpriteBatch.cs


示例18: Begin

 public void Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix)
 {
   this._sortMode = sortMode;
   this._blendState = blendState ?? BlendState.AlphaBlend;
   this._samplerState = samplerState ?? SamplerState.LinearClamp;
   this._depthStencilState = depthStencilState ?? DepthStencilState.None;
   this._rasterizerState = rasterizerState ?? RasterizerState.CullCounterClockwise;
   this._effect = effect;
   this._matrix = transformMatrix;
   if (sortMode == SpriteSortMode.Immediate)
     this.Setup();
   this._beginCalled = true;
 }
开发者ID:tanis2000,项目名称:FEZ,代码行数:13,代码来源:SpriteBatch.cs


示例19: SpriteBatchStruct

 public SpriteBatchStruct(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState,
                               DepthStencilState depthStencilState, RasterizerState rasterizerState,
                               Effect effect, Camera camera)
 {
     SB = new SpriteBatch(Drawing.StaticGraphicsDevice);
     SB_SpriteSortMode = sortMode;
     SB_BlendState = blendState;
     SB_SamplerState = samplerState;
     SB_DepthStencilState = depthStencilState;
     SB_RasterizerState = rasterizerState;
     SB_Effect = effect;
     SB_Camera = camera;
     wasBegin = false;
 }
开发者ID:Psy-Effects,项目名称:DoomEffect,代码行数:14,代码来源:SpriteBatchStruct.cs


示例20: Begin

        /// <summary>
        /// Begins a new sprite batch using the appropriate settings for rendering UPF.
        /// </summary>
        /// <param name="sortMode">The sorting mode to use when rendering interface elements.</param>
        /// <param name="blendState">The blend state to apply to the rendered elements.</param>
        /// <param name="samplerState">The sampler state to apply to the rendered interface elements.</param>
        /// <param name="effect">The custom effect to apply to the rendered interface elements.</param>
        /// <param name="localTransform">The transform matrix to apply to the rendered interface elements.</param>
        public void Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, Effect effect, Matrix localTransform)
        {
            if (SpriteBatch == null)
                throw new InvalidOperationException(PresentationStrings.DrawingContextDoesNotHaveSpriteBatch);

            this.localTransform = localTransform;
            this.combinedTransform = Matrix.Identity;
            Matrix.Concat(ref localTransform, ref globalTransform, out combinedTransform);

            SpriteBatch.Begin(sortMode, 
                blendState ?? BlendState.AlphaBlend,
                samplerState ?? SamplerState.LinearClamp, 
                StencilReadDepthState, RasterizerState.CullCounterClockwise, effect, combinedTransform);
        }
开发者ID:prshreshtha,项目名称:ultraviolet,代码行数:22,代码来源:DrawingContext.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Sql类代码示例发布时间:2022-05-24
下一篇:
C# SpriteRoot类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap