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

C# IntPoint类代码示例

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

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



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

示例1: ApplySetPieces

        public static void ApplySetPieces(World world)
        {
            var map = world.Map;
            int w = map.Width, h = map.Height;

            Random rand = new Random();
            HashSet<Rect> rects = new HashSet<Rect>();
            foreach (var dat in setPieces)
            {
                int size = dat.Item1.Size;
                int count = rand.Next(dat.Item2, dat.Item3);
                for (int i = 0; i < count; i++)
                {
                    IntPoint pt = new IntPoint();
                    Rect rect;

                    int max = 50;
                    do
                    {
                        pt.X = rand.Next(0, w);
                        pt.Y = rand.Next(0, h);
                        rect = new Rect() { x = pt.X, y = pt.Y, w = size, h = size };
                        max--;
                    } while ((Array.IndexOf(dat.Item4, map[pt.X, pt.Y].Terrain) == -1 ||
                             rects.Any(_ => Rect.Intersects(rect, _))) &&
                             max > 0);
                    if (max <= 0) continue;
                    dat.Item1.RenderSetPiece(world, pt);
                    rects.Add(rect);
                }
            }
        }
开发者ID:BlackRayquaza,项目名称:MMOE,代码行数:32,代码来源:SetPieces.cs


示例2: Resolve

 protected internal override void Resolve(State parent)
 {
     parent.Death += (sender, e) =>
     {
         var dat = e.Host.Manager.GameData;
         var w = e.Host.Owner;
         var pos = new IntPoint((int) e.Host.X - (dist/2), (int) e.Host.Y - (dist/2));
         if (w == null) return;
         for (int x = 0; x < dist; x++)
         {
             for (int y = 0; y < dist; y++)
             {
                 WmapTile tile = w.Map[x + pos.X, y + pos.Y].Clone();
                 if (groundToChange != null)
                 {
                     foreach (string type in groundToChange)
                     {
                         int r = Random.Next(targetType.Length);
                         if (tile.TileId == dat.IdToTileType[type])
                         {
                             tile.TileId = dat.IdToTileType[targetType[r]];
                             w.Map[x + pos.X, y + pos.Y] = tile;
                         }
                     }
                 }
                 else
                 {
                     int r = Random.Next(targetType.Length);
                     tile.TileId = dat.IdToTileType[targetType[r]];
                     w.Map[x + pos.X, y + pos.Y] = tile;
                 }
             }
         }
     };
 }
开发者ID:SirAnuse,项目名称:fabiano-swagger-of-doom,代码行数:35,代码来源:ChangeGroundOnDeath.cs


示例3: InequalityOperatorTest

        public void InequalityOperatorTest( int x1, int y1, int x2, int y2, bool areNotEqual )
        {
            IntPoint point1 = new IntPoint( x1, y1 );
            IntPoint point2 = new IntPoint( x2, y2 );

            Assert.AreEqual( point1 != point2, areNotEqual );
        }
开发者ID:hungdluit,项目名称:aforge,代码行数:7,代码来源:IntPointTest.cs


示例4: UpdateTile

        // called for each visible tile
        protected override void UpdateTile(UIElement _tile, IntPoint ml)
        {
            MapControlTile tile = (MapControlTile)_tile;

            BitmapSource bmp;

            if (m_map.Bounds.Contains(ml))
            {
                byte b = m_map.MapArray[ml.Y, ml.X];

                if (b < 100)
                    bmp = m_symbolBitmapCache.GetBitmap(SymbolID.Wall, Colors.Black, false);
                else
                    bmp = m_symbolBitmapCache.GetBitmap(SymbolID.Floor, Colors.Black, false);
            }
            else
            {
                bmp = null;
            }

            if (bmp != tile.Bitmap)
            {
                tile.Bitmap = bmp;
            }
        }
开发者ID:tomba,项目名称:dwarrowdelf,代码行数:26,代码来源:MapControl1.cs


示例5: Shift

 /// <summary>
 /// Shift cloud by adding specified value to all points in the collection.
 /// </summary>
 /// 
 /// <param name="cloud">Collection of points to shift their coordinates.</param>
 /// <param name="shift">Point to shift by.</param>
 /// 
 public static void Shift( List<IntPoint> cloud, IntPoint shift )
 {
     for ( int i = 0, n = cloud.Count; i < n; i++ )
     {
         cloud[i] = cloud[i] + shift;
     }
 }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:14,代码来源:PointsCloud.cs


