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


C# Framework.GameSettings类代码示例

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


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

示例1: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            if (StepCount == 12)
            {
                StepCount += 0;
            }

            base.Update(settings, gameTime);

            if (Distance.GJKCalls > 0)
            {
                DebugView.DrawString(50, TextLine, "GJK calls = {0}, Ave GJK iters = {1}, Max GJK iters = {2}",
                                     Distance.GJKCalls, Distance.GJKIters / (float)Distance.GJKCalls,
                                     Distance.GJKMaxIters);
                TextLine += 15;
            }

            if (TimeOfImpact.TOICalls > 0)
            {
                DebugView.DrawString(50, TextLine, "TOI calls = {0}, Ave TOI iters = {1}, Max TOI iters = {2}",
                                     TimeOfImpact.TOICalls, TimeOfImpact.TOIIters / (float)TimeOfImpact.TOICalls,
                                     TimeOfImpact.TOIMaxRootIters);
                TextLine += 15;

                DebugView.DrawString(50, TextLine, "Ave TOI root iters = {0}, Max TOI root iters = {1}",
                                     TimeOfImpact.TOIRootIters / (float)TimeOfImpact.TOICalls,
                                     TimeOfImpact.TOIMaxRootIters);
                TextLine += 15;
            }

            if (StepCount % 60 == 0)
            {
                //Launch();
            }
        }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:35,代码来源:ContinuousTest.cs

示例2: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            base.Update(settings, gameTime);

            PolygonShape shape = new PolygonShape(new Vertices(_points), 0f);

            DebugView.DrawString(5, TextLine, "Press g to generate a new random convex hull");
            TextLine += 15;

            DebugView.BeginCustomDraw(ref GameInstance.Projection, ref GameInstance.View);
            DebugView.DrawPolygon(shape.Vertices.ToArray(), shape.Vertices.Count, new Color(0.9f, 0.9f, 0.9f));

            for (int i = 0; i < _count; ++i)
            {
                DebugView.DrawPoint(_points[i], 0.1f, new Color(0.9f, 0.5f, 0.5f));
                Vector2 position = GameInstance.ConvertWorldToScreen(_points[i]);
                DebugView.DrawString((int)position.X, (int)position.Y, i.ToString());
            }

            DebugView.EndCustomDraw();

            if (shape.Vertices.IsConvex() == false)
            {
                TextLine += 0;
            }

            if (_auto)
            {
                Generate();
            }
        }
开发者ID:boris2,项目名称:mmogameproject2,代码行数:31,代码来源:ConvexHullTest.cs

示例3: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            Manifold manifold = new Manifold();
            Collision.Collision.CollidePolygons(ref manifold, _polygonA, ref _transformA, _polygonB, ref _transformB);

            Vector2 normal;
            FixedArray2<Vector2> points;
            Collision.Collision.GetWorldManifold(ref manifold, ref _transformA, _polygonA.Radius,
                                                 ref _transformB, _polygonB.Radius, out normal, out points);

            DebugView.DrawString(50, TextLine, "Point count = {0:n0}", manifold.PointCount);
            TextLine += 15;
            DebugView.BeginCustomDraw();
            {
                Color color = new Color(0.9f, 0.9f, 0.9f);
                Vector2[] v = new Vector2[Settings.MaxPolygonVertices];
                for (int i = 0; i < _polygonA.Vertices.Count; ++i)
                {
                    v[i] = MathUtils.Multiply(ref _transformA, _polygonA.Vertices[i]);
                }
                DebugView.DrawPolygon(v, _polygonA.Vertices.Count, color);

                for (int i = 0; i < _polygonB.Vertices.Count; ++i)
                {
                    v[i] = MathUtils.Multiply(ref _transformB, _polygonB.Vertices[i]);
                }
                DebugView.DrawPolygon(v, _polygonB.Vertices.Count, color);
            }

            for (int i = 0; i < manifold.PointCount; ++i)
            {
                DebugView.DrawPoint(points[i], 0.1f, new Color(0.9f, 0.3f, 0.3f));
            }
            DebugView.EndCustomDraw();
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:35,代码来源:PolyCollisionTest.cs

