Пример #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            playerSpriteSheet = this.Content.Load<Texture2D>("spritesheet");
            brickTex = this.Content.Load<Texture2D>("Brick");
            Vector2 vp = new Vector2(graphics.GraphicsDevice.Viewport.Width, graphics.GraphicsDevice.Viewport.Height);

            Vector2 cellDim = new Vector2(playerSpriteSheet.Width / 3, playerSpriteSheet.Height / 4);
            vp -= cellDim;

            Player.boundaries = vp;
            vp.Y = (float)System.Math.Floor(vp.Y);
            vp.X = (float)System.Math.Floor(vp.X);

            player = new Player(playerSpriteSheet,vp);
            bricks = new List<Entity>();
            bricks.Add(new Entity(brickTex,100,100));
            bricks.Add(new Entity(brickTex, 200, 100));
            bricks.Add(new Entity(brickTex, 300, 100));
            bricks.Add(new Entity(brickTex, 400, 100));
            bricks.Add(new Entity(brickTex, 500, 100));
        }
Пример #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            settings = Settings.Load("Settings.xml");
            workarea = Workarea.Load("Workarea.xml", Content);
            workarea.Settings = settings;
            workarea.Game = this;

            map = Map.Load("Maps\\City.xml", workarea);
            //map = Map.Load("Maps\\Cemetery.xml", workarea);
            gameMap=new GameMap(this, map);
            gameMap.LoadContent(Content);

            player = new Player("PLAYER", map){ Fraction = 1, Position = new Vector3(10f,0f,15f), Angles = Vector3.Zero};
            map.Units.Add(player);

            camera = new FirstPersonCamera(this, player);
            workarea.Camera = camera;

            Interface = new Interface(this, player, fpsCounter);
            Components.Add(Interface);

            //axies=new Axies(this);

            IsFixedTimeStep = settings.IsFixedTimeStep;
            graphics.SynchronizeWithVerticalRetrace = settings.SynchronizeWithVerticalRetrace;
            graphics.PreferredBackBufferWidth = settings.ScreenWidth;
            graphics.PreferredBackBufferHeight = settings.ScreenHeight;
            graphics.ApplyChanges();
        }