Esempio n. 1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (CollisionDemo game = new CollisionDemo())
     {
         game.Run();
     }
 }
Esempio n. 2
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (CollisionDemo game = new CollisionDemo())
     {
         game.Run();
     }
 }
Esempio n. 3
0
        public override void Draw(GameTime gameTime)
        {
            CollisionDemo demo = Game as CollisionDemo;

            basicEffect.GraphicsDevice.RasterizerState = RasterizerState.CullNone;

            basicEffect.View       = demo.Camera.View;
            basicEffect.Projection = demo.Camera.Projection;

            basicEffect.TextureEnabled = false;
            foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
            {
                pass.Apply();
                if (triangleIndex > 0)
                {
                    GraphicsDevice.DrawUserPrimitives <VertexPositionColor>(
                        PrimitiveType.TriangleList, TriangleList, 0, triangleIndex / 3);
                }

                if (lineIndex > 0)
                {
                    GraphicsDevice.DrawUserPrimitives <VertexPositionColor>(
                        PrimitiveType.LineList, LineList, 0, lineIndex / 2);
                }
            }

            basicEffect.TextureEnabled = true;

            sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, RasterizerState.CullNone, basicEffect);

            foreach (var point in points)
            {
                sb.Draw(pointTex, point, null, Color.White, 0, new Vector2(5, 5), 0.025f, SpriteEffects.None, 0);
            }

            sb.End();

            points.Clear();

            lineIndex     = 0;
            triangleIndex = 0;

            base.Draw(gameTime);
        }