示例6: RenderSetPiece

        public void RenderSetPiece(World world, IntPoint pos)
        {
            int[,] t = new int[5, 5];

            t[0, 2] = 1;
            t[1, 2] = 1;
            t[2, 2] = 1;
            t[3, 2] = 1;
            t[4, 2] = 1;
            t[2, 0] = 1;
            t[2, 1] = 1;
            t[2, 3] = 1;
            t[2, 4] = 1;
            t[1, 1] = 1;
            t[1, 3] = 1;
            t[3, 3] = 1;
            t[3, 1] = 1;

            for (int x = 0; x < 5; x++)                    //Rendering
                for (int y = 0; y < 5; y++)
                {
                    if (t[x, y] == 1)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.TileId = Lava; tile.ObjType = 0;
                        if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                }
        }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:30,代码来源:TempLava3.cs


示例7: RenderSetPiece

        public void RenderSetPiece(World world, IntPoint pos)
        {
            var deepWaterRadius = 1f;

            var border = new List<IntPoint>();

            var t = new int[Size, Size];

            for (var y = 0; y < Size; y++) //Replace Deep Water With NWater
                for (var x = 0; x < Size; x++)
                {
                    var dx = x - (Size/2.0);
                    var dy = y - (Size/2.0);
                    var r = Math.Sqrt(dx*dx + dy*dy);
                    if (r <= deepWaterRadius)
                    {
                        t[x, y] = 1;
                    }
                }
            for (var x = 0; x < Size; x++)
                for (var y = 0; y < Size; y++)
                {
                    if (t[x, y] == 1)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.TileId = Water;
                        tile.ObjType = 0;
                        world.Obstacles[x + pos.X, y + pos.Y] = 0;
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                }
        }
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:32,代码来源:HermitOnDeath.cs


示例8: RenderSetPiece

        public void RenderSetPiece(World world, IntPoint pos)
        {
            Entity boss = Entity.Resolve(world.Manager, "shtrs Bridge Sentinel");
            boss.Move(pos.X, pos.Y);

            Entity chestSpawner = Entity.Resolve(world.Manager, "shtrs encounterchestspawner");
            chestSpawner.Move(pos.X, pos.Y + 5f);

            Entity blobombSpawner1 = Entity.Resolve(world.Manager, "shtrs blobomb maker");
            blobombSpawner1.Move(pos.X, pos.Y + 5f);

            Entity blobombSpawner2 = Entity.Resolve(world.Manager, "shtrs blobomb maker");
            blobombSpawner2.Move(pos.X + 5f, pos.Y + 5f);

            Entity blobombSpawner3 = Entity.Resolve(world.Manager, "shtrs blobomb maker");
            blobombSpawner3.Move(pos.X - 5f, pos.Y + 5f);

            world.EnterWorld(boss);

            world.EnterWorld(chestSpawner);

            world.EnterWorld(blobombSpawner1);
            world.EnterWorld(blobombSpawner2);
            world.EnterWorld(blobombSpawner3);
        }
开发者ID:OryxAwakening,项目名称:Fabiano_Swagger_of_Doom,代码行数:25,代码来源:BridgeSentinel.cs


示例9: RenderSetPiece

        public void RenderSetPiece(World world, IntPoint pos)
        {
            var cooledRadius = 15;

            var t = new int[Size, Size];

            for (var y = 0; y < Size; y++)
                for (var x = 0; x < Size; x++)
                {
                    var dx = x - Size / 2.0;
                    var dy = y - Size / 2.0;
                    var r = Math.Sqrt(dx * dx + dy * dy);
                    if (r <= cooledRadius)
                        t[x, y] = 1;
                }

            for (var x = 0; x < Size; x++)
                for (var y = 0; y < Size; y++)
                {
                    if (t[x, y] == 1)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();

                        tile.TileId = Cooled; tile.ObjType = 0;

                        if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
                            world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                }
        }
开发者ID:BlackRayquaza,项目名称:PhoenixRealms,代码行数:30,代码来源:EternalCrucible.cs


