Ejemplo n.º 1
0
        public void Move(Camera camera, GameTime gameTime)
        {
            var mouseState = Mouse.GetState();
            var elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if(mouseState.X > _centerScreenX)
            {
                camera.RotationY = MathHelper.WrapAngle(camera.RotationY - (RotateScale * elapsed));
            }

            if(mouseState.X < _centerScreenX)
            {
                camera.RotationY = MathHelper.WrapAngle(camera.RotationY + (RotateScale * elapsed));
            }

            if(mouseState.Y > _centerScreenY)
            {
                camera.RotationX = MathHelper.WrapAngle(camera.RotationX - (RotateScale * elapsed));
            }

            if(mouseState.Y < _centerScreenY)
            {
                camera.RotationX = MathHelper.WrapAngle(camera.RotationX + (RotateScale * elapsed));
            }
        }
Ejemplo n.º 2
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()
        {
            // TODO: Add your initialization logic here
            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);

            mouseController = new MouseController(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
            base.Initialize();
        }
Ejemplo n.º 3
0
        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);
        }