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


C# RenderManager.DrawSprite方法代码示例

本文整理汇总了C#中RenderManager.DrawSprite方法的典型用法代码示例。如果您正苦于以下问题:C# RenderManager.DrawSprite方法的具体用法?C# RenderManager.DrawSprite怎么用?C# RenderManager.DrawSprite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RenderManager的用法示例。


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

示例1: Draw

        public override void Draw(RenderManager renderMgr, Camera camera)
        {
            int xStart = (int)((camera.Center.X - camera.Size.X * 0.5f) / TileWidth);
            int xEnd = (int)(1 + (camera.Center.X + camera.Size.X * 0.5f) / TileWidth);

            var yStart = (int)((camera.Center.Y - camera.Size.Y * 0.5f) / TileHeight);
            var yEnd = (int)(1 + (camera.Center.Y + camera.Size.Y * 0.5f) / TileHeight); ;

            if (xStart < 0)
                xStart = 0;
            if (xEnd > MapWidth - 1)
                xEnd = MapWidth - 1;
            if (yStart < 0)
                yStart = 0;
            if (yEnd > MapHeight - 1)
                yEnd = MapHeight - 1;

            for (var i = xStart; i < xEnd; i++)
            {
                for (var j = yStart; j < yEnd; j++)
                {
                    if (Tiles[i, j].Texture == null)
                        continue;

                    var position = new Vector2f(
                                    TileWidth * i + TileWidth * 0.5f,
                                    TileHeight * j + TileHeight * 0.5f);

                    renderMgr.DrawSprite(Tiles[i, j].Texture, Tiles[i, j].SubImageRect, position + WorldPosition, TileWidth, TileHeight, false, false, Tint, ZIndex);

                }
            }
        }
开发者ID:robert-porter,项目名称:Jeden,代码行数:33,代码来源:TileMapRenderComponent.cs

示例2: Draw

        public void Draw(RenderManager renderMgr)
        {
            IntRect subImageRect = new IntRect(0, 0, (int) texture.Size.X, (int) texture.Size.Y);
            Vector2f centerPos = new Vector2f(box.Left + box.Width * 0.5f, box.Top + box.Height * 0.5f);

            renderMgr.DrawSprite(texture, subImageRect, centerPos, box.Width, box.Height, false, false, new Color(255, 255, 255, 255), 10000);
        }
开发者ID:robert-porter,项目名称:Jeden,代码行数:7,代码来源:Button.cs

示例3: Draw

 public override void Draw(RenderManager renderMgr, Camera camera)
 {
     renderMgr.DrawSprite(
         CurrentSprite.Texture,
         CurrentSprite.SubImageRect,
         WorldPosition,
         WorldWidth,
         WorldHeight,
         FlipX,
         FlipY,
         Tint, ZIndex);
 }
开发者ID:robert-porter,项目名称:Jeden,代码行数:12,代码来源:SpriteSetRenderComponent.cs

示例4: Draw

 /// <summary>
 /// Draws the animation.
 /// </summary>
 public void Draw(RenderManager renderMgr, 
                         Vector2f centerPos,
                         float viewWidth,
                         float viewHeight,
                         bool flipX,
                         bool flipY,
                         Color tint,
                         int zIndex)
 {
     renderMgr.DrawSprite(Frames[CurrentFrame].Texture, Frames[CurrentFrame].SubImageRect,
         centerPos, viewWidth, viewHeight, flipX, flipY, tint, zIndex);
 }
开发者ID:robert-porter,项目名称:Jeden,代码行数:15,代码来源:Animation.cs

示例5: Draw

 /// <summary>
 /// Draw it.
 /// </summary>
 /// <param name="renderMgr"></param>
 /// <param name="camera"></param>
 public override void Draw(RenderManager renderMgr, Camera camera)
 {
     //add camera position to where we want to draw on the screen, and let the view transform just subtract it back off
     renderMgr.DrawSprite(Texture, SubImageRect, (WorldPosition - camera.Center) * ParallaxFactor + camera.Center,
         WorldWidth, WorldHeight, FlipX, FlipY, Tint, ZIndex);
 }
开发者ID:robert-porter,项目名称:Jeden,代码行数:11,代码来源:ParallaxRenderComponent.cs


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