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


C# ICamera2D.GetViewArea方法代码示例

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


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

示例1: HandleDrawAfterMap

            /// <summary>
            /// When overridden in the derived class, handles drawing to the map after all of the map drawing finishes.
            /// </summary>
            /// <param name="map">The map the drawing is taking place on.</param>
            /// <param name="spriteBatch">The <see cref="ISpriteBatch"/> to draw to.</param>
            /// <param name="camera">The <see cref="ICamera2D"/> that describes the view of the map being drawn.</param>
            protected override void HandleDrawAfterMap(IDrawableMap map, ISpriteBatch spriteBatch, ICamera2D camera)
            {
                var p = Parent;
                if (p == null)
                    return;

                // Ensure the map is valid
                var clientMap = map as EditorMap;
                if (clientMap == null)
                    return;

                var viewArea = camera.GetViewArea();

                // Draw the walls
                if (p.DrawWalls)
                {
                    var visibleWalls = map.Spatial.GetMany<WallEntityBase>(viewArea);
                    foreach (var wall in visibleWalls)
                    {
                        EntityDrawer.Draw(spriteBatch, camera, wall);
                    }
                }

                // Draw the MapGrh walls
                if (p.DrawMapGrhWalls)
                {
                    var mapGrhWalls = GlobalState.Instance.MapGrhWalls;
                    var toDraw = clientMap.Spatial.GetMany<MapGrh>(viewArea);
                    var tmpWall = new WallEntity(Vector2.Zero, Vector2.Zero);

                    foreach (var mg in toDraw)
                    {
                        var boundWalls = mapGrhWalls[mg.Grh.GrhData];
                        if (boundWalls == null)
                            continue;

                        foreach (var wall in boundWalls)
                        {
                            tmpWall.Size = wall.Size != Vector2.Zero ? wall.Size * mg.Scale : mg.Size;
                            tmpWall.Position = mg.Position + (wall.Position * mg.Scale);
                            tmpWall.IsPlatform = wall.IsPlatform;
                            EntityDrawer.Draw(spriteBatch, camera, tmpWall);
                        }
                    }
                }
            }
开发者ID:mateuscezar,项目名称:netgore,代码行数:52,代码来源:MapWallsDrawerTool.cs

示例2: HandleDrawAfterMap

            /// <summary>
            /// When overridden in the derived class, handles drawing to the map after all of the map drawing finishes.
            /// </summary>
            /// <param name="map">The map the drawing is taking place on.</param>
            /// <param name="spriteBatch">The <see cref="ISpriteBatch"/> to draw to.</param>
            /// <param name="camera">The <see cref="ICamera2D"/> that describes the view of the map being drawn.</param>
            protected override void HandleDrawAfterMap(IDrawableMap map, ISpriteBatch spriteBatch, ICamera2D camera)
            {
                var p = Parent;
                if (p == null)
                    return;

                // Ensure the map is valid
                var clientMap = map as EditorMap;
                if (clientMap == null)
                    return;

                var viewArea = camera.GetViewArea();

                // Draw the walls
                if (p.DrawWalls)
                {
                    var visibleWalls = map.Spatial.GetMany<WallEntityBase>(viewArea);
                    foreach (var wall in visibleWalls)
                    {
                        EntityDrawer.Draw(spriteBatch, camera, wall);
                    }
                }

                // Draw the MapGrh walls
                if (p.DrawMapGrhWalls)
                {
                    var toDraw = clientMap.Spatial.GetMany<MapGrh>(viewArea);
                    foreach (var mg in toDraw)
                    {
                        var boundWalls = GlobalState.Instance.MapGrhWalls[mg.Grh.GrhData];
                        if (boundWalls == null)
                            continue;

                        foreach (var wall in boundWalls)
                        {
                            EntityDrawer.Draw(spriteBatch, camera, wall, mg.Position);
                        }
                    }
                }
            }
开发者ID:mateuscezar,项目名称:netgore,代码行数:46,代码来源:MapWallsDrawerTool.cs


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