コード例 #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            GraphicsDevice.RasterizerState = new RasterizerState
            {
                CullMode = CullMode.None
            };
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch    = new SpriteBatch(GraphicsDevice);
            primitiveBatch = new PrimitiveBatch(GraphicsDevice);
            debugDraw      = new ChipmunkDebugDraw(primitiveBatch);

            demo = new DemoBase[]
            {
                new LogoSmash(),
                new PyramidStack(),
                new Tumble(),
                new Plink(),
                new PyramidTopple(),
                new Slice(),
                new Planet(),
                new Tank()
            };

            float width  = GraphicsDevice.Viewport.Width;
            float height = GraphicsDevice.Viewport.Height;

            world      = Matrix.Identity;
            view       = Matrix.CreateLookAt(Vector3.Zero, Vector3.Forward, Vector3.Up);
            projection = Matrix.CreateOrthographic(width, height, 0, -1);
            inverse    = Matrix.CreateScale(1, -1, 1) * Matrix.CreateTranslation(-width / 2, height / 2, 0);

            primitiveBatch.LoadContent(ref world, ref view, ref projection);

            LoadDemo();
        }
コード例 #2
0
 public ChipmunkDebugDraw(PrimitiveBatch primitiveBatch)
 {
     this.primitiveBatch = primitiveBatch;
 }