示例4: Update

 public override void Update(GameSettings settings, GameTime gameTime)
 {
     base.Update(settings, gameTime);
     DebugView.DrawString(50, TextLine,
                          "Segments: " + _segments +
                          "\nPress: 'A' to increase segments, 'S' decrease segments\n'D' to create rectangle. 'F' to create capsule.");
     TextLine += 15;
 }
开发者ID:danielselnick,项目名称:Geometric-Replication,代码行数:8,代码来源:RoundedRectangle.cs

示例5: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            Body body = BodyFactory.CreateCircle(World, 0.4f, 1);
            body.Position = new Vector2(Rand.RandomFloat(-35, 35), 10);
            body.BodyType = BodyType.Dynamic;
            body.Restitution = 1f;

            base.Update(settings, gameTime);
        }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:9,代码来源:DeletionTest.cs

示例6: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            base.Update(settings, gameTime);

            float ratio = _joint1.Ratio;
            float l = _joint1.LengthA + ratio * _joint1.LengthB;
            DebugView.DrawString(50, TextLine, "L1 + {0:n} * L2 = {1:n}", ratio, l);
            TextLine += 15;
        }
开发者ID:hilts-vaughan,项目名称:Farseer-Physics,代码行数:9,代码来源:PulleysTest.cs

示例7: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            _time += 0.01f;
            if (_time > 1f)
                _time = 0;

            PathManager.MoveBodyOnPath(_path, _movingBody, _time, 1f, 1f / 60f);

            base.Update(settings, gameTime);
        }
开发者ID:danzel,项目名称:FarseerPhysics,代码行数:10,代码来源:PathTest.cs

示例8: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            base.Update(settings, gameTime);

            if (_count < Count)
            {
                Body box = BodyFactory.CreateRectangle(World, 0.125f * 2, 0.125f * 2, 1, new Vector2(0, 10));
                box.BodyType = BodyType.Dynamic;
                ++_count;
            }
        }
开发者ID:boris2,项目名称:mmogameproject2,代码行数:11,代码来源:TumblerTest.cs

示例9: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            DebugView.DrawString(50, TextLine,
                                 "SimpleWindForce | Mouse: Direction | Left-Click: Position | W/S: Variation");
            TextLine += 15;
            DebugView.DrawString(50, TextLine, "Wind Strength:" + _simpleWind.Strength);
            TextLine += 15;
            DebugView.DrawString(50, TextLine, "Variation:" + _simpleWind.Variation);

            DebugView.BeginCustomDraw();
            //DebugView.DrawSegment(SimpleWind.Position, SimpleWind.Direction-SimpleWind.Position, Color.Red);
            DrawPointForce();
            DebugView.EndCustomDraw();
            base.Update(settings, gameTime);
        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:15,代码来源:SimpleWindForceTest.cs

示例10: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            base.Update(settings, gameTime);

            DistanceInput input = new DistanceInput();
            input.ProxyA.Set(_polygonA, 0);
            input.ProxyB.Set(_polygonB, 0);
            input.TransformA = _transformA;
            input.TransformB = _transformB;
            input.UseRadii = true;
            SimplexCache cache;
            cache.Count = 0;
            DistanceOutput output;
            Distance.ComputeDistance(out output, out cache, input);

            DebugView.DrawString(50, TextLine, "Distance = {0:n7}", output.Distance);
            TextLine += 15;

            DebugView.DrawString(50, TextLine, "Iterations = {0:n0}", output.Iterations);
            TextLine += 15;

            DebugView.BeginCustomDraw();
            {
                Color color = new Color(0.9f, 0.9f, 0.9f);
                CCVector2[] v = new CCVector2[Settings.MaxPolygonVertices];
                for (int i = 0; i < _polygonA.Vertices.Count; ++i)
                {
                    v[i] = (CCVector2)MathUtils.Multiply(ref _transformA, _polygonA.Vertices[i]);
                }
				DebugView.DrawPolygon(v, _polygonA.Vertices.Count, color);

                for (int i = 0; i < _polygonB.Vertices.Count; ++i)
                {
                    v[i] = (CCVector2)MathUtils.Multiply(ref _transformB, _polygonB.Vertices[i]);
                }
				DebugView.DrawPolygon(v, _polygonB.Vertices.Count, color);
            }

            Vector2 x1 = output.PointA;
            Vector2 x2 = output.PointB;


            DebugView.DrawPoint(x1, 0.5f, new Color(1.0f, 0.0f, 0.0f));
            DebugView.DrawPoint(x2, 0.5f, new Color(1.0f, 0.0f, 0.0f));

            DebugView.DrawSegment(x1, x2, new Color(1.0f, 1.0f, 0.0f));
            DebugView.EndCustomDraw();
        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:48,代码来源:DistanceTest.cs

