Ejemplo n.º 1
0
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
        graphics.PreferredBackBufferWidth = 320;    // windows width
        graphics.PreferredBackBufferHeight = 240;   // windwos height
     camera = new Camera(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight,8,8);  // 8 brickcs scaling to fit on screen if lower the other will get outside screen
 }
Ejemplo n.º 2
0
 public Game1()
 {
     graphics = new GraphicsDeviceManager(this);
     camera = new Camera(graphics);
     Content.RootDirectory = "Content";
     Window.AllowUserResizing = true;
     graphics.PreferredBackBufferHeight = 620;
     graphics.PreferredBackBufferWidth = 480;
 }
Ejemplo n.º 3
0
        public chessBoard()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.IsFullScreen = false;
            graphics.PreferredBackBufferHeight = 320;
            graphics.PreferredBackBufferWidth = 240;
            graphics.ApplyChanges();

            camera = new Camera(graphics);
        }
Ejemplo n.º 4
0
        public Tank(Model model, GraphicsDevice device, Camera camera)
            : base(model)
        {
            mousePick = new MousePick(device, camera);
            turretBone = model.Bones["turret_geo"];
            wheels = new ModelBone[4];
            wheels[0] = model.Bones["r_front_wheel_geo"];
            wheels[1] = model.Bones["r_back_wheel_geo"];
            wheels[2] = model.Bones["l_front_wheel_geo"];
            wheels[3] = model.Bones["l_back_wheel_geo"];

            speed = 10f;
        }
Ejemplo n.º 5
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
            device = graphics.GraphicsDevice;
            modelManager = new ModelManager(this);
            Components.Add(modelManager);

            camera = new Camera(this,new Vector3(0,400 ,500), new Vector3(0,25,0), Vector3.Up);
            this.IsMouseVisible = true;
            Components.Add(camera);

            primitive = new Primitive(this, camera,device);
            Components.Add(primitive);

            base.Initialize();
        }
Ejemplo n.º 6
0
        public virtual void Draw(GraphicsDevice device, Camera camera)
        {
            Matrix[] transforms = new Matrix[model.Bones.Count];

            model.CopyAbsoluteBoneTransformsTo(transforms);

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {

                    effect.View = camera.view;
                    effect.Projection = camera.projection;
                    effect.TextureEnabled = true;
                    effect.Alpha = 1;

                    //effect.World = mesh.ParentBone.Transform*Getworld();
                    effect.World = transforms[mesh.ParentBone.Index] * Getworld();

                }
                mesh.Draw();
            }
        }
Ejemplo n.º 7
0
 public MousePick(GraphicsDevice device, Camera camera)
 {
     this.device = device;
     this.camera = camera;
 }
Ejemplo n.º 8
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     base.Draw(device, camera);
 }
Ejemplo n.º 9
0
 public Primitive(Game game, Camera camera, GraphicsDevice device)
     : base(game)
 {
     this.camera = camera;
     pick = new MousePick(device, camera);
 }
Ejemplo n.º 10
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     device.SamplerStates[0] = SamplerState.LinearWrap;
     base.Draw(device, camera);
 }
Ejemplo n.º 11
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(this, new Vector3(0, 0, 5), Vector3.Zero,new Vector3(0,1,0));
            Components.Add(camera);
            rotation = Matrix.Identity;
               translation = Matrix.Identity;
               scale = Matrix.Identity;
            base.Initialize();
        }
Ejemplo n.º 12
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     skyBox = scale * Matrix.CreateTranslation((camera.cameraPosition) - new Vector3 (0,camera.cameraPosition.Y,0));
     device.SamplerStates[0] = SamplerState.LinearClamp;
     base.Draw(device, camera);
 }