예제 #1
0
파일: MainMenu.cs 프로젝트: bradleat/trafps
 /// <summary>
 /// Create user interface renderer
 /// </summary>
 /// 
 public MainMenu(Game game)
     : base(game)
 {
     this.game = game;
     input = new InputHelper();
     content = new ContentManager(game.Services);
     //SpriteRenderer = new SpriteBatch(game.GraphicsDevice);
 }
예제 #2
0
파일: Game1.cs 프로젝트: bradleat/trafps
 public Game1(EGGEditor form)
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     input = new InputHelper();
     Components.Add(new GamerServicesComponent(this));
     this.drawSurface = form.getDrawSurface();
     this.form = form;
     graphics.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs>(graphics_PreparingDeviceSettings);
     System.Windows.Forms.Control.FromHandle((this.Window.Handle)).VisibleChanged += new EventHandler(Game1_VisibleChanged);
 }
예제 #3
0
        public FPSCamera(Viewport viewPort, Vector3 startingPos, float lrRot,
            float udRot)
        {
            this.leftRightRot = lrRot;
            this.upDownRot = udRot;
            this.cameraPosition = startingPos;
            this.viewPort = viewPort;

            float viewAngle = MathHelper.PiOver4;
            float nearPlane = 0.5f;
            float farPlane = 10000.0f;
            projectionMatrix = Matrix.CreatePerspectiveFieldOfView
                (viewAngle, viewPort.AspectRatio, nearPlane, farPlane);

            UpdateViewMatrix(false);

            Mouse.SetPosition(viewPort.Width / 2, viewPort.Height / 2);
            originalMouseState = Mouse.GetState();
            input = new InputHelper();
        }
예제 #4
0
        /// <summary>
        /// Draws the model in 3D space using the current camera's view matrix 
        /// and projection matrix.
        /// </summary>
        /// <param name="camera">The current camera being used</param>
        public void Draw(FPSCamera camera)
        {
            InputHelper input = new InputHelper();
            if (input.KeyDown(Keys.F))
                temp += 0.05f;

            model.CopyAbsoluteBoneTransformsTo(modelTransforms);
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.World = worldMatrix * modelTransforms[mesh.ParentBone.Index]
                        * Matrix.CreateTranslation(position);
                    effect.View = camera.ViewMatrix;
                    effect.Projection = camera.ProjectionMatrix;
                }
                mesh.Draw();
            }
        }