示例11: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            DebugView.DrawString(50, TextLine, "Press A,S,W,D move endpoint");
            TextLine += 15;
            DebugView.DrawString(50, TextLine, "Press Enter to cut");
            TextLine += 15;
            DebugView.DrawString(50, TextLine, "Press TAB to change endpoint");
            TextLine += 15;

            DebugView.BeginCustomDraw();
            DebugView.DrawSegment(_start, _end, Color.Red);
            DebugView.EndCustomDraw();

            List<Fixture> fixtures = new List<Fixture>();
            List<Vector2> entryPoints = new List<Vector2>();
            List<Vector2> exitPoints = new List<Vector2>();

            //Get the entry points
            World.RayCast((f, p, n, fr) =>
                              {
                                  fixtures.Add(f);
                                  entryPoints.Add(p);
                                  return 1;
                              }, _start, _end);

            //Reverse the ray to get the exitpoints
            World.RayCast((f, p, n, fr) =>
                              {
                                  exitPoints.Add(p);
                                  return 1;
                              }, _end, _start);

            DebugView.DrawString(50, TextLine, "Fixtures: " + fixtures.Count);

            DebugView.BeginCustomDraw();
            foreach (Vector2 entryPoint in entryPoints)
            {
                DebugView.DrawPoint(entryPoint, 0.5f, Color.Yellow);
            }

            foreach (Vector2 exitPoint in exitPoints)
            {
                DebugView.DrawPoint(exitPoint, 0.5f, Color.PowderBlue);
            }
            DebugView.EndCustomDraw();

            base.Update(settings, gameTime);
        }
开发者ID:h7ing,项目名称:CocosSharp,代码行数:48,代码来源:CuttingTest.cs

示例12: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            base.Update(settings, gameTime);

            if (m_Count < Count)
            {
                var body = BodyFactory.CreateBody(World, new Vector2(0.0f, 10.0f));
                body.BodyType = BodyType.Dynamic;
                
                PolygonShape shape = new PolygonShape(5);
                shape.SetAsBox(0.125f, 0.125f);

                body.CreateFixture(shape);

                m_Count++;
            }
        }
开发者ID:Karunp,项目名称:cocos2d-xna,代码行数:17,代码来源:Tumbler.cs

示例13: Update

		public override void Update(GameSettings settings, GameTime gameTime)
		{
			base.Update(settings, gameTime);
			
			
			if (!settings.Pause && settings.Hz > 0.0f)
				_time += 1.0f / settings.Hz;
			
			Vector2 linearOffset = new Vector2();
			linearOffset.X = 6.0f * (float)Math.Sin(2.0f * _time);
			linearOffset.Y = 8.0f + 4.0f * (float)Math.Sin(1.0f * _time);
			
			float angularOffset = 4.0f * _time;
			
			_joint.LinearOffset = linearOffset;
			_joint.AngularOffset = angularOffset;
		}
开发者ID:netonjm,项目名称:Rube.Net,代码行数:17,代码来源:TestDemos.cs

示例14: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            time += gameTime.ElapsedGameTime.Milliseconds;

            if (time > 100)
            {
                time = 0;
                if (save)
                {
                    WorldSerializer.Serialize(World, "out.xml");
                }
                else
                {
                    WorldSerializer.Deserialize(World, "out.xml");
                }

                save = !save;
            }
            base.Update(settings, gameTime);
        }
开发者ID:danzel,项目名称:FarseerPhysics,代码行数:20,代码来源:SerializationTest.cs

示例15: Update

        public override void Update(GameSettings settings, GameTime gameTime)
        {
            _count++;

            if (_count < 50)
            {
                const float x = 0;
                const float y = 15;

                Body body = BodyFactory.CreateBody(World);

                body.Position = new Vector2(x, y);
                body.BodyType = BodyType.Dynamic;

                Fixture fixture = body.CreateFixture(_polyShape);
                fixture.Friction = 0.3f;
            }

            base.Update(settings, gameTime);
        }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:20,代码来源:EdgeShapeBenchmark.cs


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