示例10: RenderSetPiece

        public void RenderSetPiece(World world, IntPoint pos)
        {
            var dat = world.Manager.GameData;
            for (int x = 0; x < Size; x++)
                for (int y = 0; y < Size; y++)
                {
                    double dx = x - (Size / 2.0);
                    double dy = y - (Size / 2.0);
                    double r = Math.Sqrt(dx * dx + dy * dy) + rand.NextDouble() * 4 - 2;
                    if (r <= 10)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.TileId = dat.IdToTileType[Floor]; tile.ObjType = 0;
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                }

            Entity lord = Entity.Resolve(world.Manager, "Phoenix Lord");
            lord.Move(pos.X + 15.5f, pos.Y + 15.5f);
            world.EnterWorld(lord);

            Container container = new Container(world.Manager, 0x0501, null, false);
            Item[] items = chest.GetLoots(world.Manager, 5, 8).ToArray();
            for (int i = 0; i < items.Length; i++)
                container.Inventory[i] = items[i];
            container.Move(pos.X + 15.5f, pos.Y + 15.5f);
            world.EnterWorld(container);
        }
开发者ID:Topnenyie,项目名称:rotmg_svr,代码行数:28,代码来源:Pyre.cs


示例11: RenderSetPiece

        public void RenderSetPiece(World world, IntPoint pos)
        {
            for (int x = 0; x < Size; x++)
                for (int y = 0; y < Size; y++)
                {
                    double dx = x - (Size / 2.0);
                    double dy = y - (Size / 2.0);
                    double r = Math.Sqrt(dx * dx + dy * dy) + rand.NextDouble() * 4 - 2;
                    if (r <= 10)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.TileId = Floor; tile.ObjType = 0;
                        world.Obstacles[x + pos.X, y + pos.Y] = 0;
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                }

            Entity lord = Entity.Resolve(0x675);
            lord.Move(pos.X + 15.5f, pos.Y + 15.5f);
            world.EnterWorld(lord);

            Container container = new Container(0x0501, null, false);
            int count = rand.Next(5, 8);
            List<Item> items = new List<Item>();
            while (items.Count < count)
            {
                Item item = chest.GetRandomLoot(rand);
                if (item != null) items.Add(item);
            }
            for (int i = 0; i < items.Count; i++)
                container.Inventory[i] = items[i];
            container.Move(pos.X + 15.5f, pos.Y + 15.5f);
            world.EnterWorld(container);
        }
开发者ID:rotmgkillroyx,项目名称:rotmg_svr_OLD,代码行数:34,代码来源:Pyre.cs


示例12: RenderSetPiece

        public void RenderSetPiece(World world, IntPoint pos)
        {
            int heatedRadius = 15;

            int[,] t = new int[Size, Size];

            for (int y = 0; y < Size; y++)
                for (int x = 0; x < Size; x++)
                {
                    double dx = x - (Size / 2.0);
                    double dy = y - (Size / 2.0);
                    double r = Math.Sqrt(dx * dx + dy * dy);
                    if (r <= heatedRadius)
                        t[x, y] = 1;
                }

            for (int x = 0; x < Size; x++)
                for (int y = 0; y < Size; y++)
                {
                    if (t[x, y] == 1)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();

                        tile.TileId = Heated; tile.ObjType = 0;

                        if (world.Obstacles[x + pos.X, y + pos.Y] == 0)
                            world.Map[x + pos.X, y + pos.Y] = tile;

                    }
                }
        }
开发者ID:RoxyLalonde,项目名称:Phoenix-Realms,代码行数:31,代码来源:EternalCrucible.cs


