コード例 #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            camera = new Camera(
                new Vector3(0.5f, 0.5f, 0.5f),
                0,
                GraphicsDevice.Viewport.AspectRatio,
                0.05f,
                100f);
            effect = new BasicEffect(GraphicsDevice);
            maze = new Maze(GraphicsDevice);

            base.Initialize();
        }
コード例 #2
0
ファイル: Maze.cs プロジェクト: solarplexus6/XnaBook
        public void Draw(Camera camera, BasicEffect effect)
        {
            effect.VertexColorEnabled = true;
            effect.World = Matrix.Identity;
            effect.View = camera.View;
            effect.Projection = camera.Projection;
            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                device.SetVertexBuffer(floorBuffer);
                device.DrawPrimitives(
                    PrimitiveType.TriangleList,
                    0,
                    floorBuffer.VertexCount/3);

                //device.SetVertexBuffer(wallBuffer);
                //device.DrawPrimitives(
                //    PrimitiveType.TriangleList,
                //    0,
                //    wallBuffer.VertexCount/3);
            }
        }