示例13: GetBoundingRectangle

        /// <summary>
        /// Get bounding rectangle of the specified list of points.
        /// </summary>
        /// 
        /// <param name="cloud">Collection of points to get bounding rectangle for.</param>
        /// <param name="minXY">Point comprised of smallest X and Y coordinates.</param>
        /// <param name="maxXY">Point comprised of biggest X and Y coordinates.</param>
        /// 
        public static void GetBoundingRectangle( List<IntPoint> cloud, out IntPoint minXY, out IntPoint maxXY )
        {
            if ( cloud.Count == 0 )
                throw new ArgumentException( "List of points can not be empty." );

            // take first point as min and max
            int minX = cloud[0].X;
            int maxX = cloud[0].X;
            int minY = cloud[0].Y;
            int maxY = cloud[0].Y;

            for ( int i = 1, n = cloud.Count; i < n; i++ )
            {
                int x = cloud[i].X;
                int y = cloud[i].Y;

                // check X coordinate
                if ( x < minX )
                    minX = x;
                if ( x > maxX )
                    maxX = x;

                // check Y coordinate
                if ( y < minY )
                    minY = y;
                if ( y > maxY )
                    maxY = y;
            }

            minXY = new IntPoint( minX, minY );
            maxXY = new IntPoint( maxX, maxY );
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:40,代码来源:PointsCloud.cs


示例14: RoundTest

        public void RoundTest( float x, float y, int expectedX, int expectedY )
        {
            Point point = new Point( x, y );
            IntPoint iPoint = new IntPoint( expectedX, expectedY );

            Assert.AreEqual( iPoint, point.Round( ) );
        }
开发者ID:accord-net,项目名称:framework,代码行数:7,代码来源:PointTest.cs


示例15: GetAngleBetweenLines

        /// <summary>
        /// Calculate minimum angle between two lines measured in [0, 90] degrees range.
        /// </summary>
        /// 
        /// <param name="line1start">Starting point of the first line.</param>
        /// <param name="line1end">Ending point of the first line.</param>
        /// <param name="line2start">Starting point of the second line.</param>
        /// <param name="line2end">Ending point of the second line.</param>
        /// 
        /// <returns>Returns minimum angle between two lines.</returns>
        /// 
        public static double GetAngleBetweenLines( IntPoint line1start, IntPoint line1end, IntPoint line2start, IntPoint line2end )
        {
            double k1, k2;

            if ( line1start.X != line1end.X )
            {
                k1 = (double) ( line1end.Y - line1start.Y ) / ( line1end.X - line1start.X );
            }
            else
            {
                k1 = double.PositiveInfinity;
            }

            if ( line2start.X != line2end.X )
            {
                k2 = (double) ( line2end.Y - line2start.Y ) / ( line2end.X - line2start.X );
            }
            else
            {
                k2 = double.PositiveInfinity;
            }

            // check if lines are parallel
            if ( k1 == k2 )
                return 0;

            double angle = 0;

            if ( ( k1 != double.PositiveInfinity ) && ( k2 != double.PositiveInfinity ) )
            {
                double tanPhi = ( ( k2 > k1 ) ? ( k2 - k1 ) : ( k1 - k2 ) ) / ( 1 + k1 * k2 );
                angle = Math.Atan( tanPhi );
            }
            else
            {
                // one of the lines is parallel to Y axis

                if ( k1 == double.PositiveInfinity )
                {
                    angle = Math.PI / 2 - Math.Atan( k2 ) * Math.Sign( k2 );
                }
                else
                {
                    angle = Math.PI / 2 - Math.Atan( k1 ) * Math.Sign( k1 );
                }
            }

            // convert radians to degrees
            angle *= ( 180.0 / Math.PI );

            if ( angle < 0 )
            {
                angle = -angle;
            }

            return angle;
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:68,代码来源:GeometryTools.cs


示例16: InitTestCase

 /// <summary>
 /// (Re)initialize with a fresh test case.
 /// Returns the target point (center of large box).
 /// </summary>
 public IntPoint InitTestCase(int largeBoxRelativePos)
 {
     // Get small and large box center positions.
     IntPoint[] boxPosArr = GenerateRandomTestCase(largeBoxRelativePos);
     _smallBoxTopLeft = boxPosArr[0];
     _largeBoxTopLeft = boxPosArr[1];
     _largeBoxTopLeft.X--;
     _largeBoxTopLeft.Y--;
     return boxPosArr[1];
 }
开发者ID:roesslerz,项目名称:SharpBackpropNeat,代码行数:14,代码来源:TestCaseField.cs


示例17: GetAngleBetweenVectors

        /// <summary>
        /// Calculate angle between to vectors measured in [0, 180] degrees range.
        /// </summary>
        /// 
        /// <param name="startPoint">Starting point of both vectors.</param>
        /// <param name="vector1end">Ending point of the first vector.</param>
        /// <param name="vector2end">Ending point of the second vector.</param>
        /// 
        /// <returns>Returns angle between specified vectors measured in degrees.</returns>
        /// 
        public static double GetAngleBetweenVectors( IntPoint startPoint, IntPoint vector1end, IntPoint vector2end )
        {
            int x1 = vector1end.X - startPoint.X;
            int y1 = vector1end.Y - startPoint.Y;

            int x2 = vector2end.X - startPoint.X;
            int y2 = vector2end.Y - startPoint.Y;

            return Math.Acos( ( x1 * x2 + y1 * y2 ) / ( Math.Sqrt( x1 * x1 + y1 * y1 ) * Math.Sqrt( x2 * x2 + y2 * y2 ) ) ) * 180.0 / Math.PI;
        }
开发者ID:nagyistoce,项目名称:Neuroflow,代码行数:20,代码来源:GeometryTools.cs


示例18: TilePlacementHandler

 private void TilePlacementHandler()
  {
      IntPoint nD = ExtendedMath.DistanceIntervals(new Vector2(Cam1.position.x, Cam1.position.z), new Vector2(_chunkCenter.x, _chunkCenter.z), _chunkSize/2);
      if ((nD.x > 0 ^ nD.x < 0) | (nD.y > 0 ^ nD.y < 0))
      {
          _chunkCenter = new Vector2(_chunkCenter.x + (nD.x * _chunkSize.x), _chunkCenter.z + (nD.y * _chunkSize.y));
          IntPoint negaDir = new IntPoint((int)ExtendedMath.InvertValue((nD.x != 0 ? nD.x : nD.y)), (nD.y != 0 ? nD.y : (int)ExtendedMath.InvertValue(nD.x)));
          ShuffleTiles(negaDir);
      }
  }
开发者ID:Jotunson,项目名称:CannibalVsVirginDiamondEditionPrime,代码行数:10,代码来源:ManageTiles.cs


示例19: ApplyTranslation

		public static void ApplyTranslation(this Polygons polygons, IntPoint translation)
		{
			for (int i = 0; i < polygons.Count; i++)
			{
				for (int j = 0; j < polygons[i].Count; j++)
				{
					polygons[i][j] = polygons[i][j] + translation;
				}
			}
		}
开发者ID:broettge,项目名称:MatterSlice,代码行数:10,代码来源:PolygonsHelper.cs


示例20: RenderSetPiece

        public void RenderSetPiece(World world, IntPoint pos)
        {
            var radius = rand.Next(Size - 5, Size + 1)/2;
            var border = new List<IntPoint>();

            var t = new int[Size, Size];
            for (var y = 0; y < Size; y++)
                for (var x = 0; x < Size; x++)
                {
                    var dx = x - (Size/2.0);
                    var dy = y - (Size/2.0);
                    var r = Math.Sqrt(dx*dx + dy*dy);
                    if (r <= radius)
                    {
                        t[x, y] = 1;
                        if (radius - r < 1.5)
                            border.Add(new IntPoint(x, y));
                    }
                }

            var trees = new HashSet<IntPoint>();
            while (trees.Count < border.Count*0.5)
                trees.Add(border[rand.Next(0, border.Count)]);

            foreach (var i in trees)
                t[i.X, i.Y] = 2;

            for (var x = 0; x < Size; x++)
                for (var y = 0; y < Size; y++)
                {
                    if (t[x, y] == 1)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.TileId = Floor;
                        tile.ObjType = 0;
                        world.Obstacles[x + pos.X, y + pos.Y] = 0;
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                    else if (t[x, y] == 2)
                    {
                        var tile = world.Map[x + pos.X, y + pos.Y].Clone();
                        tile.TileId = Floor;
                        tile.ObjType = Tree;
                        tile.Name = "size:" + (rand.Next()%2 == 0 ? 120 : 140);
                        if (tile.ObjId == 0) tile.ObjId = world.GetNextEntityId();
                        world.Obstacles[x + pos.X, y + pos.Y] = 2;
                        world.Map[x + pos.X, y + pos.Y] = tile;
                    }
                }

            var ent = Entity.Resolve(0x091f);
            ent.Size = 140;
            ent.Move(pos.X + Size/2 + 1, pos.Y + Size/2 + 1);
            world.EnterWorld(ent);
        }
开发者ID:RiiggedMPGH,项目名称:Owl-Realms-Source,代码行数:55,代码来源:Grove.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IntPoint3类代码示例发布时间:2022-05-24
下一篇:
C# Int8Image类代码示例发布时间: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